@@ -155,6 +155,7 @@ export class LanguageClientAuth {
155155 sso_session : profileName ,
156156 aws_access_key_id : '' ,
157157 aws_secret_access_key : '' ,
158+ role_arn : '' ,
158159 } ,
159160 } ,
160161 ssoSession : {
@@ -168,9 +169,9 @@ export class LanguageClientAuth {
168169 } satisfies UpdateProfileParams )
169170 }
170171
171- updateIamProfile ( profileName : string , accessKey : string , secretKey : string , sessionToken ?: string ) : Promise < UpdateProfileResult > {
172- // Use unknown profile type if invalidating all IAM fields
173- const kind = ! accessKey && ! secretKey && ! sessionToken ? ProfileKind . EmptyProfile : ProfileKind . IamCredentialProfile
172+ updateIamProfile ( profileName : string , accessKey : string , secretKey : string , sessionToken ?: string , roleArn ?: string ) : Promise < UpdateProfileResult > {
173+ // Use empty profile type if invalidating all IAM fields
174+ const kind = ! accessKey && ! secretKey ? ProfileKind . EmptyProfile : ProfileKind . IamCredentialProfile
174175 // Add credentials and delete SSO settings from profile
175176 return this . client . sendRequest ( updateProfileRequestType . method , {
176177 profile : {
@@ -182,6 +183,7 @@ export class LanguageClientAuth {
182183 aws_access_key_id : accessKey ,
183184 aws_secret_access_key : secretKey ,
184185 aws_session_token : sessionToken ,
186+ role_arn : roleArn ,
185187 } ,
186188 } ,
187189 ssoSession : {
@@ -488,7 +490,7 @@ export class IamLogin extends BaseLogin {
488490 // )
489491 }
490492
491- async login ( opts : { accessKey : string ; secretKey : string , sessionToken ?: string } ) {
493+ async login ( opts : { accessKey : string ; secretKey : string , sessionToken ?: string , roleArn ?: string } ) {
492494 await this . updateProfile ( opts )
493495 return this . _getIamCredential ( true )
494496 }
@@ -504,18 +506,18 @@ export class IamLogin extends BaseLogin {
504506 if ( this . iamCredentialId ) {
505507 await this . lspAuth . invalidateStsCredential ( this . iamCredentialId )
506508 }
507- await this . lspAuth . updateIamProfile ( this . profileName , '' , '' , '' )
509+ await this . lspAuth . updateIamProfile ( this . profileName , '' , '' , '' , '' )
508510 this . updateConnectionState ( 'notConnected' )
509511 this . _data = undefined
510512 // TODO: DeleteProfile api in Identity Service (this doesn't exist yet)
511513 }
512514
513- async updateProfile ( opts : { accessKey : string ; secretKey : string , sessionToken ?: string } ) {
514- await this . lspAuth . updateIamProfile ( this . profileName , opts . accessKey , opts . secretKey , opts . sessionToken )
515+ async updateProfile ( opts : { accessKey : string ; secretKey : string , sessionToken ?: string , roleArn ?: string } ) {
516+ await this . lspAuth . updateIamProfile ( this . profileName , opts . accessKey , opts . secretKey , opts . sessionToken , opts . roleArn )
515517 this . _data = {
516518 accessKey : opts . accessKey ,
517519 secretKey : opts . secretKey ,
518- sessionToken : opts . sessionToken
520+ sessionToken : opts . sessionToken ,
519521 }
520522 }
521523
@@ -585,7 +587,9 @@ export class IamLogin extends BaseLogin {
585587 this . cancellationToken = undefined
586588 }
587589
588- this . iamCredentialId = response . id
590+ if ( response . credentials . sessionToken ) {
591+ this . iamCredentialId = response . id
592+ }
589593 this . updateConnectionState ( 'connected' )
590594 return response
591595 }
0 commit comments