Skip to content

Commit 6e6c41f

Browse files
authored
Add check for s3 client name before transforming upload API (#449)
1 parent c74fb09 commit 6e6c41f

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

.changeset/brave-pumpkins-beam.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+
Add check for s3 client name before transforming upload API
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import AWS from "aws-sdk";
2+
3+
const client = new AWS.DynamoDB({ region: "REGION" });
4+
// Used for testing. DynamoDB does not have upload API.
5+
await client.upload({}).promise();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { DynamoDB } from "@aws-sdk/client-dynamodb";
2+
3+
const client = new DynamoDB({ region: "REGION" });
4+
// Used for testing. DynamoDB does not have upload API.
5+
await client.upload({});

src/transforms/v2-to-v3/apis/replaceS3UploadApi.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export const replaceS3UploadApi = (
1414
source: Collection<unknown>,
1515
options: ReplaceS3UploadApiOptions
1616
): void => {
17+
if (options.v2ClientName !== "S3") return;
18+
1719
const v2ClientIdentifiers = getV2ClientIdentifiers(j, source, options);
1820

1921
for (const v2ClientId of v2ClientIdentifiers) {

0 commit comments

Comments
 (0)