Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(clients): profile setting for clients #6728

Merged
merged 8 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 19 additions & 0 deletions clients/client-accessanalyzer/src/AccessAnalyzerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,25 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
*/
region?: string | __Provider<string>;

/**
* Setting a client profile is similar to setting a value for the
* AWS_PROFILE environment variable. Setting a profile on a client
* in code only affects the single client instance, unlike AWS_PROFILE.
*
* When set, and only for environments where an AWS configuration
* file exists, fields configurable by this file will be retrieved
* from the specified profile within that file.
* Conflicting code configuration and environment variables will
* still have higher priority.
*
* For client credential resolution that involves checking the AWS
* configuration file, the client's profile (this value) will be
* used unless a different profile is set in the credential
* provider options.
*
*/
profile?: string;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
Expand Down
25 changes: 16 additions & 9 deletions clients/client-accessanalyzer/src/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => {
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
const clientSharedValues = getSharedRuntimeConfig(config);
awsCheckVersion(process.version);
const profileConfig = { profile: config?.profile };
return {
...clientSharedValues,
...config,
Expand All @@ -42,19 +43,25 @@ export const getRuntimeConfig = (config: AccessAnalyzerClientConfig) => {
defaultUserAgentProvider:
config?.defaultUserAgentProvider ??
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
region:
config?.region ??
loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...profileConfig }),
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
retryMode:
config?.retryMode ??
loadNodeConfig({
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
}),
loadNodeConfig(
{
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
},
config
),
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS),
useDualstackEndpoint:
config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, profileConfig),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, profileConfig),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, profileConfig),
};
};
19 changes: 19 additions & 0 deletions clients/client-account/src/AccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,25 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
*/
region?: string | __Provider<string>;

/**
* Setting a client profile is similar to setting a value for the
* AWS_PROFILE environment variable. Setting a profile on a client
* in code only affects the single client instance, unlike AWS_PROFILE.
*
* When set, and only for environments where an AWS configuration
* file exists, fields configurable by this file will be retrieved
* from the specified profile within that file.
* Conflicting code configuration and environment variables will
* still have higher priority.
*
* For client credential resolution that involves checking the AWS
* configuration file, the client's profile (this value) will be
* used unless a different profile is set in the credential
* provider options.
*
*/
profile?: string;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
Expand Down
25 changes: 16 additions & 9 deletions clients/client-account/src/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const getRuntimeConfig = (config: AccountClientConfig) => {
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
const clientSharedValues = getSharedRuntimeConfig(config);
awsCheckVersion(process.version);
const profileConfig = { profile: config?.profile };
return {
...clientSharedValues,
...config,
Expand All @@ -42,19 +43,25 @@ export const getRuntimeConfig = (config: AccountClientConfig) => {
defaultUserAgentProvider:
config?.defaultUserAgentProvider ??
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
region:
config?.region ??
loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...profileConfig }),
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
retryMode:
config?.retryMode ??
loadNodeConfig({
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
}),
loadNodeConfig(
{
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
},
config
),
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS),
useDualstackEndpoint:
config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, profileConfig),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, profileConfig),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, profileConfig),
};
};
19 changes: 19 additions & 0 deletions clients/client-acm-pca/src/ACMPCAClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,25 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
*/
region?: string | __Provider<string>;

/**
* Setting a client profile is similar to setting a value for the
* AWS_PROFILE environment variable. Setting a profile on a client
* in code only affects the single client instance, unlike AWS_PROFILE.
*
* When set, and only for environments where an AWS configuration
* file exists, fields configurable by this file will be retrieved
* from the specified profile within that file.
* Conflicting code configuration and environment variables will
* still have higher priority.
*
* For client credential resolution that involves checking the AWS
* configuration file, the client's profile (this value) will be
* used unless a different profile is set in the credential
* provider options.
*
*/
profile?: string;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
Expand Down
25 changes: 16 additions & 9 deletions clients/client-acm-pca/src/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const getRuntimeConfig = (config: ACMPCAClientConfig) => {
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
const clientSharedValues = getSharedRuntimeConfig(config);
awsCheckVersion(process.version);
const profileConfig = { profile: config?.profile };
return {
...clientSharedValues,
...config,
Expand All @@ -42,19 +43,25 @@ export const getRuntimeConfig = (config: ACMPCAClientConfig) => {
defaultUserAgentProvider:
config?.defaultUserAgentProvider ??
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
region:
config?.region ??
loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...profileConfig }),
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
retryMode:
config?.retryMode ??
loadNodeConfig({
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
}),
loadNodeConfig(
{
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
},
config
),
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS),
useDualstackEndpoint:
config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, profileConfig),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, profileConfig),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, profileConfig),
};
};
19 changes: 19 additions & 0 deletions clients/client-acm/src/ACMClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,25 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
*/
region?: string | __Provider<string>;

/**
* Setting a client profile is similar to setting a value for the
* AWS_PROFILE environment variable. Setting a profile on a client
* in code only affects the single client instance, unlike AWS_PROFILE.
*
* When set, and only for environments where an AWS configuration
* file exists, fields configurable by this file will be retrieved
* from the specified profile within that file.
* Conflicting code configuration and environment variables will
* still have higher priority.
*
* For client credential resolution that involves checking the AWS
* configuration file, the client's profile (this value) will be
* used unless a different profile is set in the credential
* provider options.
*
*/
profile?: string;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
Expand Down
25 changes: 16 additions & 9 deletions clients/client-acm/src/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const getRuntimeConfig = (config: ACMClientConfig) => {
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
const clientSharedValues = getSharedRuntimeConfig(config);
awsCheckVersion(process.version);
const profileConfig = { profile: config?.profile };
return {
...clientSharedValues,
...config,
Expand All @@ -42,19 +43,25 @@ export const getRuntimeConfig = (config: ACMClientConfig) => {
defaultUserAgentProvider:
config?.defaultUserAgentProvider ??
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
region:
config?.region ??
loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...profileConfig }),
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
retryMode:
config?.retryMode ??
loadNodeConfig({
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
}),
loadNodeConfig(
{
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
},
config
),
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS),
useDualstackEndpoint:
config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, profileConfig),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, profileConfig),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, profileConfig),
};
};
19 changes: 19 additions & 0 deletions clients/client-amp/src/AmpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,25 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
*/
region?: string | __Provider<string>;

/**
* Setting a client profile is similar to setting a value for the
* AWS_PROFILE environment variable. Setting a profile on a client
* in code only affects the single client instance, unlike AWS_PROFILE.
*
* When set, and only for environments where an AWS configuration
* file exists, fields configurable by this file will be retrieved
* from the specified profile within that file.
* Conflicting code configuration and environment variables will
* still have higher priority.
*
* For client credential resolution that involves checking the AWS
* configuration file, the client's profile (this value) will be
* used unless a different profile is set in the credential
* provider options.
*
*/
profile?: string;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
Expand Down
25 changes: 16 additions & 9 deletions clients/client-amp/src/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const getRuntimeConfig = (config: AmpClientConfig) => {
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
const clientSharedValues = getSharedRuntimeConfig(config);
awsCheckVersion(process.version);
const profileConfig = { profile: config?.profile };
return {
...clientSharedValues,
...config,
Expand All @@ -42,19 +43,25 @@ export const getRuntimeConfig = (config: AmpClientConfig) => {
defaultUserAgentProvider:
config?.defaultUserAgentProvider ??
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
region:
config?.region ??
loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...profileConfig }),
requestHandler: RequestHandler.create(config?.requestHandler ?? defaultConfigProvider),
retryMode:
config?.retryMode ??
loadNodeConfig({
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
}),
loadNodeConfig(
{
...NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
},
config
),
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS),
useDualstackEndpoint:
config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, profileConfig),
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, profileConfig),
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS, profileConfig),
};
};
19 changes: 19 additions & 0 deletions clients/client-amplify/src/AmplifyClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,25 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
*/
region?: string | __Provider<string>;

/**
* Setting a client profile is similar to setting a value for the
* AWS_PROFILE environment variable. Setting a profile on a client
* in code only affects the single client instance, unlike AWS_PROFILE.
*
* When set, and only for environments where an AWS configuration
* file exists, fields configurable by this file will be retrieved
* from the specified profile within that file.
* Conflicting code configuration and environment variables will
* still have higher priority.
*
* For client credential resolution that involves checking the AWS
* configuration file, the client's profile (this value) will be
* used unless a different profile is set in the credential
* provider options.
*
*/
profile?: string;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
Expand Down
Loading
Loading