-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add transformation for TokenProviders and TokenProviderChain (#641)
- Loading branch information
Showing
10 changed files
with
88 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"aws-sdk-js-codemod": minor | ||
--- | ||
|
||
Add transformation for TokenProviders and TokenProviderChain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import AWS from "aws-sdk"; | ||
|
||
new AWS.TokenProviderChain(providers); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { chain as providerChain } from "@smithy/property-provider"; | ||
|
||
// JS SDK v3 switched token providers from classes to functions. | ||
// The TokenProviderChain is now a chain of providers. | ||
// Reference: https://www.npmjs.com/package/@aws-sdk/token-providers | ||
providerChain(providers); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import AWS from "aws-sdk"; | ||
|
||
new AWS.SSOTokenProvider(options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { fromSso } from "@aws-sdk/token-providers"; | ||
|
||
// JS SDK v3 switched token providers from classes to functions. | ||
// This is the closest approximation from codemod of what your application needs. | ||
// Reference: https://www.npmjs.com/package/@aws-sdk/token-providers | ||
fromSso(options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import AWS from "aws-sdk"; | ||
|
||
new AWS.StaticTokenProvider(options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { fromStatic } from "@aws-sdk/token-providers"; | ||
|
||
// JS SDK v3 switched token providers from classes to functions. | ||
// This is the closest approximation from codemod of what your application needs. | ||
// Reference: https://www.npmjs.com/package/@aws-sdk/token-providers | ||
fromStatic(options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Maps the AWS token class name in v2 to the v3 equivalent provider. | ||
*/ | ||
export const AWS_TOKEN_MAP: Record<string, string> = { | ||
SSOTokenProvider: "fromSso", | ||
StaticTokenProvider: "fromStatic", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters