@@ -51,7 +51,6 @@ import {
5151 SsoSession ,
5252 GetMfaCodeParams ,
5353 getMfaCodeRequestType ,
54-
5554} from '@aws/language-server-runtimes/protocol'
5655import { LanguageClient } from 'vscode-languageclient'
5756import { getLogger } from '../shared/logger/logger'
@@ -73,9 +72,7 @@ export const notificationTypes = {
7372 getConnectionMetadata : new RequestType < undefined , ConnectionMetadata , Error > (
7473 getConnectionMetadataRequestType . method
7574 ) ,
76- getMfaCode : new RequestType < GetMfaCodeParams , ResponseMessage , Error > (
77- getMfaCodeRequestType . method
78- )
75+ getMfaCode : new RequestType < GetMfaCodeParams , ResponseMessage , Error > ( getMfaCodeRequestType . method ) ,
7976}
8077
8178export type AuthState = 'notConnected' | 'connected' | 'expired'
@@ -101,7 +98,10 @@ export type TokenSource = IamIdentityCenterSsoTokenSource | AwsBuilderIdSsoToken
10198 */
10299export class LanguageClientAuth {
103100 readonly #ssoCacheWatcher = getCacheFileWatcher ( getCacheDir ( ) , getFlareCacheFileName ( VSCODE_EXTENSION_ID . amazonq ) )
104- readonly #stsCacheWatcher = getCacheFileWatcher ( getStsCacheDir ( ) , getFlareCacheFileName ( VSCODE_EXTENSION_ID . amazonq ) )
101+ readonly #stsCacheWatcher = getCacheFileWatcher (
102+ getStsCacheDir ( ) ,
103+ getFlareCacheFileName ( VSCODE_EXTENSION_ID . amazonq )
104+ )
105105
106106 constructor (
107107 private readonly client : LanguageClient ,
@@ -183,7 +183,14 @@ export class LanguageClientAuth {
183183 } satisfies UpdateProfileParams )
184184 }
185185
186- updateIamProfile ( profileName : string , accessKey : string , secretKey : string , sessionToken ?: string , roleArn ?: string , sourceProfile ?: string ) : Promise < UpdateProfileResult > {
186+ updateIamProfile (
187+ profileName : string ,
188+ accessKey : string ,
189+ secretKey : string ,
190+ sessionToken ?: string ,
191+ roleArn ?: string ,
192+ sourceProfile ?: string
193+ ) : Promise < UpdateProfileResult > {
187194 // Add credentials and delete SSO settings from profile
188195 let profile : Profile
189196 if ( roleArn ) {
@@ -306,7 +313,9 @@ export abstract class BaseLogin {
306313 protected loginType : LoginType | undefined
307314 protected connectionState : AuthState = 'notConnected'
308315 protected cancellationToken : CancellationTokenSource | undefined
309- protected _data : { startUrl ?: string ; region ?: string ; accessKey ?: string ; secretKey ?: string ; sessionToken ?: string } | undefined
316+ protected _data :
317+ | { startUrl ?: string ; region ?: string ; accessKey ?: string ; secretKey ?: string ; sessionToken ?: string }
318+ | undefined
310319
311320 constructor (
312321 public readonly profileName : string ,
@@ -533,7 +542,7 @@ export class IamLogin extends BaseLogin {
533542 )
534543 }
535544
536- async login ( opts : { accessKey : string ; secretKey : string , sessionToken ?: string , roleArn ?: string } ) {
545+ async login ( opts : { accessKey : string ; secretKey : string ; sessionToken ?: string ; roleArn ?: string } ) {
537546 await this . updateProfile ( opts )
538547 return this . _getIamCredential ( true )
539548 }
@@ -556,13 +565,27 @@ export class IamLogin extends BaseLogin {
556565 // TODO: DeleteProfile api in Identity Service (this doesn't exist yet)
557566 }
558567
559- async updateProfile ( opts : { accessKey : string ; secretKey : string , sessionToken ?: string , roleArn ?: string } ) {
568+ async updateProfile ( opts : { accessKey : string ; secretKey : string ; sessionToken ?: string ; roleArn ?: string } ) {
560569 if ( opts . roleArn ) {
561570 const sourceProfile = this . profileName + '-source'
562- await this . lspAuth . updateIamProfile ( sourceProfile , opts . accessKey , opts . secretKey , opts . sessionToken , '' , '' )
571+ await this . lspAuth . updateIamProfile (
572+ sourceProfile ,
573+ opts . accessKey ,
574+ opts . secretKey ,
575+ opts . sessionToken ,
576+ '' ,
577+ ''
578+ )
563579 await this . lspAuth . updateIamProfile ( this . profileName , '' , '' , '' , opts . roleArn , sourceProfile )
564580 } else {
565- await this . lspAuth . updateIamProfile ( this . profileName , opts . accessKey , opts . secretKey , opts . sessionToken , '' , '' )
581+ await this . lspAuth . updateIamProfile (
582+ this . profileName ,
583+ opts . accessKey ,
584+ opts . secretKey ,
585+ opts . sessionToken ,
586+ '' ,
587+ ''
588+ )
566589 }
567590 }
568591
0 commit comments