@@ -128,25 +128,19 @@ interface AssumeRoleWithProviderProfile extends Profile {
128
128
credential_source : string ;
129
129
}
130
130
131
- const isAssumeRoleWithSourceProfile = ( arg : any ) : arg is AssumeRoleWithSourceProfile =>
131
+ const isAssumeRoleProfile = ( arg : any ) =>
132
132
Boolean ( arg ) &&
133
133
typeof arg === "object" &&
134
134
typeof arg . role_arn === "string" &&
135
- typeof arg . source_profile === "string" &&
136
- typeof arg . credential_source === "undefined" &&
137
135
[ "undefined" , "string" ] . indexOf ( typeof arg . role_session_name ) > - 1 &&
138
136
[ "undefined" , "string" ] . indexOf ( typeof arg . external_id ) > - 1 &&
139
137
[ "undefined" , "string" ] . indexOf ( typeof arg . mfa_serial ) > - 1 ;
140
138
139
+ const isAssumeRoleWithSourceProfile = ( arg : any ) : arg is AssumeRoleWithSourceProfile =>
140
+ isAssumeRoleProfile ( arg ) && typeof arg . source_profile === "string" && typeof arg . credential_source === "undefined" ;
141
+
141
142
const isAssumeRoleWithProviderProfile = ( arg : any ) : arg is AssumeRoleWithProviderProfile =>
142
- Boolean ( arg ) &&
143
- typeof arg === "object" &&
144
- typeof arg . role_arn === "string" &&
145
- typeof arg . credential_source === "string" &&
146
- typeof arg . source_profile === "undefined" &&
147
- [ "undefined" , "string" ] . indexOf ( typeof arg . role_session_name ) > - 1 &&
148
- [ "undefined" , "string" ] . indexOf ( typeof arg . external_id ) > - 1 &&
149
- [ "undefined" , "string" ] . indexOf ( typeof arg . mfa_serial ) > - 1 ;
143
+ isAssumeRoleProfile ( arg ) && typeof arg . credential_source === "string" && typeof arg . source_profile === "undefined" ;
150
144
151
145
/**
152
146
* Creates a credential provider that will read from ini files and supports
@@ -282,7 +276,7 @@ const resolveCredentialSource = (credentialSource: string, profileName: string):
282
276
} else {
283
277
throw new ProviderError (
284
278
`Unsupported credential source in profile ${ profileName } . Got ${ credentialSource } , ` +
285
- `expect EcsContainer or Ec2InstanceMetadata or Environment`
279
+ `expected EcsContainer or Ec2InstanceMetadata or Environment. `
286
280
) ;
287
281
}
288
282
} ;
0 commit comments