Skip to content

Commit 4004ff6

Browse files
author
Steven Yuan
authored
feat(experimentalIdentityAndAuth): release phase for services without customizations (#5787)
* chore(codegen): update smithy-typescript commit * chore(codegen): generate clients * chore(codegen): update yarn.lock * feat(experimentalIdentityAndAuth): release all services without customizations * chore(codegen): generate clients
1 parent f0ac43a commit 4004ff6

File tree

2,645 files changed

+97807
-8500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,645 files changed

+97807
-8500
lines changed

clients/client-accessanalyzer/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@
2626
"@aws-sdk/middleware-host-header": "*",
2727
"@aws-sdk/middleware-logger": "*",
2828
"@aws-sdk/middleware-recursion-detection": "*",
29-
"@aws-sdk/middleware-signing": "*",
3029
"@aws-sdk/middleware-user-agent": "*",
3130
"@aws-sdk/region-config-resolver": "*",
3231
"@aws-sdk/types": "*",
3332
"@aws-sdk/util-endpoints": "*",
3433
"@aws-sdk/util-user-agent-browser": "*",
3534
"@aws-sdk/util-user-agent-node": "*",
3635
"@smithy/config-resolver": "^2.1.1",
37-
"@smithy/core": "^1.3.1",
36+
"@smithy/core": "^1.3.2",
3837
"@smithy/fetch-http-handler": "^2.4.1",
3938
"@smithy/hash-node": "^2.1.1",
4039
"@smithy/invalid-dependency": "^2.1.1",
@@ -53,8 +52,9 @@
5352
"@smithy/util-body-length-browser": "^2.1.1",
5453
"@smithy/util-body-length-node": "^2.2.1",
5554
"@smithy/util-defaults-mode-browser": "^2.1.1",
56-
"@smithy/util-defaults-mode-node": "^2.1.1",
55+
"@smithy/util-defaults-mode-node": "^2.2.0",
5756
"@smithy/util-endpoints": "^1.1.1",
57+
"@smithy/util-middleware": "^2.1.1",
5858
"@smithy/util-retry": "^2.1.1",
5959
"@smithy/util-utf8": "^2.1.1",
6060
"tslib": "^2.5.0",

clients/client-accessanalyzer/src/AccessAnalyzerClient.ts

+40-19
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@ import {
77
} from "@aws-sdk/middleware-host-header";
88
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
99
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
10-
import {
11-
AwsAuthInputConfig,
12-
AwsAuthResolvedConfig,
13-
getAwsAuthPlugin,
14-
resolveAwsAuthConfig,
15-
} from "@aws-sdk/middleware-signing";
1610
import {
1711
getUserAgentPlugin,
1812
resolveUserAgentConfig,
1913
UserAgentInputConfig,
2014
UserAgentResolvedConfig,
2115
} from "@aws-sdk/middleware-user-agent";
22-
import { Credentials as __Credentials } from "@aws-sdk/types";
2316
import { RegionInputConfig, RegionResolvedConfig, resolveRegionConfig } from "@smithy/config-resolver";
17+
import {
18+
DefaultIdentityProviderConfig,
19+
getHttpAuthSchemeEndpointRuleSetPlugin,
20+
getHttpSigningPlugin,
21+
} from "@smithy/core";
2422
import { getContentLengthPlugin } from "@smithy/middleware-content-length";
2523
import { EndpointInputConfig, EndpointResolvedConfig, resolveEndpointConfig } from "@smithy/middleware-endpoint";
2624
import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry";
@@ -32,6 +30,7 @@ import {
3230
SmithyResolvedConfiguration as __SmithyResolvedConfiguration,
3331
} from "@smithy/smithy-client";
3432
import {
33+
AwsCredentialIdentityProvider,
3534
BodyLengthCalculator as __BodyLengthCalculator,
3635
CheckOptionalClientConfig as __CheckOptionalClientConfig,
3736
ChecksumConstructor as __ChecksumConstructor,
@@ -48,6 +47,12 @@ import {
4847
UserAgent as __UserAgent,
4948
} from "@smithy/types";
5049

50+
import {
51+
defaultAccessAnalyzerHttpAuthSchemeParametersProvider,
52+
HttpAuthSchemeInputConfig,
53+
HttpAuthSchemeResolvedConfig,
54+
resolveHttpAuthSchemeConfig,
55+
} from "./auth/httpAuthSchemeProvider";
5156
import { ApplyArchiveRuleCommandInput, ApplyArchiveRuleCommandOutput } from "./commands/ApplyArchiveRuleCommand";
5257
import {
5358
CancelPolicyGenerationCommandInput,
@@ -279,21 +284,22 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
279284
useFipsEndpoint?: boolean | __Provider<boolean>;
280285

281286
/**
282-
* The AWS region to which this client will send requests
287+
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
288+
* @internal
283289
*/
284-
region?: string | __Provider<string>;
290+
defaultUserAgentProvider?: Provider<__UserAgent>;
285291

286292
/**
287-
* Default credentials provider; Not available in browser runtime.
288-
* @internal
293+
* The AWS region to which this client will send requests
289294
*/
290-
credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;
295+
region?: string | __Provider<string>;
291296

292297
/**
293-
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
298+
* Default credentials provider; Not available in browser runtime.
299+
* @deprecated
294300
* @internal
295301
*/
296-
defaultUserAgentProvider?: Provider<__UserAgent>;
302+
credentialDefaultProvider?: (input: any) => AwsCredentialIdentityProvider;
297303

298304
/**
299305
* Value for how many times a request will be made at most in case of retry.
@@ -332,8 +338,8 @@ export type AccessAnalyzerClientConfigType = Partial<__SmithyConfiguration<__Htt
332338
EndpointInputConfig<EndpointParameters> &
333339
RetryInputConfig &
334340
HostHeaderInputConfig &
335-
AwsAuthInputConfig &
336341
UserAgentInputConfig &
342+
HttpAuthSchemeInputConfig &
337343
ClientInputEndpointParameters;
338344
/**
339345
* @public
@@ -352,8 +358,8 @@ export type AccessAnalyzerClientResolvedConfigType = __SmithyResolvedConfigurati
352358
EndpointResolvedConfig<EndpointParameters> &
353359
RetryResolvedConfig &
354360
HostHeaderResolvedConfig &
355-
AwsAuthResolvedConfig &
356361
UserAgentResolvedConfig &
362+
HttpAuthSchemeResolvedConfig &
357363
ClientResolvedEndpointParameters;
358364
/**
359365
* @public
@@ -407,8 +413,8 @@ export class AccessAnalyzerClient extends __Client<
407413
const _config_3 = resolveEndpointConfig(_config_2);
408414
const _config_4 = resolveRetryConfig(_config_3);
409415
const _config_5 = resolveHostHeaderConfig(_config_4);
410-
const _config_6 = resolveAwsAuthConfig(_config_5);
411-
const _config_7 = resolveUserAgentConfig(_config_6);
416+
const _config_6 = resolveUserAgentConfig(_config_5);
417+
const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
412418
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
413419
super(_config_8);
414420
this.config = _config_8;
@@ -417,8 +423,14 @@ export class AccessAnalyzerClient extends __Client<
417423
this.middlewareStack.use(getHostHeaderPlugin(this.config));
418424
this.middlewareStack.use(getLoggerPlugin(this.config));
419425
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
420-
this.middlewareStack.use(getAwsAuthPlugin(this.config));
421426
this.middlewareStack.use(getUserAgentPlugin(this.config));
427+
this.middlewareStack.use(
428+
getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
429+
httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(),
430+
identityProviderConfigProvider: this.getIdentityProviderConfigProvider(),
431+
})
432+
);
433+
this.middlewareStack.use(getHttpSigningPlugin(this.config));
422434
}
423435

424436
/**
@@ -429,4 +441,13 @@ export class AccessAnalyzerClient extends __Client<
429441
destroy(): void {
430442
super.destroy();
431443
}
444+
private getDefaultHttpAuthSchemeParametersProvider() {
445+
return defaultAccessAnalyzerHttpAuthSchemeParametersProvider;
446+
}
447+
private getIdentityProviderConfigProvider() {
448+
return async (config: AccessAnalyzerClientResolvedConfig) =>
449+
new DefaultIdentityProviderConfig({
450+
"aws.auth#sigv4": config.credentials,
451+
});
452+
}
432453
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// smithy-typescript generated code
2+
import { AwsCredentialIdentity, AwsCredentialIdentityProvider, HttpAuthScheme } from "@smithy/types";
3+
4+
import { AccessAnalyzerHttpAuthSchemeProvider } from "./httpAuthSchemeProvider";
5+
6+
/**
7+
* @internal
8+
*/
9+
export interface HttpAuthExtensionConfiguration {
10+
setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void;
11+
httpAuthSchemes(): HttpAuthScheme[];
12+
setHttpAuthSchemeProvider(httpAuthSchemeProvider: AccessAnalyzerHttpAuthSchemeProvider): void;
13+
httpAuthSchemeProvider(): AccessAnalyzerHttpAuthSchemeProvider;
14+
setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void;
15+
credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined;
16+
}
17+
18+
/**
19+
* @internal
20+
*/
21+
export type HttpAuthRuntimeConfig = Partial<{
22+
httpAuthSchemes: HttpAuthScheme[];
23+
httpAuthSchemeProvider: AccessAnalyzerHttpAuthSchemeProvider;
24+
credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider;
25+
}>;
26+
27+
/**
28+
* @internal
29+
*/
30+
export const getHttpAuthExtensionConfiguration = (
31+
runtimeConfig: HttpAuthRuntimeConfig
32+
): HttpAuthExtensionConfiguration => {
33+
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes!;
34+
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider!;
35+
let _credentials = runtimeConfig.credentials;
36+
return {
37+
setHttpAuthScheme(httpAuthScheme: HttpAuthScheme): void {
38+
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
39+
if (index === -1) {
40+
_httpAuthSchemes.push(httpAuthScheme);
41+
} else {
42+
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
43+
}
44+
},
45+
httpAuthSchemes(): HttpAuthScheme[] {
46+
return _httpAuthSchemes;
47+
},
48+
setHttpAuthSchemeProvider(httpAuthSchemeProvider: AccessAnalyzerHttpAuthSchemeProvider): void {
49+
_httpAuthSchemeProvider = httpAuthSchemeProvider;
50+
},
51+
httpAuthSchemeProvider(): AccessAnalyzerHttpAuthSchemeProvider {
52+
return _httpAuthSchemeProvider;
53+
},
54+
setCredentials(credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider): void {
55+
_credentials = credentials;
56+
},
57+
credentials(): AwsCredentialIdentity | AwsCredentialIdentityProvider | undefined {
58+
return _credentials;
59+
},
60+
};
61+
};
62+
63+
/**
64+
* @internal
65+
*/
66+
export const resolveHttpAuthRuntimeConfig = (config: HttpAuthExtensionConfiguration): HttpAuthRuntimeConfig => {
67+
return {
68+
httpAuthSchemes: config.httpAuthSchemes(),
69+
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
70+
credentials: config.credentials(),
71+
};
72+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
// smithy-typescript generated code
2+
import {
3+
AwsSdkSigV4AuthInputConfig,
4+
AwsSdkSigV4AuthResolvedConfig,
5+
AwsSdkSigV4PreviouslyResolved,
6+
resolveAwsSdkSigV4Config,
7+
} from "@aws-sdk/core";
8+
import {
9+
HandlerExecutionContext,
10+
HttpAuthOption,
11+
HttpAuthScheme,
12+
HttpAuthSchemeParameters,
13+
HttpAuthSchemeParametersProvider,
14+
HttpAuthSchemeProvider,
15+
} from "@smithy/types";
16+
import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
17+
18+
import { AccessAnalyzerClientConfig, AccessAnalyzerClientResolvedConfig } from "../AccessAnalyzerClient";
19+
20+
/**
21+
* @internal
22+
*/
23+
export interface AccessAnalyzerHttpAuthSchemeParameters extends HttpAuthSchemeParameters {
24+
region?: string;
25+
}
26+
27+
/**
28+
* @internal
29+
*/
30+
export interface AccessAnalyzerHttpAuthSchemeParametersProvider
31+
extends HttpAuthSchemeParametersProvider<
32+
AccessAnalyzerClientResolvedConfig,
33+
HandlerExecutionContext,
34+
AccessAnalyzerHttpAuthSchemeParameters,
35+
object
36+
> {}
37+
38+
/**
39+
* @internal
40+
*/
41+
export const defaultAccessAnalyzerHttpAuthSchemeParametersProvider = async (
42+
config: AccessAnalyzerClientResolvedConfig,
43+
context: HandlerExecutionContext,
44+
input: object
45+
): Promise<AccessAnalyzerHttpAuthSchemeParameters> => {
46+
return {
47+
operation: getSmithyContext(context).operation as string,
48+
region:
49+
(await normalizeProvider(config.region)()) ||
50+
(() => {
51+
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
52+
})(),
53+
};
54+
};
55+
56+
function createAwsAuthSigv4HttpAuthOption(authParameters: AccessAnalyzerHttpAuthSchemeParameters): HttpAuthOption {
57+
return {
58+
schemeId: "aws.auth#sigv4",
59+
signingProperties: {
60+
name: "access-analyzer",
61+
region: authParameters.region,
62+
},
63+
propertiesExtractor: (config: AccessAnalyzerClientConfig, context) => ({
64+
/**
65+
* @internal
66+
*/
67+
signingProperties: {
68+
config,
69+
context,
70+
},
71+
}),
72+
};
73+
}
74+
75+
/**
76+
* @internal
77+
*/
78+
export interface AccessAnalyzerHttpAuthSchemeProvider
79+
extends HttpAuthSchemeProvider<AccessAnalyzerHttpAuthSchemeParameters> {}
80+
81+
/**
82+
* @internal
83+
*/
84+
export const defaultAccessAnalyzerHttpAuthSchemeProvider: AccessAnalyzerHttpAuthSchemeProvider = (authParameters) => {
85+
const options: HttpAuthOption[] = [];
86+
switch (authParameters.operation) {
87+
default: {
88+
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
89+
}
90+
}
91+
return options;
92+
};
93+
94+
/**
95+
* @internal
96+
*/
97+
export interface HttpAuthSchemeInputConfig extends AwsSdkSigV4AuthInputConfig {
98+
/**
99+
* experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme.
100+
* @internal
101+
*/
102+
httpAuthSchemes?: HttpAuthScheme[];
103+
104+
/**
105+
* experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use.
106+
* @internal
107+
*/
108+
httpAuthSchemeProvider?: AccessAnalyzerHttpAuthSchemeProvider;
109+
}
110+
111+
/**
112+
* @internal
113+
*/
114+
export interface HttpAuthSchemeResolvedConfig extends AwsSdkSigV4AuthResolvedConfig {
115+
/**
116+
* experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme.
117+
* @internal
118+
*/
119+
readonly httpAuthSchemes: HttpAuthScheme[];
120+
121+
/**
122+
* experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use.
123+
* @internal
124+
*/
125+
readonly httpAuthSchemeProvider: AccessAnalyzerHttpAuthSchemeProvider;
126+
}
127+
128+
/**
129+
* @internal
130+
*/
131+
export const resolveHttpAuthSchemeConfig = <T>(
132+
config: T & HttpAuthSchemeInputConfig & AwsSdkSigV4PreviouslyResolved
133+
): T & HttpAuthSchemeResolvedConfig => {
134+
const config_0 = resolveAwsSdkSigV4Config(config);
135+
return {
136+
...config_0,
137+
} as T & HttpAuthSchemeResolvedConfig;
138+
};

clients/client-accessanalyzer/src/extensionConfiguration.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import { AwsRegionExtensionConfiguration } from "@aws-sdk/types";
33
import { HttpHandlerExtensionConfiguration } from "@smithy/protocol-http";
44
import { DefaultExtensionConfiguration } from "@smithy/types";
55

6+
import { HttpAuthExtensionConfiguration } from "./auth/httpAuthExtensionConfiguration";
7+
68
/**
79
* @internal
810
*/
911
export interface AccessAnalyzerExtensionConfiguration
1012
extends HttpHandlerExtensionConfiguration,
1113
DefaultExtensionConfiguration,
12-
AwsRegionExtensionConfiguration {}
14+
AwsRegionExtensionConfiguration,
15+
HttpAuthExtensionConfiguration {}

0 commit comments

Comments
 (0)