Skip to content

Commit

Permalink
Add transformation for AWS.SsoCredentials (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Oct 23, 2023
1 parent d788e09 commit cc5f412
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-forks-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"aws-sdk-js-codemod": patch
---

Add transformation for AWS.SsoCredentials
3 changes: 3 additions & 0 deletions src/transforms/v2-to-v3/__fixtures__/credentials/sso.input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import AWS from "aws-sdk";

new AWS.SsoCredentials({ profile: "profile-name" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { fromSSO } 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
fromSSO({ profile: "profile-name" });
1 change: 1 addition & 0 deletions src/transforms/v2-to-v3/config/AWS_CREDENTIALS_MAP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const AWS_CREDENTIALS_MAP: Record<string, string> = {
EnvironmentCredentials: "fromEnv",
RemoteCredentials: "fromContainerMetadata",
SharedIniFileCredentials: "fromIni",
SsoCredentials: "fromSSO",
TokenFileWebIdentityCredentials: "fromTokenFile",
WebIdentityCredentials: "fromWebToken",
};

0 comments on commit cc5f412

Please sign in to comment.