Skip to content

Commit bfa8e16

Browse files
authored
Transform named import of Credentials (#778)
1 parent 969443b commit bfa8e16

23 files changed

+114
-13
lines changed

.changeset/quick-doors-live.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+
Transform named import of Credentials
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import AWS from "aws-sdk";
1+
import { CredentialProviderChain } from "aws-sdk";
22

3-
new AWS.CredentialProviderChain(providers);
3+
new CredentialProviderChain(providers);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { CognitoIdentityCredentials } from "aws-sdk";
2+
3+
new CognitoIdentityCredentials();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromCognitoIdentity } from "@aws-sdk/credential-providers";
2+
3+
// JS SDK v3 switched credential providers from classes to functions.
4+
// This is the closest approximation from codemod of what your application needs.
5+
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
6+
fromCognitoIdentity();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { EC2MetadataCredentials } from "aws-sdk";
2+
3+
new EC2MetadataCredentials();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromInstanceMetadata } from "@aws-sdk/credential-providers";
2+
3+
// JS SDK v3 switched credential providers from classes to functions.
4+
// This is the closest approximation from codemod of what your application needs.
5+
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
6+
fromInstanceMetadata();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ECSCredentials } from "aws-sdk";
2+
3+
new ECSCredentials();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromContainerMetadata } from "@aws-sdk/credential-providers";
2+
3+
// JS SDK v3 switched credential providers from classes to functions.
4+
// This is the closest approximation from codemod of what your application needs.
5+
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
6+
fromContainerMetadata();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { EnvironmentCredentials } from "aws-sdk";
2+
3+
new EnvironmentCredentials("AWS");
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromEnv } from "@aws-sdk/credential-providers";
2+
3+
// JS SDK v3 switched credential providers from classes to functions.
4+
// This is the closest approximation from codemod of what your application needs.
5+
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
6+
fromEnv("AWS");

0 commit comments

Comments
 (0)