in client/vscode/src/identityActivation.ts [89:163]
async function execTestCommand(client: LanguageClient): Promise<void> {
try {
const result = await client.sendRequest(updateProfileRequestType.method, {
profile: {
kinds: [ProfileKind.SsoTokenProfile],
name: 'codecatalyst',
settings: {
region: 'us-west-2',
sso_session: 'codecatalyst2',
},
},
ssoSession: {
name: 'codecatalyst2',
settings: {
sso_region: 'us-east-1',
sso_start_url: 'https://view.awsapps.com/start',
sso_registration_scopes: ['codecatalyst:read_write'],
},
},
} satisfies UpdateProfileParams)
window.showInformationMessage(`UpdateProfile: ${JSON.stringify(result)}`)
} catch (e) {
const are = e as AwsResponseError
window.showErrorMessage(`${are.message} [${are.data?.awsErrorCode}]`)
}
try {
const result = await client.sendRequest(listProfilesRequestType.method, {} satisfies ListProfilesParams)
window.showInformationMessage(`ListProfiles: ${JSON.stringify(result)}`)
} catch (e) {
const are = e as AwsResponseError
window.showErrorMessage(`${are.message} [${are.data?.awsErrorCode}]`)
}
let ssoToken
try {
const cancellationTokenSource = new CancellationTokenSource()
//setTimeout(() => cancellationTokenSource.cancel(), 500)
const result: GetSsoTokenResult = await client.sendRequest(
getSsoTokenRequestType.method,
{
clientName: 'Flare test client',
// source: {
// kind: SsoTokenSourceKind.AwsBuilderId,
// ssoRegistrationScopes: ['codewhisperer:analysis', 'codewhisperer:completions'],
// } satisfies AwsBuilderIdSsoTokenSource,
source: {
kind: SsoTokenSourceKind.IamIdentityCenter,
profileName: 'eclipse-q-profile',
} satisfies IamIdentityCenterSsoTokenSource,
options: {
// authorizationFlow: 'Pkce',
authorizationFlow: 'DeviceCode',
},
} satisfies GetSsoTokenParams,
cancellationTokenSource.token
)
ssoToken = result.ssoToken
window.showInformationMessage(`GetSsoToken: ${JSON.stringify(result)}`)
} catch (e) {
const are = e as AwsResponseError
window.showErrorMessage(`${are.message} [${are.data?.awsErrorCode}]`)
}
try {
await client.sendRequest(invalidateSsoTokenRequestType.method, {
ssoTokenId: ssoToken?.id || 'eclipse-q-profile',
} satisfies InvalidateSsoTokenParams)
window.showInformationMessage(`InvalidateSsoToken: successful`)
} catch (e) {
const are = e as AwsResponseError
window.showErrorMessage(`${are.message} [${are.data?.awsErrorCode}]`)
}
}