diff --git a/src/transforms/v2-to-v3/__fixtures__/credentials/cognito-identity.input.js b/src/transforms/v2-to-v3/__fixtures__/credentials/cognito-identity.input.js new file mode 100644 index 000000000..5f7be3c97 --- /dev/null +++ b/src/transforms/v2-to-v3/__fixtures__/credentials/cognito-identity.input.js @@ -0,0 +1,3 @@ +import AWS from "aws-sdk"; + +new AWS.CognitoIdentityCredentials(); \ No newline at end of file diff --git a/src/transforms/v2-to-v3/__fixtures__/credentials/cognito-identity.output.js b/src/transforms/v2-to-v3/__fixtures__/credentials/cognito-identity.output.js new file mode 100644 index 000000000..b81904f5d --- /dev/null +++ b/src/transforms/v2-to-v3/__fixtures__/credentials/cognito-identity.output.js @@ -0,0 +1,6 @@ +import { fromCognitoIdentity } from "@aws-sdk/credential-providers"; + +// JS SDK v3 switched to credential providers to functions instead of objects. +// This is the closest approximation from codemod of what your application needs. +// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers +fromCognitoIdentity(); \ No newline at end of file diff --git a/src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts b/src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts index 1bf539b37..e75303aa5 100644 --- a/src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts +++ b/src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts @@ -3,6 +3,7 @@ */ export const AWS_CREDENTIALS_MAP: Record = { ChainableTemporaryCredentials: "fromTemporaryCredentials", + CognitoIdentityCredentials: "fromCognitoIdentity", EC2MetadataCredentials: "fromInstanceMetadata", ECSCredentials: "fromContainerMetadata", EnvironmentCredentials: "fromEnv",