-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace named imports for Request/Response types (#221)
- Loading branch information
Showing
12 changed files
with
101 additions
and
37 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": patch | ||
--- | ||
|
||
Replace named imports for Request/Response types |
10 changes: 7 additions & 3 deletions
10
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/global-import.input.ts
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import AWS from "aws-sdk"; | ||
|
||
const client = new AWS.DynamoDB({ region: "us-west-2" }); | ||
|
||
const ddbClient = new AWS.DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS.DynamoDB.ListTablesInput = { Limit: 10 }; | ||
const listTablesOutput: AWS.DynamoDB.ListTablesOutput = await client | ||
const listTablesOutput: AWS.DynamoDB.ListTablesOutput = await ddbClient | ||
.listTables(listTablesInput) | ||
.promise(); | ||
|
||
const stsClient = new AWS.STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS.STS.GetCallerIdentityRequest = {}; | ||
const getCallerIdentityOutput: AWS.STS.GetCallerIdentityResponse = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput) | ||
.promise(); |
13 changes: 9 additions & 4 deletions
13
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/global-import.output.ts
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import { DynamoDB, ListTablesCommandInput, ListTablesCommandOutput } from "@aws-sdk/client-dynamodb"; | ||
import { STS, GetCallerIdentityCommandInput, GetCallerIdentityCommandOutput } from "@aws-sdk/client-sts"; | ||
|
||
const client = new DynamoDB({ region: "us-west-2" }); | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesCommandOutput = await client | ||
.listTables(listTablesInput); | ||
const listTablesOutput: ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); |
10 changes: 7 additions & 3 deletions
10
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/global-require.input.ts
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
const AWS = require("aws-sdk"); | ||
|
||
const client = new AWS.DynamoDB({ region: "us-west-2" }); | ||
|
||
const ddbClient = new AWS.DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: AWS.DynamoDB.ListTablesInput = { Limit: 10 }; | ||
const listTablesOutput: AWS.DynamoDB.ListTablesOutput = await client | ||
const listTablesOutput: AWS.DynamoDB.ListTablesOutput = await ddbClient | ||
.listTables(listTablesInput) | ||
.promise(); | ||
|
||
const stsClient = new AWS.STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: AWS.STS.GetCallerIdentityRequest = {}; | ||
const getCallerIdentityOutput: AWS.STS.GetCallerIdentityResponse = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput) | ||
.promise(); |
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
12 changes: 9 additions & 3 deletions
12
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import-named.input.ts
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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import DynamoDB, { ListTablesInput, ListTablesOutput } from "aws-sdk/clients/dynamodb"; | ||
import STS, { GetCallerIdentityRequest, GetCallerIdentityResponse } from "aws-sdk/clients/sts"; | ||
|
||
const client = new DynamoDB({ region: "us-west-2" }); | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: ListTablesInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesOutput = await client | ||
const listTablesOutput: ListTablesOutput = await ddbClient | ||
.listTables(listTablesInput) | ||
.promise(); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: GetCallerIdentityRequest = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityResponse = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput) | ||
.promise(); |
13 changes: 9 additions & 4 deletions
13
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import-named.output.ts
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import { DynamoDB, ListTablesCommandInput, ListTablesCommandOutput } from "@aws-sdk/client-dynamodb"; | ||
import { STS, GetCallerIdentityCommandInput, GetCallerIdentityCommandOutput } from "@aws-sdk/client-sts"; | ||
|
||
const client = new DynamoDB({ region: "us-west-2" }); | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesCommandOutput = await client | ||
.listTables(listTablesInput); | ||
const listTablesOutput: ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); |
12 changes: 9 additions & 3 deletions
12
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import.input.ts
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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import DynamoDB from "aws-sdk/clients/dynamodb"; | ||
import STS from "aws-sdk/clients/sts"; | ||
|
||
const client = new DynamoDB({ region: "us-west-2" }); | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: DynamoDB.ListTablesInput = { Limit: 10 }; | ||
const listTablesOutput: DynamoDB.ListTablesOutput = await client | ||
const listTablesOutput: DynamoDB.ListTablesOutput = await ddbClient | ||
.listTables(listTablesInput) | ||
.promise(); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: STS.GetCallerIdentityRequest = {}; | ||
const getCallerIdentityOutput: STS.GetCallerIdentityResponse = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput) | ||
.promise(); |
13 changes: 9 additions & 4 deletions
13
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-import.output.ts
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import { DynamoDB, ListTablesCommandInput, ListTablesCommandOutput } from "@aws-sdk/client-dynamodb"; | ||
import { STS, GetCallerIdentityCommandInput, GetCallerIdentityCommandOutput } from "@aws-sdk/client-sts"; | ||
|
||
const client = new DynamoDB({ region: "us-west-2" }); | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: ListTablesCommandInput = { Limit: 10 }; | ||
const listTablesOutput: ListTablesCommandOutput = await client | ||
.listTables(listTablesInput); | ||
const listTablesOutput: ListTablesCommandOutput = await ddbClient | ||
.listTables(listTablesInput); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: GetCallerIdentityCommandInput = {}; | ||
const getCallerIdentityOutput: GetCallerIdentityCommandOutput = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput); |
12 changes: 9 additions & 3 deletions
12
src/transforms/v2-to-v3/__fixtures__/api-input-output-type/service-require.input.ts
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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
const DynamoDB = require("aws-sdk/clients/dynamodb"); | ||
const STS = require("aws-sdk/clients/sts"); | ||
|
||
const client = new DynamoDB({ region: "us-west-2" }); | ||
|
||
const ddbClient = new DynamoDB({ region: "us-west-2" }); | ||
const listTablesInput: DynamoDB.ListTablesInput = { Limit: 10 }; | ||
const listTablesOutput: DynamoDB.ListTablesOutput = await client | ||
const listTablesOutput: DynamoDB.ListTablesOutput = await ddbClient | ||
.listTables(listTablesInput) | ||
.promise(); | ||
|
||
const stsClient = new STS({ region: "us-west-2" }); | ||
const getCallerIdentityInput: STS.GetCallerIdentityRequest = {}; | ||
const getCallerIdentityOutput: STS.GetCallerIdentityResponse = await stsClient | ||
.getCallerIdentity(getCallerIdentityInput) | ||
.promise(); |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export const PACKAGE_NAME = "aws-sdk"; | ||
|
||
// ToDo: Add Request and Response suffixes in future version. | ||
export const V2_CLIENT_INPUT_SUFFIX_LIST = ["Input"]; | ||
export const V2_CLIENT_OUTPUT_SUFFIX_LIST = ["Output"]; | ||
export const V2_CLIENT_INPUT_SUFFIX_LIST = ["Input", "Request"]; | ||
export const V2_CLIENT_OUTPUT_SUFFIX_LIST = ["Output", "Response"]; |