From 9c3e91aeb155cad42ce56cc116aa71bc8f2457c9 Mon Sep 17 00:00:00 2001 From: Steven Yuan Date: Thu, 11 Jan 2024 08:01:36 -0800 Subject: [PATCH] fix(experimentalIdentityAndAuth): rename `AWSSDKSigV4` to `AwsSdkSigV4` (#5667) --- .../src/auth/httpAuthSchemeProvider.ts | 16 +++---- .../src/runtimeConfig.shared.ts | 4 +- .../src/auth/httpAuthSchemeProvider.ts | 16 +++---- .../client-ec2/src/runtimeConfig.shared.ts | 4 +- .../src/auth/httpAuthSchemeProvider.ts | 16 +++---- .../client-polly/src/runtimeConfig.shared.ts | 4 +- .../src/auth/httpAuthSchemeProvider.ts | 16 +++---- .../client-rds/src/runtimeConfig.shared.ts | 4 +- .../src/auth/httpAuthSchemeProvider.ts | 16 +++---- .../client-sqs/src/runtimeConfig.shared.ts | 4 +- .../src/auth/httpAuthSchemeProvider.ts | 16 +++---- .../client-sts/src/runtimeConfig.shared.ts | 4 +- clients/client-sts/src/runtimeConfig.ts | 4 +- .../integration/AwsSdkCustomizeSigV4Auth.java | 12 ++--- ...SDKSigV4Signer.ts => AwsSdkSigV4Signer.ts} | 44 ++++++++++++------- .../core/src/httpAuthSchemes/aws_sdk/index.ts | 4 +- ...4Config.ts => resolveAwsSdkSigV4Config.ts} | 40 ++++++++++++----- .../throwAWSSDKSigningPropertyError.ts | 9 ---- 18 files changed, 129 insertions(+), 104 deletions(-) rename packages/core/src/httpAuthSchemes/aws_sdk/{AWSSDKSigV4Signer.ts => AwsSdkSigV4Signer.ts} (70%) rename packages/core/src/httpAuthSchemes/aws_sdk/{resolveAWSSDKSigV4Config.ts => resolveAwsSdkSigV4Config.ts} (85%) delete mode 100644 packages/core/src/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.ts diff --git a/clients/client-dynamodb/src/auth/httpAuthSchemeProvider.ts b/clients/client-dynamodb/src/auth/httpAuthSchemeProvider.ts index 3ec914784a2c..fc5e6431dba9 100644 --- a/clients/client-dynamodb/src/auth/httpAuthSchemeProvider.ts +++ b/clients/client-dynamodb/src/auth/httpAuthSchemeProvider.ts @@ -1,9 +1,9 @@ // smithy-typescript generated code import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, + AwsSdkSigV4AuthInputConfig, + AwsSdkSigV4AuthResolvedConfig, + AwsSdkSigV4PreviouslyResolved, + resolveAwsSdkSigV4Config, } from "@aws-sdk/core"; import { HandlerExecutionContext, @@ -93,7 +93,7 @@ export const defaultDynamoDBHttpAuthSchemeProvider: DynamoDBHttpAuthSchemeProvid /** * @internal */ -export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { +export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -110,7 +110,7 @@ export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { /** * @internal */ -export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedConfig { +export interface HttpAuthSchemeResolvedConfig extends AwsSdkSigV4AuthResolvedConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -128,9 +128,9 @@ export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedCon * @internal */ export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved + config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved ): T & HttpAuthSchemeResolvedConfig => { - const config_0 = resolveAWSSDKSigV4Config(config); + const config_0 = resolveAwsSdkSigV4Config(config); return { ...config_0, } as T & HttpAuthSchemeResolvedConfig; diff --git a/clients/client-dynamodb/src/runtimeConfig.shared.ts b/clients/client-dynamodb/src/runtimeConfig.shared.ts index 2bcd9613e266..7dd8fc175a1a 100644 --- a/clients/client-dynamodb/src/runtimeConfig.shared.ts +++ b/clients/client-dynamodb/src/runtimeConfig.shared.ts @@ -1,5 +1,5 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; +import { AwsSdkSigV4Signer } from "@aws-sdk/core"; import { NoOpLogger } from "@smithy/smithy-client"; import { IdentityProviderConfig } from "@smithy/types"; import { parseUrl } from "@smithy/url-parser"; @@ -26,7 +26,7 @@ export const getRuntimeConfig = (config: DynamoDBClientConfig) => { { schemeId: "aws.auth#sigv4", identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), + signer: new AwsSdkSigV4Signer(), }, ], logger: config?.logger ?? new NoOpLogger(), diff --git a/clients/client-ec2/src/auth/httpAuthSchemeProvider.ts b/clients/client-ec2/src/auth/httpAuthSchemeProvider.ts index 370a679b81be..a051b9afaff3 100644 --- a/clients/client-ec2/src/auth/httpAuthSchemeProvider.ts +++ b/clients/client-ec2/src/auth/httpAuthSchemeProvider.ts @@ -1,9 +1,9 @@ // smithy-typescript generated code import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, + AwsSdkSigV4AuthInputConfig, + AwsSdkSigV4AuthResolvedConfig, + AwsSdkSigV4PreviouslyResolved, + resolveAwsSdkSigV4Config, } from "@aws-sdk/core"; import { HandlerExecutionContext, @@ -93,7 +93,7 @@ export const defaultEC2HttpAuthSchemeProvider: EC2HttpAuthSchemeProvider = (auth /** * @internal */ -export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { +export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -110,7 +110,7 @@ export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { /** * @internal */ -export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedConfig { +export interface HttpAuthSchemeResolvedConfig extends AwsSdkSigV4AuthResolvedConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -128,9 +128,9 @@ export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedCon * @internal */ export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved + config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved ): T & HttpAuthSchemeResolvedConfig => { - const config_0 = resolveAWSSDKSigV4Config(config); + const config_0 = resolveAwsSdkSigV4Config(config); return { ...config_0, } as T & HttpAuthSchemeResolvedConfig; diff --git a/clients/client-ec2/src/runtimeConfig.shared.ts b/clients/client-ec2/src/runtimeConfig.shared.ts index aa9a8b2e5e98..740036fab24d 100644 --- a/clients/client-ec2/src/runtimeConfig.shared.ts +++ b/clients/client-ec2/src/runtimeConfig.shared.ts @@ -1,5 +1,5 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; +import { AwsSdkSigV4Signer } from "@aws-sdk/core"; import { NoOpLogger } from "@smithy/smithy-client"; import { IdentityProviderConfig } from "@smithy/types"; import { parseUrl } from "@smithy/url-parser"; @@ -26,7 +26,7 @@ export const getRuntimeConfig = (config: EC2ClientConfig) => { { schemeId: "aws.auth#sigv4", identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), + signer: new AwsSdkSigV4Signer(), }, ], logger: config?.logger ?? new NoOpLogger(), diff --git a/clients/client-polly/src/auth/httpAuthSchemeProvider.ts b/clients/client-polly/src/auth/httpAuthSchemeProvider.ts index c1c2c9c95a87..506c21ddd30d 100644 --- a/clients/client-polly/src/auth/httpAuthSchemeProvider.ts +++ b/clients/client-polly/src/auth/httpAuthSchemeProvider.ts @@ -1,9 +1,9 @@ // smithy-typescript generated code import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, + AwsSdkSigV4AuthInputConfig, + AwsSdkSigV4AuthResolvedConfig, + AwsSdkSigV4PreviouslyResolved, + resolveAwsSdkSigV4Config, } from "@aws-sdk/core"; import { HandlerExecutionContext, @@ -93,7 +93,7 @@ export const defaultPollyHttpAuthSchemeProvider: PollyHttpAuthSchemeProvider = ( /** * @internal */ -export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { +export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -110,7 +110,7 @@ export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { /** * @internal */ -export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedConfig { +export interface HttpAuthSchemeResolvedConfig extends AwsSdkSigV4AuthResolvedConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -128,9 +128,9 @@ export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedCon * @internal */ export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved + config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved ): T & HttpAuthSchemeResolvedConfig => { - const config_0 = resolveAWSSDKSigV4Config(config); + const config_0 = resolveAwsSdkSigV4Config(config); return { ...config_0, } as T & HttpAuthSchemeResolvedConfig; diff --git a/clients/client-polly/src/runtimeConfig.shared.ts b/clients/client-polly/src/runtimeConfig.shared.ts index 466bac49b982..b29be6255aec 100644 --- a/clients/client-polly/src/runtimeConfig.shared.ts +++ b/clients/client-polly/src/runtimeConfig.shared.ts @@ -1,5 +1,5 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; +import { AwsSdkSigV4Signer } from "@aws-sdk/core"; import { NoOpLogger } from "@smithy/smithy-client"; import { IdentityProviderConfig } from "@smithy/types"; import { parseUrl } from "@smithy/url-parser"; @@ -27,7 +27,7 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { { schemeId: "aws.auth#sigv4", identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), + signer: new AwsSdkSigV4Signer(), }, ], logger: config?.logger ?? new NoOpLogger(), diff --git a/clients/client-rds/src/auth/httpAuthSchemeProvider.ts b/clients/client-rds/src/auth/httpAuthSchemeProvider.ts index c4f625ac5d03..81038cd3bc85 100644 --- a/clients/client-rds/src/auth/httpAuthSchemeProvider.ts +++ b/clients/client-rds/src/auth/httpAuthSchemeProvider.ts @@ -1,9 +1,9 @@ // smithy-typescript generated code import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, + AwsSdkSigV4AuthInputConfig, + AwsSdkSigV4AuthResolvedConfig, + AwsSdkSigV4PreviouslyResolved, + resolveAwsSdkSigV4Config, } from "@aws-sdk/core"; import { HandlerExecutionContext, @@ -93,7 +93,7 @@ export const defaultRDSHttpAuthSchemeProvider: RDSHttpAuthSchemeProvider = (auth /** * @internal */ -export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { +export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -110,7 +110,7 @@ export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { /** * @internal */ -export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedConfig { +export interface HttpAuthSchemeResolvedConfig extends AwsSdkSigV4AuthResolvedConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -128,9 +128,9 @@ export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedCon * @internal */ export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved + config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved ): T & HttpAuthSchemeResolvedConfig => { - const config_0 = resolveAWSSDKSigV4Config(config); + const config_0 = resolveAwsSdkSigV4Config(config); return { ...config_0, } as T & HttpAuthSchemeResolvedConfig; diff --git a/clients/client-rds/src/runtimeConfig.shared.ts b/clients/client-rds/src/runtimeConfig.shared.ts index 774fccfe63d1..93a134aa1bfb 100644 --- a/clients/client-rds/src/runtimeConfig.shared.ts +++ b/clients/client-rds/src/runtimeConfig.shared.ts @@ -1,5 +1,5 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; +import { AwsSdkSigV4Signer } from "@aws-sdk/core"; import { NoOpLogger } from "@smithy/smithy-client"; import { IdentityProviderConfig } from "@smithy/types"; import { parseUrl } from "@smithy/url-parser"; @@ -26,7 +26,7 @@ export const getRuntimeConfig = (config: RDSClientConfig) => { { schemeId: "aws.auth#sigv4", identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), + signer: new AwsSdkSigV4Signer(), }, ], logger: config?.logger ?? new NoOpLogger(), diff --git a/clients/client-sqs/src/auth/httpAuthSchemeProvider.ts b/clients/client-sqs/src/auth/httpAuthSchemeProvider.ts index 204eb1d9ca95..15537059c74d 100644 --- a/clients/client-sqs/src/auth/httpAuthSchemeProvider.ts +++ b/clients/client-sqs/src/auth/httpAuthSchemeProvider.ts @@ -1,9 +1,9 @@ // smithy-typescript generated code import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, + AwsSdkSigV4AuthInputConfig, + AwsSdkSigV4AuthResolvedConfig, + AwsSdkSigV4PreviouslyResolved, + resolveAwsSdkSigV4Config, } from "@aws-sdk/core"; import { HandlerExecutionContext, @@ -93,7 +93,7 @@ export const defaultSQSHttpAuthSchemeProvider: SQSHttpAuthSchemeProvider = (auth /** * @internal */ -export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { +export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -110,7 +110,7 @@ export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { /** * @internal */ -export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedConfig { +export interface HttpAuthSchemeResolvedConfig extends AwsSdkSigV4AuthResolvedConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -128,9 +128,9 @@ export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedCon * @internal */ export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved + config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved ): T & HttpAuthSchemeResolvedConfig => { - const config_0 = resolveAWSSDKSigV4Config(config); + const config_0 = resolveAwsSdkSigV4Config(config); return { ...config_0, } as T & HttpAuthSchemeResolvedConfig; diff --git a/clients/client-sqs/src/runtimeConfig.shared.ts b/clients/client-sqs/src/runtimeConfig.shared.ts index 99614b59804a..5057998acf65 100644 --- a/clients/client-sqs/src/runtimeConfig.shared.ts +++ b/clients/client-sqs/src/runtimeConfig.shared.ts @@ -1,5 +1,5 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; +import { AwsSdkSigV4Signer } from "@aws-sdk/core"; import { NoOpLogger } from "@smithy/smithy-client"; import { IdentityProviderConfig } from "@smithy/types"; import { parseUrl } from "@smithy/url-parser"; @@ -26,7 +26,7 @@ export const getRuntimeConfig = (config: SQSClientConfig) => { { schemeId: "aws.auth#sigv4", identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), + signer: new AwsSdkSigV4Signer(), }, ], logger: config?.logger ?? new NoOpLogger(), diff --git a/clients/client-sts/src/auth/httpAuthSchemeProvider.ts b/clients/client-sts/src/auth/httpAuthSchemeProvider.ts index 8b63101df3cd..402a525fed6d 100644 --- a/clients/client-sts/src/auth/httpAuthSchemeProvider.ts +++ b/clients/client-sts/src/auth/httpAuthSchemeProvider.ts @@ -1,9 +1,9 @@ // smithy-typescript generated code import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, + AwsSdkSigV4AuthInputConfig, + AwsSdkSigV4AuthResolvedConfig, + AwsSdkSigV4PreviouslyResolved, + resolveAwsSdkSigV4Config, } from "@aws-sdk/core"; import { Client, @@ -123,7 +123,7 @@ export const resolveStsAuthConfig = (input: T & StsAuthInputConfig): T & StsA /** * @internal */ -export interface HttpAuthSchemeInputConfig extends StsAuthInputConfig, AWSSDKSigV4AuthInputConfig { +export interface HttpAuthSchemeInputConfig extends StsAuthInputConfig, AwsSdkSigV4AuthInputConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -140,7 +140,7 @@ export interface HttpAuthSchemeInputConfig extends StsAuthInputConfig, AWSSDKSig /** * @internal */ -export interface HttpAuthSchemeResolvedConfig extends StsAuthResolvedConfig, AWSSDKSigV4AuthResolvedConfig { +export interface HttpAuthSchemeResolvedConfig extends StsAuthResolvedConfig, AwsSdkSigV4AuthResolvedConfig { /** * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. * @internal @@ -158,10 +158,10 @@ export interface HttpAuthSchemeResolvedConfig extends StsAuthResolvedConfig, AWS * @internal */ export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved + config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved ): T & HttpAuthSchemeResolvedConfig => { const config_0 = resolveStsAuthConfig(config); - const config_1 = resolveAWSSDKSigV4Config(config_0); + const config_1 = resolveAwsSdkSigV4Config(config_0); return { ...config_1, } as T & HttpAuthSchemeResolvedConfig; diff --git a/clients/client-sts/src/runtimeConfig.shared.ts b/clients/client-sts/src/runtimeConfig.shared.ts index 4c24cfcf1d53..aa5056ebf4e9 100644 --- a/clients/client-sts/src/runtimeConfig.shared.ts +++ b/clients/client-sts/src/runtimeConfig.shared.ts @@ -1,5 +1,5 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; +import { AwsSdkSigV4Signer } from "@aws-sdk/core"; import { NoAuthSigner } from "@smithy/core"; import { NoOpLogger } from "@smithy/smithy-client"; import { IdentityProviderConfig } from "@smithy/types"; @@ -27,7 +27,7 @@ export const getRuntimeConfig = (config: STSClientConfig) => { { schemeId: "aws.auth#sigv4", identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), + signer: new AwsSdkSigV4Signer(), }, { schemeId: "smithy.api#noAuth", diff --git a/clients/client-sts/src/runtimeConfig.ts b/clients/client-sts/src/runtimeConfig.ts index b0f63454e062..4372e8cd673e 100644 --- a/clients/client-sts/src/runtimeConfig.ts +++ b/clients/client-sts/src/runtimeConfig.ts @@ -3,7 +3,7 @@ import packageInfo from "../package.json"; // eslint-disable-line import { decorateDefaultCredentialProvider } from "./defaultStsRoleAssumers"; -import { AWSSDKSigV4Signer, emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core"; +import { AwsSdkSigV4Signer, emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core"; import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { @@ -53,7 +53,7 @@ export const getRuntimeConfig = (config: STSClientConfig) => { ipc.getIdentityProvider("aws.auth#sigv4") || (async (idProps) => await decorateDefaultCredentialProvider(credentialDefaultProvider)(idProps?.__config || {})()), - signer: new AWSSDKSigV4Signer(), + signer: new AwsSdkSigV4Signer(), }, { schemeId: "smithy.api#noAuth", diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AwsSdkCustomizeSigV4Auth.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AwsSdkCustomizeSigV4Auth.java index e6db67a4ce97..ef7f6452bb37 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AwsSdkCustomizeSigV4Auth.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AwsSdkCustomizeSigV4Auth.java @@ -154,30 +154,30 @@ public void customizeSupportedHttpAuthSchemes( }),""", s)) .addResolveConfigFunction(ResolveConfigFunction.builder() .resolveConfigFunction(Symbol.builder() - .name("resolveAWSSDKSigV4Config") + .name("resolveAwsSdkSigV4Config") .namespace(AwsDependency.AWS_SDK_CORE.getPackageName(), "/") .addDependency(AwsDependency.AWS_SDK_CORE) .build()) .inputConfig(Symbol.builder() - .name("AWSSDKSigV4AuthInputConfig") + .name("AwsSdkSigV4AuthInputConfig") .namespace(AwsDependency.AWS_SDK_CORE.getPackageName(), "/") .addDependency(AwsDependency.AWS_SDK_CORE) .build()) .previouslyResolved(Symbol.builder() - .name("AWSSDKSigV4PreviouslyResolved") + .name("AwsSdkSigV4PreviouslyResolved") .namespace(AwsDependency.AWS_SDK_CORE.getPackageName(), "/") .addDependency(AwsDependency.AWS_SDK_CORE) .build()) .resolvedConfig(Symbol.builder() - .name("AWSSDKSigV4AuthResolvedConfig") + .name("AwsSdkSigV4AuthResolvedConfig") .namespace(AwsDependency.AWS_SDK_CORE.getPackageName(), "/") .addDependency(AwsDependency.AWS_SDK_CORE) .build()) .build()) .putDefaultSigner(LanguageTarget.SHARED, w -> w .addDependency(AwsDependency.AWS_SDK_CORE) - .addImport("AWSSDKSigV4Signer", null, AwsDependency.AWS_SDK_CORE) - .write("new AWSSDKSigV4Signer()")) + .addImport("AwsSdkSigV4Signer", null, AwsDependency.AWS_SDK_CORE) + .write("new AwsSdkSigV4Signer()")) .build(); supportedHttpAuthSchemesIndex.putHttpAuthScheme(authScheme.getSchemeId(), authScheme); } diff --git a/packages/core/src/httpAuthSchemes/aws_sdk/AWSSDKSigV4Signer.ts b/packages/core/src/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.ts similarity index 70% rename from packages/core/src/httpAuthSchemes/aws_sdk/AWSSDKSigV4Signer.ts rename to packages/core/src/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.ts index 9aebcaaa5928..7f1aed5594a2 100644 --- a/packages/core/src/httpAuthSchemes/aws_sdk/AWSSDKSigV4Signer.ts +++ b/packages/core/src/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.ts @@ -11,12 +11,21 @@ import { } from "@smithy/types"; import { getDateHeader, getSkewCorrectedDate, getUpdatedSystemClockOffset } from "../utils"; -import { throwAWSSDKSigningPropertyError } from "./throwAWSSDKSigningPropertyError"; /** * @internal */ -interface AWSSDKSigV4Config { +const throwSigningPropertyError = (name: string, property: T | undefined): T | never => { + if (!property) { + throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`); + } + return property; +}; + +/** + * @internal + */ +interface AwsSdkSigV4Config { systemClockOffset: number; signer: (authScheme?: AuthScheme) => Promise; } @@ -24,8 +33,8 @@ interface AWSSDKSigV4Config { /** * @internal */ -interface AWSSDKSigV4AuthSigningProperties { - config: AWSSDKSigV4Config; +interface AwsSdkSigV4AuthSigningProperties { + config: AwsSdkSigV4Config; signer: RequestSigner; signingRegion?: string; signingName?: string; @@ -34,7 +43,7 @@ interface AWSSDKSigV4AuthSigningProperties { /** * @internal */ -interface AWSSDKSigV4Exception extends ServiceException { +interface AwsSdkSigV4Exception extends ServiceException { ServerTime?: string; } @@ -43,14 +52,14 @@ interface AWSSDKSigV4Exception extends ServiceException { */ const validateSigningProperties = async ( signingProperties: Record -): Promise => { - const context = throwAWSSDKSigningPropertyError( +): Promise => { + const context = throwSigningPropertyError( "context", signingProperties.context as HandlerExecutionContext | undefined ); - const config = throwAWSSDKSigningPropertyError("config", signingProperties.config as AWSSDKSigV4Config | undefined); + const config = throwSigningPropertyError("config", signingProperties.config as AwsSdkSigV4Config | undefined); const authScheme = context.endpointV2?.properties?.authSchemes?.[0]; - const signerFunction = throwAWSSDKSigningPropertyError( + const signerFunction = throwSigningPropertyError( "signer", config.signer as ((authScheme?: AuthScheme) => Promise) | undefined ); @@ -68,7 +77,7 @@ const validateSigningProperties = async ( /** * @internal */ -export class AWSSDKSigV4Signer implements HttpSigner { +export class AwsSdkSigV4Signer implements HttpSigner { async sign( httpRequest: IHttpRequest, /** @@ -93,11 +102,11 @@ export class AWSSDKSigV4Signer implements HttpSigner { errorHandler(signingProperties: Record): (error: Error) => never { return (error: Error) => { const serverTime: string | undefined = - (error as AWSSDKSigV4Exception).ServerTime ?? getDateHeader((error as AWSSDKSigV4Exception).$response); + (error as AwsSdkSigV4Exception).ServerTime ?? getDateHeader((error as AwsSdkSigV4Exception).$response); if (serverTime) { - const config = throwAWSSDKSigningPropertyError( + const config = throwSigningPropertyError( "config", - signingProperties.config as AWSSDKSigV4Config | undefined + signingProperties.config as AwsSdkSigV4Config | undefined ); config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset); } @@ -108,11 +117,16 @@ export class AWSSDKSigV4Signer implements HttpSigner { successHandler(httpResponse: HttpResponse | unknown, signingProperties: Record): void { const dateHeader = getDateHeader(httpResponse); if (dateHeader) { - const config = throwAWSSDKSigningPropertyError( + const config = throwSigningPropertyError( "config", - signingProperties.config as AWSSDKSigV4Config | undefined + signingProperties.config as AwsSdkSigV4Config | undefined ); config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset); } } } + +/** + * @deprecated renamed to {@link AwsSdkSigV4Signer} + */ +export const AWSSDKSigV4Signer = AwsSdkSigV4Signer; diff --git a/packages/core/src/httpAuthSchemes/aws_sdk/index.ts b/packages/core/src/httpAuthSchemes/aws_sdk/index.ts index 4fbfd14a352a..6d17c7096d04 100644 --- a/packages/core/src/httpAuthSchemes/aws_sdk/index.ts +++ b/packages/core/src/httpAuthSchemes/aws_sdk/index.ts @@ -1,2 +1,2 @@ -export * from "./AWSSDKSigV4Signer"; -export * from "./resolveAWSSDKSigV4Config"; +export * from "./AwsSdkSigV4Signer"; +export * from "./resolveAwsSdkSigV4Config"; diff --git a/packages/core/src/httpAuthSchemes/aws_sdk/resolveAWSSDKSigV4Config.ts b/packages/core/src/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.ts similarity index 85% rename from packages/core/src/httpAuthSchemes/aws_sdk/resolveAWSSDKSigV4Config.ts rename to packages/core/src/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.ts index c9726c7df62a..7b01c9980e9c 100644 --- a/packages/core/src/httpAuthSchemes/aws_sdk/resolveAWSSDKSigV4Config.ts +++ b/packages/core/src/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.ts @@ -21,7 +21,7 @@ import { /** * @internal */ -export interface AWSSDKSigV4AuthInputConfig { +export interface AwsSdkSigV4AuthInputConfig { /** * The credentials used to sign requests. */ @@ -60,7 +60,7 @@ export interface AWSSDKSigV4AuthInputConfig { /** * @internal */ -export interface AWSSDKSigV4PreviouslyResolved { +export interface AwsSdkSigV4PreviouslyResolved { credentialDefaultProvider?: (input: any) => MemoizedProvider; region: string | Provider; sha256: ChecksumConstructor | HashConstructor; @@ -75,23 +75,23 @@ export interface AWSSDKSigV4PreviouslyResolved { /** * @internal */ -export interface AWSSDKSigV4AuthResolvedConfig { +export interface AwsSdkSigV4AuthResolvedConfig { /** - * Resolved value for input config {@link AWSSDKSigV4AuthInputConfig.credentials} + * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.credentials} * This provider MAY memoize the loaded credentials for certain period. * See {@link MemoizedProvider} for more information. */ credentials: AwsCredentialIdentityProvider; /** - * Resolved value for input config {@link AWSSDKSigV4AuthInputConfig.signer} + * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.signer} */ signer: (authScheme?: AuthScheme) => Promise; /** - * Resolved value for input config {@link AWSSDKSigV4AuthInputConfig.signingEscapePath} + * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.signingEscapePath} */ signingEscapePath: boolean; /** - * Resolved value for input config {@link AWSSDKSigV4AuthInputConfig.systemClockOffset} + * Resolved value for input config {@link AwsSdkSigV4AuthInputConfig.systemClockOffset} */ systemClockOffset: number; } @@ -99,9 +99,9 @@ export interface AWSSDKSigV4AuthResolvedConfig { /** * @internal */ -export const resolveAWSSDKSigV4Config = ( - config: T & AWSSDKSigV4AuthInputConfig & AWSSDKSigV4PreviouslyResolved -): T & AWSSDKSigV4AuthResolvedConfig => { +export const resolveAwsSdkSigV4Config = ( + config: T & AwsSdkSigV4AuthInputConfig & AwsSdkSigV4PreviouslyResolved +): T & AwsSdkSigV4AuthResolvedConfig => { // Normalize credentials let normalizedCreds: AwsCredentialIdentityProvider | undefined; if (config.credentials) { @@ -214,3 +214,23 @@ export const resolveAWSSDKSigV4Config = ( signer, }; }; + +/** + * @deprecated renamed to {@link AwsSdkSigV4AuthInputConfig} + */ +export interface AWSSDKSigV4AuthInputConfig extends AwsSdkSigV4AuthInputConfig {} + +/** + * @deprecated renamed to {@link AwsSdkSigV4PreviouslyResolved} + */ +export interface AWSSDKSigV4PreviouslyResolved extends AwsSdkSigV4PreviouslyResolved {} + +/** + * @deprecated renamed to {@link AwsSdkSigV4AuthResolvedConfig} + */ +export interface AWSSDKSigV4AuthResolvedConfig extends AwsSdkSigV4AuthResolvedConfig {} + +/** + * @deprecated renamed to {@link resolveAwsSdkSigV4Config} + */ +export const resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config; diff --git a/packages/core/src/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.ts b/packages/core/src/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.ts deleted file mode 100644 index 80ff07996bd3..000000000000 --- a/packages/core/src/httpAuthSchemes/aws_sdk/throwAWSSDKSigningPropertyError.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @internal - */ -export const throwAWSSDKSigningPropertyError = (name: string, property: T | undefined): T | never => { - if (!property) { - throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`); - } - return property; -};