Skip to content

Commit f2100df

Browse files
authored
Replace config credentialsProvider with credentials (#853)
1 parent 08f1e72 commit f2100df

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

.changeset/honest-readers-confess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"aws-sdk-js-codemod": patch
3+
---
4+
5+
Replace config credentialsProvider with credentials
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import AWS from "aws-sdk";
2+
3+
const config = new AWS.Config({
4+
credentialProvider: () => Promise.resolve({
5+
accessKeyId: "AKID",
6+
secretAccessKey: "SECRET"
7+
})
8+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const config = {
2+
// The key credentialProvider is renamed to credentials.
3+
// The credentials in JS SDK v3 accepts providers.
4+
credentials: () => Promise.resolve({
5+
accessKeyId: "AKID",
6+
secretAccessKey: "SECRET"
7+
})
8+
};

src/transforms/v2-to-v3/config/AWS_CONFIG_KEY_MAP.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export const AWS_CONFIG_KEY_MAP: Record<string, AwsConfigKeyStatus> = {
2222
deprecationMessage: "The clock skew correction is applied by default.",
2323
},
2424
credentials: {},
25+
credentialProvider: {
26+
newKeyName: "credentials",
27+
description: "The credentials in JS SDK v3 accepts providers.",
28+
},
2529
endpoint: {},
2630
endpointCacheSize: {},
2731
endpointDiscoveryEnabled: {},

0 commit comments

Comments
 (0)