Skip to content

Commit

Permalink
feat(credential-providers): rename contextClientConfig to callerClien…
Browse files Browse the repository at this point in the history
…tConfig
  • Loading branch information
kuhe committed Dec 12, 2024
1 parent 486f1fb commit 7c97498
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ export const resolveAwsSdkSigV4Config = <T>(
}
}

const contextBoundCredentialsProvider = async () => {
return credentialsProvider!({ contextClientConfig: config });
const boundCredentialsProvider = async () => {
return credentialsProvider!({ callerClientConfig: config });
};

// Populate sigv4 arguments
Expand Down Expand Up @@ -174,7 +174,7 @@ export const resolveAwsSdkSigV4Config = <T>(

const params: SignatureV4Init & SignatureV4CryptoInit = {
...config,
credentials: contextBoundCredentialsProvider,
credentials: boundCredentialsProvider,
region: config.signingRegion,
service: config.signingName,
sha256,
Expand Down Expand Up @@ -210,7 +210,7 @@ export const resolveAwsSdkSigV4Config = <T>(

const params: SignatureV4Init & SignatureV4CryptoInit = {
...config,
credentials: contextBoundCredentialsProvider,
credentials: boundCredentialsProvider,
region: config.signingRegion,
service: config.signingName,
sha256,
Expand All @@ -228,10 +228,10 @@ export const resolveAwsSdkSigV4Config = <T>(
signingEscapePath,
credentials: isUserSupplied
? async () =>
contextBoundCredentialsProvider!().then((creds: AttributedAwsCredentialIdentity) =>
boundCredentialsProvider!().then((creds: AttributedAwsCredentialIdentity) =>
setCredentialFeature(creds, "CREDENTIALS_CODE", "e")
)
: contextBoundCredentialsProvider!,
: boundCredentialsProvider!,
signer,
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function fromCognitoIdentity(parameters: FromCognitoIdentityParameters):
region:
parameters.clientConfig?.region ??
parameters.parentClientConfig?.region ??
awsIdentityProperties?.contextClientConfig?.region,
awsIdentityProperties?.callerClientConfig?.region,
})
)
).send(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function fromCognitoIdentityPool({
new CognitoIdentityClient(
Object.assign({}, clientConfig ?? {}, {
region:
clientConfig?.region ?? parentClientConfig?.region ?? awsIdentityProperties?.contextClientConfig?.region,
clientConfig?.region ?? parentClientConfig?.region ?? awsIdentityProperties?.callerClientConfig?.region,
})
);

Expand Down
6 changes: 3 additions & 3 deletions packages/credential-provider-ini/src/fromIni.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ export interface FromIniInit extends SourceProfileInit, CredentialProviderOption
*/
export const fromIni =
(_init: FromIniInit = {}): RegionalAwsCredentialIdentityProvider =>
async ({ contextClientConfig } = {}) => {
async ({ callerClientConfig } = {}) => {
const init: FromIniInit = {
..._init,
};
if (contextClientConfig?.region) {
if (callerClientConfig?.region) {
init.parentClientConfig = {
region: contextClientConfig.region,
region: callerClientConfig.region,
..._init.parentClientConfig,
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/credential-provider-web-identity/src/fromWebToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ export const fromWebToken =
{
...init.clientConfig,
credentialProviderLogger: init.logger,
...(awsIdentityProperties?.contextClientConfig?.region || init.parentClientConfig
...(awsIdentityProperties?.callerClientConfig?.region || init.parentClientConfig
? {
parentClientConfig: {
region: awsIdentityProperties?.contextClientConfig?.region,
region: awsIdentityProperties?.callerClientConfig?.region,
...init.parentClientConfig,
},
}
Expand Down
2 changes: 1 addition & 1 deletion packages/middleware-signing/src/awsAuthConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ const createConfigBoundCredentialProvider = (input: {
);
const normalizedCreds = async () =>
(normalizedCredentialsProvider as RegionalAwsCredentialIdentityProvider)({
contextClientConfig: {
callerClientConfig: {
region: normalizeProvider(input.region),
},
});
Expand Down
4 changes: 2 additions & 2 deletions packages/token-providers/src/fromSso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export const fromSso =
async (awsIdentityProperties?: AwsIdentityProperties) => {
const init: FromSsoInit = {
..._init,
...(awsIdentityProperties?.contextClientConfig?.region
...(awsIdentityProperties?.callerClientConfig?.region
? {
parentClientConfig: {
region: awsIdentityProperties?.contextClientConfig?.region,
region: awsIdentityProperties?.callerClientConfig?.region,
..._init.parentClientConfig,
},
}
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/identity/AwsCredentialIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export { AwsCredentialIdentity, AwsCredentialIdentityProvider, IdentityProvider
* @public
*/
export interface AwsIdentityProperties {
contextClientConfig?: {
callerClientConfig?: {
region(): Promise<string>;
};
}
Expand Down

0 comments on commit 7c97498

Please sign in to comment.