Skip to content

Commit

Permalink
refactor: remove v2 workaround, document v3 impl
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Mar 11, 2025
1 parent 11d6cf5 commit e6c875f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 63 deletions.
57 changes: 0 additions & 57 deletions packages/core/src/auth/sso/sdkV2Compat.ts

This file was deleted.

17 changes: 11 additions & 6 deletions packages/core/src/shared/clients/codecatalystClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ import {
import { SsoConnection } from '../../auth/connection'
import { DevSettings } from '../settings'
import { getServiceEnvVarConfig } from '../vscode/env'
import { AwsCommand } from '../awsClientBuilderV3'
import { AwsCommand, AwsCommandConstructor } from '../awsClientBuilderV3'
import { ClientWrapper } from './clientWrapper'
import { ServiceException } from '@aws-sdk/smithy-client'
import { AccessDeniedException } from '@aws-sdk/client-sso-oidc'
Expand Down Expand Up @@ -218,6 +218,7 @@ function createCodeCatalystClient(
regionCode: string,
endpoint: string
): CodeCatalystSDKClient {
// Avoid using cached client so that we can inject fresh bearer token provider.
return globals.sdkClientBuilderV3.createAwsService({
serviceClient: CodeCatalystSDKClient,
clientOptions: {
Expand Down Expand Up @@ -276,7 +277,7 @@ export async function createClient(

// TODO: move this to sso auth folder?
function getTokenProvider(connection: SsoConnection): TokenIdentityProvider {
return async (_props) => {
return async (_) => {
const token = await connection.getToken()
return {
token: token.accessToken,
Expand Down Expand Up @@ -322,7 +323,7 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
this.log = logger.getLogger()
}

protected override getClient(ignoreCache?: boolean): CodeCatalystSDKClient {
protected override getClient(): CodeCatalystSDKClient {
return this.sdkClientV3
}

Expand All @@ -340,7 +341,7 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
CommandOptions extends CommandInput,
Command extends AwsCommand<CommandInput, CommandOutput>,
>(
cmd: new (o: CommandInput) => Command,
cmd: AwsCommandConstructor<CommandInput, Command>,
commandOptions: CommandOptions,
silent: true,
defaultVal: CommandOutput
Expand All @@ -350,14 +351,18 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
CommandOutput extends object,
CommandOptions extends CommandInput,
Command extends AwsCommand<CommandInput, CommandOutput>,
>(cmd: new (o: CommandInput) => Command, commandOptions: CommandOptions, silent: false): Promise<CommandOutput>
>(
cmd: AwsCommandConstructor<CommandInput, Command>,
commandOptions: CommandOptions,
silent: false
): Promise<CommandOutput>
private async call<
CommandInput extends object,
CommandOutput extends object,
CommandOptions extends CommandInput,
Command extends AwsCommand<CommandInput, CommandOutput>,
>(
cmd: new (o: CommandInput) => Command,
cmd: AwsCommandConstructor<CommandInput, Command>,
commandOptions: CommandOptions,
silent: boolean,
defaultVal?: CommandOutput
Expand Down

0 comments on commit e6c875f

Please sign in to comment.