Skip to content

Commit

Permalink
feat(client-*): update user-agent population and injecting
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP committed Dec 18, 2020
1 parent 5c7ce36 commit 01bca36
Show file tree
Hide file tree
Showing 1,008 changed files with 5,793 additions and 4,282 deletions.
27 changes: 15 additions & 12 deletions clients/client-accessanalyzer/AccessAnalyzerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
SmithyResolvedConfiguration as __SmithyResolvedConfiguration,
} from "@aws-sdk/smithy-client";
import {
Provider,
RegionInfoProvider,
Credentials as __Credentials,
Decoder as __Decoder,
Expand All @@ -72,6 +73,7 @@ import {
Provider as __Provider,
StreamCollector as __StreamCollector,
UrlParser as __UrlParser,
UserAgent as __UserAgent,
} from "@aws-sdk/types";

export type ServiceInputTypes =
Expand Down Expand Up @@ -161,11 +163,6 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
*/
utf8Encoder?: __Encoder;

/**
* The string that will be used to populate default value in 'User-Agent' header
*/
defaultUserAgent?: string;

/**
* The runtime environment
*/
Expand Down Expand Up @@ -207,6 +204,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
* Fetch related hostname, signing name or signing region with given region.
*/
regionInfoProvider?: RegionInfoProvider;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
*/
defaultUserAgentProvider?: Provider<__UserAgent>;
}

export type AccessAnalyzerClientConfig = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
Expand All @@ -215,17 +218,17 @@ export type AccessAnalyzerClientConfig = Partial<__SmithyConfiguration<__HttpHan
EndpointsInputConfig &
AwsAuthInputConfig &
RetryInputConfig &
UserAgentInputConfig &
HostHeaderInputConfig;
HostHeaderInputConfig &
UserAgentInputConfig;

export type AccessAnalyzerClientResolvedConfig = __SmithyResolvedConfiguration<__HttpHandlerOptions> &
Required<ClientDefaults> &
RegionResolvedConfig &
EndpointsResolvedConfig &
AwsAuthResolvedConfig &
RetryResolvedConfig &
UserAgentResolvedConfig &
HostHeaderResolvedConfig;
HostHeaderResolvedConfig &
UserAgentResolvedConfig;

/**
* <p>AWS IAM Access Analyzer helps identify potential resource-access risks by enabling you to identify
Expand Down Expand Up @@ -253,16 +256,16 @@ export class AccessAnalyzerClient extends __Client<
let _config_2 = resolveEndpointsConfig(_config_1);
let _config_3 = resolveAwsAuthConfig(_config_2);
let _config_4 = resolveRetryConfig(_config_3);
let _config_5 = resolveUserAgentConfig(_config_4);
let _config_6 = resolveHostHeaderConfig(_config_5);
let _config_5 = resolveHostHeaderConfig(_config_4);
let _config_6 = resolveUserAgentConfig(_config_5);
super(_config_6);
this.config = _config_6;
this.middlewareStack.use(getAwsAuthPlugin(this.config));
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getHostHeaderPlugin(this.config));
this.middlewareStack.use(getLoggerPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
}

destroy(): void {
Expand Down
5 changes: 4 additions & 1 deletion clients/client-accessanalyzer/runtimeConfig.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
base64Encoder: toBase64,
bodyLengthChecker: calculateBodyLength,
credentialDefaultProvider: invalidAsyncFunction("Credentialis missing") as any,
defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),
defaultUserAgentProvider: defaultUserAgent({
serviceId: ClientSharedValues.serviceId,
clientVersion: packageInfo.version,
}),
maxAttempts: DEFAULT_MAX_ATTEMPTS,
region: invalidAsyncFunction("Region is missing") as any,
requestHandler: new FetchHttpHandler(),
Expand Down
3 changes: 0 additions & 3 deletions clients/client-accessanalyzer/runtimeConfig.native.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import packageInfo from "./package.json";

import { Sha256 } from "@aws-crypto/sha256-js";
import { parseUrl } from "@aws-sdk/url-parser-node";
import { ClientDefaults } from "./AccessAnalyzerClient";
Expand All @@ -11,7 +9,6 @@ import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"
export const ClientDefaultValues: Required<ClientDefaults> = {
...BrowserDefaults,
runtime: "react-native",
defaultUserAgent: `aws-sdk-js-v3-react-native-${packageInfo.name}/${packageInfo.version}`,
sha256: Sha256,
urlParser: parseUrl,
};
5 changes: 4 additions & 1 deletion clients/client-accessanalyzer/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
base64Encoder: toBase64,
bodyLengthChecker: calculateBodyLength,
credentialDefaultProvider,
defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),
defaultUserAgentProvider: defaultUserAgent({
serviceId: ClientSharedValues.serviceId,
clientVersion: packageInfo.version,
}),
maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
requestHandler: new NodeHttpHandler(),
Expand Down
27 changes: 15 additions & 12 deletions clients/client-acm-pca/ACMPCAClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ import {
SmithyResolvedConfiguration as __SmithyResolvedConfiguration,
} from "@aws-sdk/smithy-client";
import {
Provider,
RegionInfoProvider,
Credentials as __Credentials,
Decoder as __Decoder,
Expand All @@ -107,6 +108,7 @@ import {
Provider as __Provider,
StreamCollector as __StreamCollector,
UrlParser as __UrlParser,
UserAgent as __UserAgent,
} from "@aws-sdk/types";

export type ServiceInputTypes =
Expand Down Expand Up @@ -206,11 +208,6 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
*/
utf8Encoder?: __Encoder;

/**
* The string that will be used to populate default value in 'User-Agent' header
*/
defaultUserAgent?: string;

/**
* The runtime environment
*/
Expand Down Expand Up @@ -252,6 +249,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
* Fetch related hostname, signing name or signing region with given region.
*/
regionInfoProvider?: RegionInfoProvider;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
*/
defaultUserAgentProvider?: Provider<__UserAgent>;
}

export type ACMPCAClientConfig = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
Expand All @@ -260,17 +263,17 @@ export type ACMPCAClientConfig = Partial<__SmithyConfiguration<__HttpHandlerOpti
EndpointsInputConfig &
AwsAuthInputConfig &
RetryInputConfig &
UserAgentInputConfig &
HostHeaderInputConfig;
HostHeaderInputConfig &
UserAgentInputConfig;

export type ACMPCAClientResolvedConfig = __SmithyResolvedConfiguration<__HttpHandlerOptions> &
Required<ClientDefaults> &
RegionResolvedConfig &
EndpointsResolvedConfig &
AwsAuthResolvedConfig &
RetryResolvedConfig &
UserAgentResolvedConfig &
HostHeaderResolvedConfig;
HostHeaderResolvedConfig &
UserAgentResolvedConfig;

/**
* <note>
Expand Down Expand Up @@ -307,16 +310,16 @@ export class ACMPCAClient extends __Client<
let _config_2 = resolveEndpointsConfig(_config_1);
let _config_3 = resolveAwsAuthConfig(_config_2);
let _config_4 = resolveRetryConfig(_config_3);
let _config_5 = resolveUserAgentConfig(_config_4);
let _config_6 = resolveHostHeaderConfig(_config_5);
let _config_5 = resolveHostHeaderConfig(_config_4);
let _config_6 = resolveUserAgentConfig(_config_5);
super(_config_6);
this.config = _config_6;
this.middlewareStack.use(getAwsAuthPlugin(this.config));
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getHostHeaderPlugin(this.config));
this.middlewareStack.use(getLoggerPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
}

destroy(): void {
Expand Down
5 changes: 4 additions & 1 deletion clients/client-acm-pca/runtimeConfig.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
base64Encoder: toBase64,
bodyLengthChecker: calculateBodyLength,
credentialDefaultProvider: invalidAsyncFunction("Credentialis missing") as any,
defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),
defaultUserAgentProvider: defaultUserAgent({
serviceId: ClientSharedValues.serviceId,
clientVersion: packageInfo.version,
}),
maxAttempts: DEFAULT_MAX_ATTEMPTS,
region: invalidAsyncFunction("Region is missing") as any,
requestHandler: new FetchHttpHandler(),
Expand Down
3 changes: 0 additions & 3 deletions clients/client-acm-pca/runtimeConfig.native.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import packageInfo from "./package.json";

import { Sha256 } from "@aws-crypto/sha256-js";
import { parseUrl } from "@aws-sdk/url-parser-node";
import { ClientDefaults } from "./ACMPCAClient";
Expand All @@ -11,7 +9,6 @@ import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"
export const ClientDefaultValues: Required<ClientDefaults> = {
...BrowserDefaults,
runtime: "react-native",
defaultUserAgent: `aws-sdk-js-v3-react-native-${packageInfo.name}/${packageInfo.version}`,
sha256: Sha256,
urlParser: parseUrl,
};
5 changes: 4 additions & 1 deletion clients/client-acm-pca/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
base64Encoder: toBase64,
bodyLengthChecker: calculateBodyLength,
credentialDefaultProvider,
defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),
defaultUserAgentProvider: defaultUserAgent({
serviceId: ClientSharedValues.serviceId,
clientVersion: packageInfo.version,
}),
maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
requestHandler: new NodeHttpHandler(),
Expand Down
27 changes: 15 additions & 12 deletions clients/client-acm/ACMClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import {
SmithyResolvedConfiguration as __SmithyResolvedConfiguration,
} from "@aws-sdk/smithy-client";
import {
Provider,
RegionInfoProvider,
Credentials as __Credentials,
Decoder as __Decoder,
Expand All @@ -76,6 +77,7 @@ import {
Provider as __Provider,
StreamCollector as __StreamCollector,
UrlParser as __UrlParser,
UserAgent as __UserAgent,
} from "@aws-sdk/types";

export type ServiceInputTypes =
Expand Down Expand Up @@ -155,11 +157,6 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
*/
utf8Encoder?: __Encoder;

