Skip to content

Commit 81d863f

Browse files
authored
Transform clients imported from aws-sdk/clients/all (#845)
1 parent 64f1f38 commit 81d863f

13 files changed

+83
-6
lines changed

.changeset/poor-badgers-battle.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 clients imported from aws-sdk/clients/all
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { getServiceImportInput } from "./getServiceImportInput";
2+
3+
export const getServiceImportDeepAllInput = () => getServiceImportInput("aws-sdk/clients/all");

scripts/generateNewClientTests/getServiceImportInput.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { CLIENTS_TO_TEST } from "./config";
22
import { getV2ClientsNewExpressionCode } from "./getV2ClientsNewExpressionCode";
33

4-
export const getServiceImportInput = () => {
4+
export const getServiceImportInput = (path?: string) => {
55
let content = ``;
66

7-
content += `import { ${CLIENTS_TO_TEST.join(", ")} } from "aws-sdk";\n`;
7+
content += `import { ${CLIENTS_TO_TEST.join(", ")} } from "${path ? path : "aws-sdk"}";\n`;
88
content += `\n`;
99
content += getV2ClientsNewExpressionCode(CLIENTS_TO_TEST);
1010

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { getServiceRequireInput } from "./getServiceRequireInput";
2+
3+
export const getServiceRequireDeepAllInput = () => getServiceRequireInput("aws-sdk/clients/all");

scripts/generateNewClientTests/getServiceRequireInput.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { CLIENTS_TO_TEST } from "./config";
22
import { getV2ClientsNewExpressionCode } from "./getV2ClientsNewExpressionCode";
33

4-
export const getServiceRequireInput = () => {
4+
export const getServiceRequireInput = (path?: string) => {
55
let content = ``;
66

7-
content += `const { ${CLIENTS_TO_TEST.join(", ")} } = require("aws-sdk");\n`;
7+
content += `const { ${CLIENTS_TO_TEST.join(", ")} } = require("${path ? path : "aws-sdk"}");\n`;
88
content += `\n`;
99
content += getV2ClientsNewExpressionCode(CLIENTS_TO_TEST);
1010

scripts/generateNewClientTests/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { getGlobalRequirePropertyInput } from "./getGlobalRequirePropertyInput";
1515
import { getGlobalRequirePropertyOutput } from "./getGlobalRequirePropertyOutput";
1616
import { getGlobalRequirePropertyWithNameInput } from "./getGlobalRequirePropertyWithNameInput";
1717
import { getGlobalRequirePropertyWithNameOutput } from "./getGlobalRequirePropertyWithNameOutput";
18+
import { getServiceImportDeepAllInput } from "./getServiceImportDeepAllInput";
1819
import { getServiceImportDeepInput } from "./getServiceImportDeepInput";
1920
import { getServiceImportDeepOutput } from "./getServiceImportDeepOutput";
2021
import { getServiceImportDeepStarInput } from "./getServiceImportDeepStarInput";
@@ -31,6 +32,7 @@ import { getServiceImportInput } from "./getServiceImportInput";
3132
import { getServiceImportOutput } from "./getServiceImportOutput";
3233
import { getServiceImportWithNameInput } from "./getServiceImportWithNameInput";
3334
import { getServiceImportWithNameOutput } from "./getServiceImportWithNameOutput";
35+
import { getServiceRequireDeepAllInput } from "./getServiceRequireDeepAllInput";
3436
import { getServiceRequireDeepInput } from "./getServiceRequireDeepInput";
3537
import { getServiceRequireDeepOutput } from "./getServiceRequireDeepOutput";
3638
import { getServiceRequireDeepWithNameInput } from "./getServiceRequireDeepWithNameInput";
@@ -68,6 +70,8 @@ const newClientTestsPath = join(__dirname, "..", "..", newClientsTestsFolder);
6870
["service-import-equals-with-name.output.ts", getServiceImportEqualsWithNameOutput],
6971
["service-import-deep.input.js", getServiceImportDeepInput],
7072
["service-import-deep.output.js", getServiceImportDeepOutput],
73+
["service-import-deep-all.input.js", getServiceImportDeepAllInput],
74+
["service-import-deep-all.output.js", getServiceImportDeepOutput],
7175
["service-import-deep-with-name.input.js", getServiceImportDeepWithNameInput],
7276
["service-import-deep-with-name.output.js", getServiceImportDeepWithNameOutput],
7377
["service-import-deep-star.input.js", getServiceImportDeepStarInput],
@@ -78,6 +82,8 @@ const newClientTestsPath = join(__dirname, "..", "..", newClientsTestsFolder);
7882
["service-import-with-name.output.js", getServiceImportWithNameOutput],
7983
["service-require.input.js", getServiceRequireInput],
8084
["service-require.output.js", getServiceRequireOutput],
85+
["service-require-deep-all.input.js", getServiceRequireDeepAllInput],
86+
["service-require-deep-all.output.js", getServiceRequireOutput],
8187
["service-require-deep.input.js", getServiceRequireDeepInput],
8288
["service-require-deep.output.js", getServiceRequireDeepOutput],
8389
["service-require-deep-with-name.input.js", getServiceRequireDeepWithNameInput],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This file is generated by scripts/generateNewClientTests/index.ts
2+
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
3+
import { AccessAnalyzer, Discovery, ACM } from "aws-sdk/clients/all";
4+
5+
new AccessAnalyzer();
6+
new Discovery();
7+
new ACM();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This file is generated by scripts/generateNewClientTests/index.ts
2+
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
3+
4+
5+
import { AccessAnalyzer } from "@aws-sdk/client-accessanalyzer";
6+
import { ACM } from "@aws-sdk/client-acm";
7+
import { ApplicationDiscoveryService } from "@aws-sdk/client-application-discovery-service";
8+
9+
new AccessAnalyzer();
10+
new ApplicationDiscoveryService();
11+
new ACM();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This file is generated by scripts/generateNewClientTests/index.ts
2+
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
3+
const { AccessAnalyzer, Discovery, ACM } = require("aws-sdk/clients/all");
4+
5+
new AccessAnalyzer();
6+
new Discovery();
7+
new ACM();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This file is generated by scripts/generateNewClientTests/index.ts
2+
// Do not edit this file directly. Instead, edit the script and run it to regenerate this file.
3+
4+
5+
const { AccessAnalyzer } = require("@aws-sdk/client-accessanalyzer");
6+
const { ACM } = require("@aws-sdk/client-acm");
7+
const { ApplicationDiscoveryService } = require("@aws-sdk/client-application-discovery-service");
8+
9+
new AccessAnalyzer();
10+
new ApplicationDiscoveryService();
11+
new ACM();

0 commit comments

Comments
 (0)