diff --git a/clients/client-ec2/package.json b/clients/client-ec2/package.json index ee7e2c27962af..74cc1b10eb45e 100644 --- a/clients/client-ec2/package.json +++ b/clients/client-ec2/package.json @@ -27,6 +27,7 @@ "@aws-sdk/middleware-logger": "*", "@aws-sdk/middleware-recursion-detection": "*", "@aws-sdk/middleware-sdk-ec2": "*", + "@aws-sdk/middleware-signing": "*", "@aws-sdk/middleware-user-agent": "*", "@aws-sdk/region-config-resolver": "*", "@aws-sdk/types": "*", @@ -55,7 +56,6 @@ "@smithy/util-defaults-mode-browser": "^2.0.24", "@smithy/util-defaults-mode-node": "^2.0.32", "@smithy/util-endpoints": "^1.0.8", - "@smithy/util-middleware": "^2.0.9", "@smithy/util-retry": "^2.0.9", "@smithy/util-utf8": "^2.0.2", "@smithy/util-waiter": "^2.0.16", diff --git a/clients/client-ec2/src/EC2Client.ts b/clients/client-ec2/src/EC2Client.ts index 0318230f36017..bdd345f8935b9 100644 --- a/clients/client-ec2/src/EC2Client.ts +++ b/clients/client-ec2/src/EC2Client.ts @@ -7,18 +7,20 @@ import { } from "@aws-sdk/middleware-host-header"; import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection"; +import { + AwsAuthInputConfig, + AwsAuthResolvedConfig, + getAwsAuthPlugin, + resolveAwsAuthConfig, +} from "@aws-sdk/middleware-signing"; import { getUserAgentPlugin, resolveUserAgentConfig, UserAgentInputConfig, UserAgentResolvedConfig, } from "@aws-sdk/middleware-user-agent"; +import { Credentials as __Credentials } from "@aws-sdk/types"; import { RegionInputConfig, RegionResolvedConfig, resolveRegionConfig } from "@smithy/config-resolver"; -import { - DefaultIdentityProviderConfig, - getHttpAuthSchemeEndpointRuleSetPlugin, - getHttpSigningPlugin, -} from "@smithy/core"; import { getContentLengthPlugin } from "@smithy/middleware-content-length"; import { EndpointInputConfig, EndpointResolvedConfig, resolveEndpointConfig } from "@smithy/middleware-endpoint"; import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry"; @@ -30,7 +32,6 @@ import { SmithyResolvedConfiguration as __SmithyResolvedConfiguration, } from "@smithy/smithy-client"; import { - AwsCredentialIdentityProvider, BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, @@ -47,12 +48,6 @@ import { UserAgent as __UserAgent, } from "@smithy/types"; -import { - defaultEC2HttpAuthSchemeParametersProvider, - HttpAuthSchemeInputConfig, - HttpAuthSchemeResolvedConfig, - resolveHttpAuthSchemeConfig, -} from "./auth/httpAuthSchemeProvider"; import { AcceptAddressTransferCommandInput, AcceptAddressTransferCommandOutput, @@ -3469,12 +3464,6 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ */ useFipsEndpoint?: boolean | __Provider; - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; - /** * The AWS region to which this client will send requests */ @@ -3482,10 +3471,15 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ /** * Default credentials provider; Not available in browser runtime. - * @deprecated * @internal */ - credentialDefaultProvider?: (input: any) => AwsCredentialIdentityProvider; + credentialDefaultProvider?: (input: any) => __Provider<__Credentials>; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; /** * Value for how many times a request will be made at most in case of retry. @@ -3524,8 +3518,8 @@ export type EC2ClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOpt EndpointInputConfig & RetryInputConfig & HostHeaderInputConfig & + AwsAuthInputConfig & UserAgentInputConfig & - HttpAuthSchemeInputConfig & ClientInputEndpointParameters; /** * @public @@ -3544,8 +3538,8 @@ export type EC2ClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHa EndpointResolvedConfig & RetryResolvedConfig & HostHeaderResolvedConfig & + AwsAuthResolvedConfig & UserAgentResolvedConfig & - HttpAuthSchemeResolvedConfig & ClientResolvedEndpointParameters; /** * @public @@ -3594,17 +3588,6 @@ export class EC2Client extends __Client< */ readonly config: EC2ClientResolvedConfig; - private getDefaultHttpAuthSchemeParametersProvider() { - return defaultEC2HttpAuthSchemeParametersProvider; - } - - private getIdentityProviderConfigProvider() { - return async (config: EC2ClientResolvedConfig) => - new DefaultIdentityProviderConfig({ - "aws.auth#sigv4": config.credentials, - }); - } - constructor(...[configuration]: __CheckOptionalClientConfig) { const _config_0 = __getRuntimeConfig(configuration || {}); const _config_1 = resolveClientEndpointParameters(_config_0); @@ -3612,8 +3595,8 @@ export class EC2Client extends __Client< const _config_3 = resolveEndpointConfig(_config_2); const _config_4 = resolveRetryConfig(_config_3); const _config_5 = resolveHostHeaderConfig(_config_4); - const _config_6 = resolveUserAgentConfig(_config_5); - const _config_7 = resolveHttpAuthSchemeConfig(_config_6); + const _config_6 = resolveAwsAuthConfig(_config_5); + const _config_7 = resolveUserAgentConfig(_config_6); const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []); super(_config_8); this.config = _config_8; @@ -3622,14 +3605,8 @@ export class EC2Client extends __Client< this.middlewareStack.use(getHostHeaderPlugin(this.config)); this.middlewareStack.use(getLoggerPlugin(this.config)); this.middlewareStack.use(getRecursionDetectionPlugin(this.config)); + this.middlewareStack.use(getAwsAuthPlugin(this.config)); this.middlewareStack.use(getUserAgentPlugin(this.config)); - this.middlewareStack.use( - getHttpAuthSchemeEndpointRuleSetPlugin(this.config, { - httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(), - identityProviderConfigProvider: this.getIdentityProviderConfigProvider(), - }) - ); - this.middlewareStack.use(getHttpSigningPlugin(this.config)); } /** diff --git a/clients/client-ec2/src/auth/httpAuthExtensionConfiguration.ts b/clients/client-ec2/src/auth/httpAuthExtensionConfiguration.ts deleted file mode 100644 index 4c42675f0d878..0000000000000 --- a/clients/client-ec2/src/auth/httpAuthExtensionConfiguration.ts +++ /dev/null @@ -1,72 +0,0 @@ -// smithy-typescript generated code -import { AwsCredentialIdentity, AwsCredentialIdentityProvider, HttpAuthScheme } from "@smithy/types"; - -import { EC2HttpAuthSchemeProvider } from "./httpAuthSchemeProvider"; - -/** - * @internal - */ -export interface HttpAuthExtensionConfiguration { - setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void; - httpAuthSchemes(): HttpAuthScheme[]; - setHttpAuthSchemeProvider(httpAuthSchemeProvider: EC2HttpAuthSchemeProvider): void; - httpAuthSchemeProvider(): EC2HttpAuthSchemeProvider; - setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void; - credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined; -} - -/** - * @internal - */ -export type HttpAuthRuntimeConfig = Partial<{ - httpAuthSchemes: HttpAuthScheme[]; - httpAuthSchemeProvider: EC2HttpAuthSchemeProvider; - credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider; -}>; - -/** - * @internal - */ -export const getHttpAuthExtensionConfiguration = ( - runtimeConfig: HttpAuthRuntimeConfig -): HttpAuthExtensionConfiguration => { - const _httpAuthSchemes = runtimeConfig.httpAuthSchemes!; - let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider!; - let _credentials = runtimeConfig.credentials; - return { - setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void { - const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); - if (index === -1) { - _httpAuthSchemes.push(httpAuthScheme); - } else { - _httpAuthSchemes.splice(index, 1, httpAuthScheme); - } - }, - httpAuthSchemes(): HttpAuthScheme[] { - return _httpAuthSchemes; - }, - setHttpAuthSchemeProvider(httpAuthSchemeProvider: EC2HttpAuthSchemeProvider): void { - _httpAuthSchemeProvider = httpAuthSchemeProvider; - }, - httpAuthSchemeProvider(): EC2HttpAuthSchemeProvider { - return _httpAuthSchemeProvider; - }, - setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void { - _credentials = credentials; - }, - credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined { - return _credentials; - }, - }; -}; - -/** - * @internal - */ -export const resolveHttpAuthRuntimeConfig = (config: HttpAuthExtensionConfiguration): HttpAuthRuntimeConfig => { - return { - httpAuthSchemes: config.httpAuthSchemes(), - httpAuthSchemeProvider: config.httpAuthSchemeProvider(), - credentials: config.credentials(), - }; -}; diff --git a/clients/client-ec2/src/auth/httpAuthSchemeProvider.ts b/clients/client-ec2/src/auth/httpAuthSchemeProvider.ts deleted file mode 100644 index 370a679b81be2..0000000000000 --- a/clients/client-ec2/src/auth/httpAuthSchemeProvider.ts +++ /dev/null @@ -1,137 +0,0 @@ -// smithy-typescript generated code -import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, -} from "@aws-sdk/core"; -import { - HandlerExecutionContext, - HttpAuthOption, - HttpAuthScheme, - HttpAuthSchemeParameters, - HttpAuthSchemeParametersProvider, - HttpAuthSchemeProvider, -} from "@smithy/types"; -import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware"; - -import { EC2ClientConfig, EC2ClientResolvedConfig } from "../EC2Client"; - -/** - * @internal - */ -export interface EC2HttpAuthSchemeParameters extends HttpAuthSchemeParameters { - region?: string; -} - -/** - * @internal - */ -export interface EC2HttpAuthSchemeParametersProvider - extends HttpAuthSchemeParametersProvider< - EC2ClientResolvedConfig, - HandlerExecutionContext, - EC2HttpAuthSchemeParameters, - object - > {} - -/** - * @internal - */ -export const defaultEC2HttpAuthSchemeParametersProvider = async ( - config: EC2ClientResolvedConfig, - context: HandlerExecutionContext, - input: object -): Promise => { - return { - operation: getSmithyContext(context).operation as string, - region: - (await normalizeProvider(config.region)()) || - (() => { - throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); - })(), - }; -}; - -function createAwsAuthSigv4HttpAuthOption(authParameters: EC2HttpAuthSchemeParameters): HttpAuthOption { - return { - schemeId: "aws.auth#sigv4", - signingProperties: { - name: "ec2", - region: authParameters.region, - }, - propertiesExtractor: (config: EC2ClientConfig, context) => ({ - /** - * @internal - */ - signingProperties: { - config, - context, - }, - }), - }; -} - -/** - * @internal - */ -export interface EC2HttpAuthSchemeProvider extends HttpAuthSchemeProvider {} - -/** - * @internal - */ -export const defaultEC2HttpAuthSchemeProvider: EC2HttpAuthSchemeProvider = (authParameters) => { - const options: HttpAuthOption[] = []; - switch (authParameters.operation) { - default: { - options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); - } - } - return options; -}; - -/** - * @internal - */ -export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { - /** - * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. - * @internal - */ - httpAuthSchemes?: HttpAuthScheme[]; - - /** - * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use. - * @internal - */ - httpAuthSchemeProvider?: EC2HttpAuthSchemeProvider; -} - -/** - * @internal - */ -export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedConfig { - /** - * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. - * @internal - */ - readonly httpAuthSchemes: HttpAuthScheme[]; - - /** - * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use. - * @internal - */ - readonly httpAuthSchemeProvider: EC2HttpAuthSchemeProvider; -} - -/** - * @internal - */ -export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved -): T & HttpAuthSchemeResolvedConfig => { - const config_0 = resolveAWSSDKSigV4Config(config); - return { - ...config_0, - } as T & HttpAuthSchemeResolvedConfig; -}; diff --git a/clients/client-ec2/src/extensionConfiguration.ts b/clients/client-ec2/src/extensionConfiguration.ts index 6a604672345d7..927fb916b9e1b 100644 --- a/clients/client-ec2/src/extensionConfiguration.ts +++ b/clients/client-ec2/src/extensionConfiguration.ts @@ -3,13 +3,10 @@ import { AwsRegionExtensionConfiguration } from "@aws-sdk/types"; import { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http"; import { DefaultExtensionConfiguration } from "@smithy/types"; -import { HttpAuthExtensionConfiguration } from "./auth/httpAuthExtensionConfiguration"; - /** * @internal */ export interface EC2ExtensionConfiguration extends HttpHandlerExtensionConfiguration, DefaultExtensionConfiguration, - AwsRegionExtensionConfiguration, - HttpAuthExtensionConfiguration {} + AwsRegionExtensionConfiguration {} diff --git a/clients/client-ec2/src/runtimeConfig.shared.ts b/clients/client-ec2/src/runtimeConfig.shared.ts index aa9a8b2e5e983..ce9884839dced 100644 --- a/clients/client-ec2/src/runtimeConfig.shared.ts +++ b/clients/client-ec2/src/runtimeConfig.shared.ts @@ -1,12 +1,9 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; import { NoOpLogger } from "@smithy/smithy-client"; -import { IdentityProviderConfig } from "@smithy/types"; import { parseUrl } from "@smithy/url-parser"; import { fromBase64, toBase64 } from "@smithy/util-base64"; import { fromUtf8, toUtf8 } from "@smithy/util-utf8"; -import { defaultEC2HttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider"; import { EC2ClientConfig } from "./EC2Client"; import { defaultEndpointResolver } from "./endpoint/endpointResolver"; @@ -21,14 +18,6 @@ export const getRuntimeConfig = (config: EC2ClientConfig) => { disableHostPrefix: config?.disableHostPrefix ?? false, endpointProvider: config?.endpointProvider ?? defaultEndpointResolver, extensions: config?.extensions ?? [], - httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultEC2HttpAuthSchemeProvider, - httpAuthSchemes: config?.httpAuthSchemes ?? [ - { - schemeId: "aws.auth#sigv4", - identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), - }, - ], logger: config?.logger ?? new NoOpLogger(), serviceId: config?.serviceId ?? "EC2", urlParser: config?.urlParser ?? parseUrl, diff --git a/clients/client-ec2/src/runtimeExtensions.ts b/clients/client-ec2/src/runtimeExtensions.ts index e1e2d8117bafd..2eafb7086e09d 100644 --- a/clients/client-ec2/src/runtimeExtensions.ts +++ b/clients/client-ec2/src/runtimeExtensions.ts @@ -6,7 +6,6 @@ import { import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http"; import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client"; -import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration"; import { EC2ExtensionConfiguration } from "./extensionConfiguration"; /** @@ -33,7 +32,6 @@ export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: Runtime ...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)), ...asPartial(getDefaultExtensionConfiguration(runtimeConfig)), ...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)), - ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)), }; extensions.forEach((extension) => extension.configure(extensionConfiguration)); @@ -43,6 +41,5 @@ export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: Runtime ...resolveAwsRegionExtensionConfiguration(extensionConfiguration), ...resolveDefaultRuntimeConfig(extensionConfiguration), ...resolveHttpHandlerRuntimeConfig(extensionConfiguration), - ...resolveHttpAuthRuntimeConfig(extensionConfiguration), }; }; diff --git a/clients/client-polly/package.json b/clients/client-polly/package.json index 0ca426dac74ae..b1ca65879fb1d 100644 --- a/clients/client-polly/package.json +++ b/clients/client-polly/package.json @@ -26,6 +26,7 @@ "@aws-sdk/middleware-host-header": "*", "@aws-sdk/middleware-logger": "*", "@aws-sdk/middleware-recursion-detection": "*", + "@aws-sdk/middleware-signing": "*", "@aws-sdk/middleware-user-agent": "*", "@aws-sdk/region-config-resolver": "*", "@aws-sdk/types": "*", @@ -54,7 +55,6 @@ "@smithy/util-defaults-mode-browser": "^2.0.24", "@smithy/util-defaults-mode-node": "^2.0.32", "@smithy/util-endpoints": "^1.0.8", - "@smithy/util-middleware": "^2.0.9", "@smithy/util-retry": "^2.0.9", "@smithy/util-stream": "^2.0.24", "@smithy/util-utf8": "^2.0.2", diff --git a/clients/client-polly/src/PollyClient.ts b/clients/client-polly/src/PollyClient.ts index fc51db10cd8e6..555abb6fde29c 100644 --- a/clients/client-polly/src/PollyClient.ts +++ b/clients/client-polly/src/PollyClient.ts @@ -7,18 +7,20 @@ import { } from "@aws-sdk/middleware-host-header"; import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection"; +import { + AwsAuthInputConfig, + AwsAuthResolvedConfig, + getAwsAuthPlugin, + resolveAwsAuthConfig, +} from "@aws-sdk/middleware-signing"; import { getUserAgentPlugin, resolveUserAgentConfig, UserAgentInputConfig, UserAgentResolvedConfig, } from "@aws-sdk/middleware-user-agent"; +import { Credentials as __Credentials } from "@aws-sdk/types"; import { RegionInputConfig, RegionResolvedConfig, resolveRegionConfig } from "@smithy/config-resolver"; -import { - DefaultIdentityProviderConfig, - getHttpAuthSchemeEndpointRuleSetPlugin, - getHttpSigningPlugin, -} from "@smithy/core"; import { getContentLengthPlugin } from "@smithy/middleware-content-length"; import { EndpointInputConfig, EndpointResolvedConfig, resolveEndpointConfig } from "@smithy/middleware-endpoint"; import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry"; @@ -30,7 +32,6 @@ import { SmithyResolvedConfiguration as __SmithyResolvedConfiguration, } from "@smithy/smithy-client"; import { - AwsCredentialIdentityProvider, BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, @@ -48,12 +49,6 @@ import { UserAgent as __UserAgent, } from "@smithy/types"; -import { - defaultPollyHttpAuthSchemeParametersProvider, - HttpAuthSchemeInputConfig, - HttpAuthSchemeResolvedConfig, - resolveHttpAuthSchemeConfig, -} from "./auth/httpAuthSchemeProvider"; import { DeleteLexiconCommandInput, DeleteLexiconCommandOutput } from "./commands/DeleteLexiconCommand"; import { DescribeVoicesCommandInput, DescribeVoicesCommandOutput } from "./commands/DescribeVoicesCommand"; import { GetLexiconCommandInput, GetLexiconCommandOutput } from "./commands/GetLexiconCommand"; @@ -197,12 +192,6 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ */ useFipsEndpoint?: boolean | __Provider; - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; - /** * The AWS region to which this client will send requests */ @@ -210,10 +199,15 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ /** * Default credentials provider; Not available in browser runtime. - * @deprecated * @internal */ - credentialDefaultProvider?: (input: any) => AwsCredentialIdentityProvider; + credentialDefaultProvider?: (input: any) => __Provider<__Credentials>; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; /** * Value for how many times a request will be made at most in case of retry. @@ -258,8 +252,8 @@ export type PollyClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerO EndpointInputConfig & RetryInputConfig & HostHeaderInputConfig & + AwsAuthInputConfig & UserAgentInputConfig & - HttpAuthSchemeInputConfig & ClientInputEndpointParameters; /** * @public @@ -278,8 +272,8 @@ export type PollyClientResolvedConfigType = __SmithyResolvedConfiguration<__Http EndpointResolvedConfig & RetryResolvedConfig & HostHeaderResolvedConfig & + AwsAuthResolvedConfig & UserAgentResolvedConfig & - HttpAuthSchemeResolvedConfig & ClientResolvedEndpointParameters; /** * @public @@ -308,17 +302,6 @@ export class PollyClient extends __Client< */ readonly config: PollyClientResolvedConfig; - private getDefaultHttpAuthSchemeParametersProvider() { - return defaultPollyHttpAuthSchemeParametersProvider; - } - - private getIdentityProviderConfigProvider() { - return async (config: PollyClientResolvedConfig) => - new DefaultIdentityProviderConfig({ - "aws.auth#sigv4": config.credentials, - }); - } - constructor(...[configuration]: __CheckOptionalClientConfig) { const _config_0 = __getRuntimeConfig(configuration || {}); const _config_1 = resolveClientEndpointParameters(_config_0); @@ -326,8 +309,8 @@ export class PollyClient extends __Client< const _config_3 = resolveEndpointConfig(_config_2); const _config_4 = resolveRetryConfig(_config_3); const _config_5 = resolveHostHeaderConfig(_config_4); - const _config_6 = resolveUserAgentConfig(_config_5); - const _config_7 = resolveHttpAuthSchemeConfig(_config_6); + const _config_6 = resolveAwsAuthConfig(_config_5); + const _config_7 = resolveUserAgentConfig(_config_6); const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []); super(_config_8); this.config = _config_8; @@ -336,14 +319,8 @@ export class PollyClient extends __Client< this.middlewareStack.use(getHostHeaderPlugin(this.config)); this.middlewareStack.use(getLoggerPlugin(this.config)); this.middlewareStack.use(getRecursionDetectionPlugin(this.config)); + this.middlewareStack.use(getAwsAuthPlugin(this.config)); this.middlewareStack.use(getUserAgentPlugin(this.config)); - this.middlewareStack.use( - getHttpAuthSchemeEndpointRuleSetPlugin(this.config, { - httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(), - identityProviderConfigProvider: this.getIdentityProviderConfigProvider(), - }) - ); - this.middlewareStack.use(getHttpSigningPlugin(this.config)); } /** diff --git a/clients/client-polly/src/auth/httpAuthExtensionConfiguration.ts b/clients/client-polly/src/auth/httpAuthExtensionConfiguration.ts deleted file mode 100644 index fb010a46c7df4..0000000000000 --- a/clients/client-polly/src/auth/httpAuthExtensionConfiguration.ts +++ /dev/null @@ -1,72 +0,0 @@ -// smithy-typescript generated code -import { AwsCredentialIdentity, AwsCredentialIdentityProvider, HttpAuthScheme } from "@smithy/types"; - -import { PollyHttpAuthSchemeProvider } from "./httpAuthSchemeProvider"; - -/** - * @internal - */ -export interface HttpAuthExtensionConfiguration { - setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void; - httpAuthSchemes(): HttpAuthScheme[]; - setHttpAuthSchemeProvider(httpAuthSchemeProvider: PollyHttpAuthSchemeProvider): void; - httpAuthSchemeProvider(): PollyHttpAuthSchemeProvider; - setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void; - credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined; -} - -/** - * @internal - */ -export type HttpAuthRuntimeConfig = Partial<{ - httpAuthSchemes: HttpAuthScheme[]; - httpAuthSchemeProvider: PollyHttpAuthSchemeProvider; - credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider; -}>; - -/** - * @internal - */ -export const getHttpAuthExtensionConfiguration = ( - runtimeConfig: HttpAuthRuntimeConfig -): HttpAuthExtensionConfiguration => { - const _httpAuthSchemes = runtimeConfig.httpAuthSchemes!; - let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider!; - let _credentials = runtimeConfig.credentials; - return { - setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void { - const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); - if (index === -1) { - _httpAuthSchemes.push(httpAuthScheme); - } else { - _httpAuthSchemes.splice(index, 1, httpAuthScheme); - } - }, - httpAuthSchemes(): HttpAuthScheme[] { - return _httpAuthSchemes; - }, - setHttpAuthSchemeProvider(httpAuthSchemeProvider: PollyHttpAuthSchemeProvider): void { - _httpAuthSchemeProvider = httpAuthSchemeProvider; - }, - httpAuthSchemeProvider(): PollyHttpAuthSchemeProvider { - return _httpAuthSchemeProvider; - }, - setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void { - _credentials = credentials; - }, - credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined { - return _credentials; - }, - }; -}; - -/** - * @internal - */ -export const resolveHttpAuthRuntimeConfig = (config: HttpAuthExtensionConfiguration): HttpAuthRuntimeConfig => { - return { - httpAuthSchemes: config.httpAuthSchemes(), - httpAuthSchemeProvider: config.httpAuthSchemeProvider(), - credentials: config.credentials(), - }; -}; diff --git a/clients/client-polly/src/auth/httpAuthSchemeProvider.ts b/clients/client-polly/src/auth/httpAuthSchemeProvider.ts deleted file mode 100644 index c1c2c9c95a878..0000000000000 --- a/clients/client-polly/src/auth/httpAuthSchemeProvider.ts +++ /dev/null @@ -1,137 +0,0 @@ -// smithy-typescript generated code -import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, -} from "@aws-sdk/core"; -import { - HandlerExecutionContext, - HttpAuthOption, - HttpAuthScheme, - HttpAuthSchemeParameters, - HttpAuthSchemeParametersProvider, - HttpAuthSchemeProvider, -} from "@smithy/types"; -import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware"; - -import { PollyClientConfig, PollyClientResolvedConfig } from "../PollyClient"; - -/** - * @internal - */ -export interface PollyHttpAuthSchemeParameters extends HttpAuthSchemeParameters { - region?: string; -} - -/** - * @internal - */ -export interface PollyHttpAuthSchemeParametersProvider - extends HttpAuthSchemeParametersProvider< - PollyClientResolvedConfig, - HandlerExecutionContext, - PollyHttpAuthSchemeParameters, - object - > {} - -/** - * @internal - */ -export const defaultPollyHttpAuthSchemeParametersProvider = async ( - config: PollyClientResolvedConfig, - context: HandlerExecutionContext, - input: object -): Promise => { - return { - operation: getSmithyContext(context).operation as string, - region: - (await normalizeProvider(config.region)()) || - (() => { - throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); - })(), - }; -}; - -function createAwsAuthSigv4HttpAuthOption(authParameters: PollyHttpAuthSchemeParameters): HttpAuthOption { - return { - schemeId: "aws.auth#sigv4", - signingProperties: { - name: "polly", - region: authParameters.region, - }, - propertiesExtractor: (config: PollyClientConfig, context) => ({ - /** - * @internal - */ - signingProperties: { - config, - context, - }, - }), - }; -} - -/** - * @internal - */ -export interface PollyHttpAuthSchemeProvider extends HttpAuthSchemeProvider {} - -/** - * @internal - */ -export const defaultPollyHttpAuthSchemeProvider: PollyHttpAuthSchemeProvider = (authParameters) => { - const options: HttpAuthOption[] = []; - switch (authParameters.operation) { - default: { - options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); - } - } - return options; -}; - -/** - * @internal - */ -export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { - /** - * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. - * @internal - */ - httpAuthSchemes?: HttpAuthScheme[]; - - /** - * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use. - * @internal - */ - httpAuthSchemeProvider?: PollyHttpAuthSchemeProvider; -} - -/** - * @internal - */ -export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedConfig { - /** - * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. - * @internal - */ - readonly httpAuthSchemes: HttpAuthScheme[]; - - /** - * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use. - * @internal - */ - readonly httpAuthSchemeProvider: PollyHttpAuthSchemeProvider; -} - -/** - * @internal - */ -export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved -): T & HttpAuthSchemeResolvedConfig => { - const config_0 = resolveAWSSDKSigV4Config(config); - return { - ...config_0, - } as T & HttpAuthSchemeResolvedConfig; -}; diff --git a/clients/client-polly/src/extensionConfiguration.ts b/clients/client-polly/src/extensionConfiguration.ts index 6e8b39c79e2f0..0ddf82fbd1cf3 100644 --- a/clients/client-polly/src/extensionConfiguration.ts +++ b/clients/client-polly/src/extensionConfiguration.ts @@ -3,13 +3,10 @@ import { AwsRegionExtensionConfiguration } from "@aws-sdk/types"; import { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http"; import { DefaultExtensionConfiguration } from "@smithy/types"; -import { HttpAuthExtensionConfiguration } from "./auth/httpAuthExtensionConfiguration"; - /** * @internal */ export interface PollyExtensionConfiguration extends HttpHandlerExtensionConfiguration, DefaultExtensionConfiguration, - AwsRegionExtensionConfiguration, - HttpAuthExtensionConfiguration {} + AwsRegionExtensionConfiguration {} diff --git a/clients/client-polly/src/runtimeConfig.shared.ts b/clients/client-polly/src/runtimeConfig.shared.ts index 466bac49b982f..8edb1f9be7ca9 100644 --- a/clients/client-polly/src/runtimeConfig.shared.ts +++ b/clients/client-polly/src/runtimeConfig.shared.ts @@ -1,13 +1,10 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; import { NoOpLogger } from "@smithy/smithy-client"; -import { IdentityProviderConfig } from "@smithy/types"; import { parseUrl } from "@smithy/url-parser"; import { fromBase64, toBase64 } from "@smithy/util-base64"; import { sdkStreamMixin } from "@smithy/util-stream"; import { fromUtf8, toUtf8 } from "@smithy/util-utf8"; -import { defaultPollyHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider"; import { defaultEndpointResolver } from "./endpoint/endpointResolver"; import { PollyClientConfig } from "./PollyClient"; @@ -22,14 +19,6 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { disableHostPrefix: config?.disableHostPrefix ?? false, endpointProvider: config?.endpointProvider ?? defaultEndpointResolver, extensions: config?.extensions ?? [], - httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultPollyHttpAuthSchemeProvider, - httpAuthSchemes: config?.httpAuthSchemes ?? [ - { - schemeId: "aws.auth#sigv4", - identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), - }, - ], logger: config?.logger ?? new NoOpLogger(), sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, serviceId: config?.serviceId ?? "Polly", diff --git a/clients/client-polly/src/runtimeExtensions.ts b/clients/client-polly/src/runtimeExtensions.ts index 91b7b018069ce..74d97b0e062e7 100644 --- a/clients/client-polly/src/runtimeExtensions.ts +++ b/clients/client-polly/src/runtimeExtensions.ts @@ -6,7 +6,6 @@ import { import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http"; import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client"; -import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration"; import { PollyExtensionConfiguration } from "./extensionConfiguration"; /** @@ -33,7 +32,6 @@ export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: Runtime ...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)), ...asPartial(getDefaultExtensionConfiguration(runtimeConfig)), ...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)), - ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)), }; extensions.forEach((extension) => extension.configure(extensionConfiguration)); @@ -43,6 +41,5 @@ export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: Runtime ...resolveAwsRegionExtensionConfiguration(extensionConfiguration), ...resolveDefaultRuntimeConfig(extensionConfiguration), ...resolveHttpHandlerRuntimeConfig(extensionConfiguration), - ...resolveHttpAuthRuntimeConfig(extensionConfiguration), }; }; diff --git a/clients/client-rds/package.json b/clients/client-rds/package.json index d88fd8559b5fe..dc3b2b0cfe0db 100644 --- a/clients/client-rds/package.json +++ b/clients/client-rds/package.json @@ -27,6 +27,7 @@ "@aws-sdk/middleware-logger": "*", "@aws-sdk/middleware-recursion-detection": "*", "@aws-sdk/middleware-sdk-rds": "*", + "@aws-sdk/middleware-signing": "*", "@aws-sdk/middleware-user-agent": "*", "@aws-sdk/region-config-resolver": "*", "@aws-sdk/types": "*", @@ -55,7 +56,6 @@ "@smithy/util-defaults-mode-browser": "^2.0.24", "@smithy/util-defaults-mode-node": "^2.0.32", "@smithy/util-endpoints": "^1.0.8", - "@smithy/util-middleware": "^2.0.9", "@smithy/util-retry": "^2.0.9", "@smithy/util-utf8": "^2.0.2", "@smithy/util-waiter": "^2.0.16", diff --git a/clients/client-rds/src/RDSClient.ts b/clients/client-rds/src/RDSClient.ts index c3d2a34e97550..3a7636399ce5d 100644 --- a/clients/client-rds/src/RDSClient.ts +++ b/clients/client-rds/src/RDSClient.ts @@ -7,18 +7,20 @@ import { } from "@aws-sdk/middleware-host-header"; import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection"; +import { + AwsAuthInputConfig, + AwsAuthResolvedConfig, + getAwsAuthPlugin, + resolveAwsAuthConfig, +} from "@aws-sdk/middleware-signing"; import { getUserAgentPlugin, resolveUserAgentConfig, UserAgentInputConfig, UserAgentResolvedConfig, } from "@aws-sdk/middleware-user-agent"; +import { Credentials as __Credentials } from "@aws-sdk/types"; import { RegionInputConfig, RegionResolvedConfig, resolveRegionConfig } from "@smithy/config-resolver"; -import { - DefaultIdentityProviderConfig, - getHttpAuthSchemeEndpointRuleSetPlugin, - getHttpSigningPlugin, -} from "@smithy/core"; import { getContentLengthPlugin } from "@smithy/middleware-content-length"; import { EndpointInputConfig, EndpointResolvedConfig, resolveEndpointConfig } from "@smithy/middleware-endpoint"; import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry"; @@ -30,7 +32,6 @@ import { SmithyResolvedConfiguration as __SmithyResolvedConfiguration, } from "@smithy/smithy-client"; import { - AwsCredentialIdentityProvider, BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, @@ -47,12 +48,6 @@ import { UserAgent as __UserAgent, } from "@smithy/types"; -import { - defaultRDSHttpAuthSchemeParametersProvider, - HttpAuthSchemeInputConfig, - HttpAuthSchemeResolvedConfig, - resolveHttpAuthSchemeConfig, -} from "./auth/httpAuthSchemeProvider"; import { AddRoleToDBClusterCommandInput, AddRoleToDBClusterCommandOutput } from "./commands/AddRoleToDBClusterCommand"; import { AddRoleToDBInstanceCommandInput, @@ -979,12 +974,6 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ */ useFipsEndpoint?: boolean | __Provider; - /** - * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header - * @internal - */ - defaultUserAgentProvider?: Provider<__UserAgent>; - /** * The AWS region to which this client will send requests */ @@ -992,10 +981,15 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ /** * Default credentials provider; Not available in browser runtime. - * @deprecated * @internal */ - credentialDefaultProvider?: (input: any) => AwsCredentialIdentityProvider; + credentialDefaultProvider?: (input: any) => __Provider<__Credentials>; + + /** + * The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header + * @internal + */ + defaultUserAgentProvider?: Provider<__UserAgent>; /** * Value for how many times a request will be made at most in case of retry. @@ -1034,8 +1028,8 @@ export type RDSClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOpt EndpointInputConfig & RetryInputConfig & HostHeaderInputConfig & + AwsAuthInputConfig & UserAgentInputConfig & - HttpAuthSchemeInputConfig & ClientInputEndpointParameters; /** * @public @@ -1054,8 +1048,8 @@ export type RDSClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHa EndpointResolvedConfig & RetryResolvedConfig & HostHeaderResolvedConfig & + AwsAuthResolvedConfig & UserAgentResolvedConfig & - HttpAuthSchemeResolvedConfig & ClientResolvedEndpointParameters; /** * @public @@ -1131,17 +1125,6 @@ export class RDSClient extends __Client< */ readonly config: RDSClientResolvedConfig; - private getDefaultHttpAuthSchemeParametersProvider() { - return defaultRDSHttpAuthSchemeParametersProvider; - } - - private getIdentityProviderConfigProvider() { - return async (config: RDSClientResolvedConfig) => - new DefaultIdentityProviderConfig({ - "aws.auth#sigv4": config.credentials, - }); - } - constructor(...[configuration]: __CheckOptionalClientConfig) { const _config_0 = __getRuntimeConfig(configuration || {}); const _config_1 = resolveClientEndpointParameters(_config_0); @@ -1149,8 +1132,8 @@ export class RDSClient extends __Client< const _config_3 = resolveEndpointConfig(_config_2); const _config_4 = resolveRetryConfig(_config_3); const _config_5 = resolveHostHeaderConfig(_config_4); - const _config_6 = resolveUserAgentConfig(_config_5); - const _config_7 = resolveHttpAuthSchemeConfig(_config_6); + const _config_6 = resolveAwsAuthConfig(_config_5); + const _config_7 = resolveUserAgentConfig(_config_6); const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []); super(_config_8); this.config = _config_8; @@ -1159,14 +1142,8 @@ export class RDSClient extends __Client< this.middlewareStack.use(getHostHeaderPlugin(this.config)); this.middlewareStack.use(getLoggerPlugin(this.config)); this.middlewareStack.use(getRecursionDetectionPlugin(this.config)); + this.middlewareStack.use(getAwsAuthPlugin(this.config)); this.middlewareStack.use(getUserAgentPlugin(this.config)); - this.middlewareStack.use( - getHttpAuthSchemeEndpointRuleSetPlugin(this.config, { - httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(), - identityProviderConfigProvider: this.getIdentityProviderConfigProvider(), - }) - ); - this.middlewareStack.use(getHttpSigningPlugin(this.config)); } /** diff --git a/clients/client-rds/src/auth/httpAuthExtensionConfiguration.ts b/clients/client-rds/src/auth/httpAuthExtensionConfiguration.ts deleted file mode 100644 index b94dd61a7e1e1..0000000000000 --- a/clients/client-rds/src/auth/httpAuthExtensionConfiguration.ts +++ /dev/null @@ -1,72 +0,0 @@ -// smithy-typescript generated code -import { AwsCredentialIdentity, AwsCredentialIdentityProvider, HttpAuthScheme } from "@smithy/types"; - -import { RDSHttpAuthSchemeProvider } from "./httpAuthSchemeProvider"; - -/** - * @internal - */ -export interface HttpAuthExtensionConfiguration { - setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void; - httpAuthSchemes(): HttpAuthScheme[]; - setHttpAuthSchemeProvider(httpAuthSchemeProvider: RDSHttpAuthSchemeProvider): void; - httpAuthSchemeProvider(): RDSHttpAuthSchemeProvider; - setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void; - credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined; -} - -/** - * @internal - */ -export type HttpAuthRuntimeConfig = Partial<{ - httpAuthSchemes: HttpAuthScheme[]; - httpAuthSchemeProvider: RDSHttpAuthSchemeProvider; - credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider; -}>; - -/** - * @internal - */ -export const getHttpAuthExtensionConfiguration = ( - runtimeConfig: HttpAuthRuntimeConfig -): HttpAuthExtensionConfiguration => { - const _httpAuthSchemes = runtimeConfig.httpAuthSchemes!; - let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider!; - let _credentials = runtimeConfig.credentials; - return { - setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void { - const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); - if (index === -1) { - _httpAuthSchemes.push(httpAuthScheme); - } else { - _httpAuthSchemes.splice(index, 1, httpAuthScheme); - } - }, - httpAuthSchemes(): HttpAuthScheme[] { - return _httpAuthSchemes; - }, - setHttpAuthSchemeProvider(httpAuthSchemeProvider: RDSHttpAuthSchemeProvider): void { - _httpAuthSchemeProvider = httpAuthSchemeProvider; - }, - httpAuthSchemeProvider(): RDSHttpAuthSchemeProvider { - return _httpAuthSchemeProvider; - }, - setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void { - _credentials = credentials; - }, - credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined { - return _credentials; - }, - }; -}; - -/** - * @internal - */ -export const resolveHttpAuthRuntimeConfig = (config: HttpAuthExtensionConfiguration): HttpAuthRuntimeConfig => { - return { - httpAuthSchemes: config.httpAuthSchemes(), - httpAuthSchemeProvider: config.httpAuthSchemeProvider(), - credentials: config.credentials(), - }; -}; diff --git a/clients/client-rds/src/auth/httpAuthSchemeProvider.ts b/clients/client-rds/src/auth/httpAuthSchemeProvider.ts deleted file mode 100644 index c4f625ac5d037..0000000000000 --- a/clients/client-rds/src/auth/httpAuthSchemeProvider.ts +++ /dev/null @@ -1,137 +0,0 @@ -// smithy-typescript generated code -import { - AWSSDKSigV4AuthInputConfig, - AWSSDKSigV4AuthResolvedConfig, - AWSSDKSigV4PreviouslyResolved, - resolveAWSSDKSigV4Config, -} from "@aws-sdk/core"; -import { - HandlerExecutionContext, - HttpAuthOption, - HttpAuthScheme, - HttpAuthSchemeParameters, - HttpAuthSchemeParametersProvider, - HttpAuthSchemeProvider, -} from "@smithy/types"; -import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware"; - -import { RDSClientConfig, RDSClientResolvedConfig } from "../RDSClient"; - -/** - * @internal - */ -export interface RDSHttpAuthSchemeParameters extends HttpAuthSchemeParameters { - region?: string; -} - -/** - * @internal - */ -export interface RDSHttpAuthSchemeParametersProvider - extends HttpAuthSchemeParametersProvider< - RDSClientResolvedConfig, - HandlerExecutionContext, - RDSHttpAuthSchemeParameters, - object - > {} - -/** - * @internal - */ -export const defaultRDSHttpAuthSchemeParametersProvider = async ( - config: RDSClientResolvedConfig, - context: HandlerExecutionContext, - input: object -): Promise => { - return { - operation: getSmithyContext(context).operation as string, - region: - (await normalizeProvider(config.region)()) || - (() => { - throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); - })(), - }; -}; - -function createAwsAuthSigv4HttpAuthOption(authParameters: RDSHttpAuthSchemeParameters): HttpAuthOption { - return { - schemeId: "aws.auth#sigv4", - signingProperties: { - name: "rds", - region: authParameters.region, - }, - propertiesExtractor: (config: RDSClientConfig, context) => ({ - /** - * @internal - */ - signingProperties: { - config, - context, - }, - }), - }; -} - -/** - * @internal - */ -export interface RDSHttpAuthSchemeProvider extends HttpAuthSchemeProvider {} - -/** - * @internal - */ -export const defaultRDSHttpAuthSchemeProvider: RDSHttpAuthSchemeProvider = (authParameters) => { - const options: HttpAuthOption[] = []; - switch (authParameters.operation) { - default: { - options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); - } - } - return options; -}; - -/** - * @internal - */ -export interface HttpAuthSchemeInputConfig extends AWSSDKSigV4AuthInputConfig { - /** - * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. - * @internal - */ - httpAuthSchemes?: HttpAuthScheme[]; - - /** - * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use. - * @internal - */ - httpAuthSchemeProvider?: RDSHttpAuthSchemeProvider; -} - -/** - * @internal - */ -export interface HttpAuthSchemeResolvedConfig extends AWSSDKSigV4AuthResolvedConfig { - /** - * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. - * @internal - */ - readonly httpAuthSchemes: HttpAuthScheme[]; - - /** - * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use. - * @internal - */ - readonly httpAuthSchemeProvider: RDSHttpAuthSchemeProvider; -} - -/** - * @internal - */ -export const resolveHttpAuthSchemeConfig = ( - config: T & HttpAuthSchemeInputConfig & AWSSDKSigV4PreviouslyResolved -): T & HttpAuthSchemeResolvedConfig => { - const config_0 = resolveAWSSDKSigV4Config(config); - return { - ...config_0, - } as T & HttpAuthSchemeResolvedConfig; -}; diff --git a/clients/client-rds/src/extensionConfiguration.ts b/clients/client-rds/src/extensionConfiguration.ts index 2987ca4d30045..2e5c01b0ca2c2 100644 --- a/clients/client-rds/src/extensionConfiguration.ts +++ b/clients/client-rds/src/extensionConfiguration.ts @@ -3,13 +3,10 @@ import { AwsRegionExtensionConfiguration } from "@aws-sdk/types"; import { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http"; import { DefaultExtensionConfiguration } from "@smithy/types"; -import { HttpAuthExtensionConfiguration } from "./auth/httpAuthExtensionConfiguration"; - /** * @internal */ export interface RDSExtensionConfiguration extends HttpHandlerExtensionConfiguration, DefaultExtensionConfiguration, - AwsRegionExtensionConfiguration, - HttpAuthExtensionConfiguration {} + AwsRegionExtensionConfiguration {} diff --git a/clients/client-rds/src/runtimeConfig.shared.ts b/clients/client-rds/src/runtimeConfig.shared.ts index 774fccfe63d1a..ceaf19b86846b 100644 --- a/clients/client-rds/src/runtimeConfig.shared.ts +++ b/clients/client-rds/src/runtimeConfig.shared.ts @@ -1,12 +1,9 @@ // smithy-typescript generated code -import { AWSSDKSigV4Signer } from "@aws-sdk/core"; import { NoOpLogger } from "@smithy/smithy-client"; -import { IdentityProviderConfig } from "@smithy/types"; import { parseUrl } from "@smithy/url-parser"; import { fromBase64, toBase64 } from "@smithy/util-base64"; import { fromUtf8, toUtf8 } from "@smithy/util-utf8"; -import { defaultRDSHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider"; import { defaultEndpointResolver } from "./endpoint/endpointResolver"; import { RDSClientConfig } from "./RDSClient"; @@ -21,14 +18,6 @@ export const getRuntimeConfig = (config: RDSClientConfig) => { disableHostPrefix: config?.disableHostPrefix ?? false, endpointProvider: config?.endpointProvider ?? defaultEndpointResolver, extensions: config?.extensions ?? [], - httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultRDSHttpAuthSchemeProvider, - httpAuthSchemes: config?.httpAuthSchemes ?? [ - { - schemeId: "aws.auth#sigv4", - identityProvider: (ipc: IdentityProviderConfig) => ipc.getIdentityProvider("aws.auth#sigv4"), - signer: new AWSSDKSigV4Signer(), - }, - ], logger: config?.logger ?? new NoOpLogger(), serviceId: config?.serviceId ?? "RDS", urlParser: config?.urlParser ?? parseUrl, diff --git a/clients/client-rds/src/runtimeExtensions.ts b/clients/client-rds/src/runtimeExtensions.ts index 39e30f0fe2957..c566a4db08b46 100644 --- a/clients/client-rds/src/runtimeExtensions.ts +++ b/clients/client-rds/src/runtimeExtensions.ts @@ -6,7 +6,6 @@ import { import { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig } from "@smithy/protocol-http"; import { getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig } from "@smithy/smithy-client"; -import { getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig } from "./auth/httpAuthExtensionConfiguration"; import { RDSExtensionConfiguration } from "./extensionConfiguration"; /** @@ -33,7 +32,6 @@ export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: Runtime ...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)), ...asPartial(getDefaultExtensionConfiguration(runtimeConfig)), ...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)), - ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)), }; extensions.forEach((extension) => extension.configure(extensionConfiguration)); @@ -43,6 +41,5 @@ export const resolveRuntimeExtensions = (runtimeConfig: any, extensions: Runtime ...resolveAwsRegionExtensionConfiguration(extensionConfiguration), ...resolveDefaultRuntimeConfig(extensionConfiguration), ...resolveHttpHandlerRuntimeConfig(extensionConfiguration), - ...resolveHttpAuthRuntimeConfig(extensionConfiguration), }; };