/**
* The string that will be used to populate default value in 'User-Agent' header
*/
defaultUserAgent?: string;

/**
* The runtime environment
*/
Expand Down Expand Up @@ -201,6 +198,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
* Fetch related hostname, signing name or signing region with given region.
*/
regionInfoProvider?: RegionInfoProvider;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
*/
defaultUserAgentProvider?: Provider<__UserAgent>;
}

export type ACMClientConfig = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
Expand All @@ -209,17 +212,17 @@ export type ACMClientConfig = Partial<__SmithyConfiguration<__HttpHandlerOptions
EndpointsInputConfig &
AwsAuthInputConfig &
RetryInputConfig &
UserAgentInputConfig &
HostHeaderInputConfig;
HostHeaderInputConfig &
UserAgentInputConfig;

export type ACMClientResolvedConfig = __SmithyResolvedConfiguration<__HttpHandlerOptions> &
Required<ClientDefaults> &
RegionResolvedConfig &
EndpointsResolvedConfig &
AwsAuthResolvedConfig &
RetryResolvedConfig &
UserAgentResolvedConfig &
HostHeaderResolvedConfig;
HostHeaderResolvedConfig &
UserAgentResolvedConfig;

/**
* <fullname>AWS Certificate Manager</fullname>
Expand All @@ -246,16 +249,16 @@ export class ACMClient extends __Client<
let _config_2 = resolveEndpointsConfig(_config_1);
let _config_3 = resolveAwsAuthConfig(_config_2);
let _config_4 = resolveRetryConfig(_config_3);
let _config_5 = resolveUserAgentConfig(_config_4);
let _config_6 = resolveHostHeaderConfig(_config_5);
let _config_5 = resolveHostHeaderConfig(_config_4);
let _config_6 = resolveUserAgentConfig(_config_5);
super(_config_6);
this.config = _config_6;
this.middlewareStack.use(getAwsAuthPlugin(this.config));
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getHostHeaderPlugin(this.config));
this.middlewareStack.use(getLoggerPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
}

destroy(): void {
Expand Down
5 changes: 4 additions & 1 deletion clients/client-acm/runtimeConfig.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
base64Encoder: toBase64,
bodyLengthChecker: calculateBodyLength,
credentialDefaultProvider: invalidAsyncFunction("Credentialis missing") as any,
defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),
defaultUserAgentProvider: defaultUserAgent({
serviceId: ClientSharedValues.serviceId,
clientVersion: packageInfo.version,
}),
maxAttempts: DEFAULT_MAX_ATTEMPTS,
region: invalidAsyncFunction("Region is missing") as any,
requestHandler: new FetchHttpHandler(),
Expand Down
3 changes: 0 additions & 3 deletions clients/client-acm/runtimeConfig.native.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import packageInfo from "./package.json";

import { Sha256 } from "@aws-crypto/sha256-js";
import { parseUrl } from "@aws-sdk/url-parser-node";
import { ClientDefaults } from "./ACMClient";
Expand All @@ -11,7 +9,6 @@ import { ClientDefaultValues as BrowserDefaults } from "./runtimeConfig.browser"
export const ClientDefaultValues: Required<ClientDefaults> = {
...BrowserDefaults,
runtime: "react-native",
defaultUserAgent: `aws-sdk-js-v3-react-native-${packageInfo.name}/${packageInfo.version}`,
sha256: Sha256,
urlParser: parseUrl,
};
5 changes: 4 additions & 1 deletion clients/client-acm/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export const ClientDefaultValues: Required<ClientDefaults> = {
base64Encoder: toBase64,
bodyLengthChecker: calculateBodyLength,
credentialDefaultProvider,
defaultUserAgent: defaultUserAgent(packageInfo.name, packageInfo.version),
defaultUserAgentProvider: defaultUserAgent({
serviceId: ClientSharedValues.serviceId,
clientVersion: packageInfo.version,
}),
maxAttempts: loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
requestHandler: new NodeHttpHandler(),
Expand Down
Loading

0 comments on commit 01bca36

Please sign in to comment.