Skip to content

Commit 58a3e7a

Browse files
author
awstools
committed
feat(client-dynamodb): This release adds support for importing data from S3 into a new DynamoDB table
1 parent a7c0bbd commit 58a3e7a

File tree

11 files changed

+2271
-8
lines changed

11 files changed

+2271
-8
lines changed

clients/client-dynamodb/src/DynamoDB.ts

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ import {
6969
DescribeGlobalTableSettingsCommandInput,
7070
DescribeGlobalTableSettingsCommandOutput,
7171
} from "./commands/DescribeGlobalTableSettingsCommand";
72+
import {
73+
DescribeImportCommand,
74+
DescribeImportCommandInput,
75+
DescribeImportCommandOutput,
76+
} from "./commands/DescribeImportCommand";
7277
import {
7378
DescribeKinesisStreamingDestinationCommand,
7479
DescribeKinesisStreamingDestinationCommandInput,
@@ -120,6 +125,7 @@ import {
120125
ExportTableToPointInTimeCommandOutput,
121126
} from "./commands/ExportTableToPointInTimeCommand";
122127
import { GetItemCommand, GetItemCommandInput, GetItemCommandOutput } from "./commands/GetItemCommand";
128+
import { ImportTableCommand, ImportTableCommandInput, ImportTableCommandOutput } from "./commands/ImportTableCommand";
123129
import { ListBackupsCommand, ListBackupsCommandInput, ListBackupsCommandOutput } from "./commands/ListBackupsCommand";
124130
import {
125131
ListContributorInsightsCommand,
@@ -132,6 +138,7 @@ import {
132138
ListGlobalTablesCommandInput,
133139
ListGlobalTablesCommandOutput,
134140
} from "./commands/ListGlobalTablesCommand";
141+
import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
135142
import { ListTablesCommand, ListTablesCommandInput, ListTablesCommandOutput } from "./commands/ListTablesCommand";
136143
import {
137144
ListTagsOfResourceCommand,
@@ -997,6 +1004,40 @@ export class DynamoDB extends DynamoDBClient {
9971004
}
9981005
}
9991006

1007+
/**
1008+
* <p>
1009+
* Represents the properties of the import.
1010+
* </p>
1011+
*/
1012+
public describeImport(
1013+
args: DescribeImportCommandInput,
1014+
options?: __HttpHandlerOptions
1015+
): Promise<DescribeImportCommandOutput>;
1016+
public describeImport(
1017+
args: DescribeImportCommandInput,
1018+
cb: (err: any, data?: DescribeImportCommandOutput) => void
1019+
): void;
1020+
public describeImport(
1021+
args: DescribeImportCommandInput,
1022+
options: __HttpHandlerOptions,
1023+
cb: (err: any, data?: DescribeImportCommandOutput) => void
1024+
): void;
1025+
public describeImport(
1026+
args: DescribeImportCommandInput,
1027+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DescribeImportCommandOutput) => void),
1028+
cb?: (err: any, data?: DescribeImportCommandOutput) => void
1029+
): Promise<DescribeImportCommandOutput> | void {
1030+
const command = new DescribeImportCommand(args);
1031+
if (typeof optionsOrCb === "function") {
1032+
this.send(command, optionsOrCb);
1033+
} else if (typeof cb === "function") {
1034+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1035+
this.send(command, optionsOrCb || {}, cb);
1036+
} else {
1037+
return this.send(command, optionsOrCb);
1038+
}
1039+
}
1040+
10001041
/**
10011042
* <p>Returns information about the status of Kinesis streaming.</p>
10021043
*/
@@ -1460,6 +1501,35 @@ export class DynamoDB extends DynamoDBClient {
14601501
}
14611502
}
14621503

1504+
/**
1505+
* <p>
1506+
* Imports table data from an S3 bucket.
1507+
*
1508+
* </p>
1509+
*/
1510+
public importTable(args: ImportTableCommandInput, options?: __HttpHandlerOptions): Promise<ImportTableCommandOutput>;
1511+
public importTable(args: ImportTableCommandInput, cb: (err: any, data?: ImportTableCommandOutput) => void): void;
1512+
public importTable(
1513+
args: ImportTableCommandInput,
1514+
options: __HttpHandlerOptions,
1515+
cb: (err: any, data?: ImportTableCommandOutput) => void
1516+
): void;
1517+
public importTable(
1518+
args: ImportTableCommandInput,
1519+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ImportTableCommandOutput) => void),
1520+
cb?: (err: any, data?: ImportTableCommandOutput) => void
1521+
): Promise<ImportTableCommandOutput> | void {
1522+
const command = new ImportTableCommand(args);
1523+
if (typeof optionsOrCb === "function") {
1524+
this.send(command, optionsOrCb);
1525+
} else if (typeof cb === "function") {
1526+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1527+
this.send(command, optionsOrCb || {}, cb);
1528+
} else {
1529+
return this.send(command, optionsOrCb);
1530+
}
1531+
}
1532+
14631533
/**
14641534
* <p>List backups associated with an Amazon Web Services account. To list backups for a
14651535
* given table, specify <code>TableName</code>. <code>ListBackups</code> returns a
@@ -1587,6 +1657,34 @@ export class DynamoDB extends DynamoDBClient {
15871657
}
15881658
}
15891659

1660+
/**
1661+
* <p>
1662+
* Lists completed imports within the past 90 days.
1663+
* </p>
1664+
*/
1665+
public listImports(args: ListImportsCommandInput, options?: __HttpHandlerOptions): Promise<ListImportsCommandOutput>;
1666+
public listImports(args: ListImportsCommandInput, cb: (err: any, data?: ListImportsCommandOutput) => void): void;
1667+
public listImports(
1668+
args: ListImportsCommandInput,
1669+
options: __HttpHandlerOptions,
1670+
cb: (err: any, data?: ListImportsCommandOutput) => void
1671+
): void;
1672+
public listImports(
1673+
args: ListImportsCommandInput,
1674+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListImportsCommandOutput) => void),
1675+
cb?: (err: any, data?: ListImportsCommandOutput) => void
1676+
): Promise<ListImportsCommandOutput> | void {
1677+
const command = new ListImportsCommand(args);
1678+
if (typeof optionsOrCb === "function") {
1679+
this.send(command, optionsOrCb);
1680+
} else if (typeof cb === "function") {
1681+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1682+
this.send(command, optionsOrCb || {}, cb);
1683+
} else {
1684+
return this.send(command, optionsOrCb);
1685+
}
1686+
}
1687+
15901688
/**
15911689
* <p>Returns an array of table names associated with the current account and endpoint. The
15921690
* output from <code>ListTables</code> is paginated, with each page returning a maximum of

clients/client-dynamodb/src/DynamoDBClient.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ import {
9393
DescribeGlobalTableSettingsCommandInput,
9494
DescribeGlobalTableSettingsCommandOutput,
9595
} from "./commands/DescribeGlobalTableSettingsCommand";
96+
import { DescribeImportCommandInput, DescribeImportCommandOutput } from "./commands/DescribeImportCommand";
9697
import {
9798
DescribeKinesisStreamingDestinationCommandInput,
9899
DescribeKinesisStreamingDestinationCommandOutput,
@@ -119,13 +120,15 @@ import {
119120
ExportTableToPointInTimeCommandOutput,
120121
} from "./commands/ExportTableToPointInTimeCommand";
121122
import { GetItemCommandInput, GetItemCommandOutput } from "./commands/GetItemCommand";
123+
import { ImportTableCommandInput, ImportTableCommandOutput } from "./commands/ImportTableCommand";
122124
import { ListBackupsCommandInput, ListBackupsCommandOutput } from "./commands/ListBackupsCommand";
123125
import {
124126
ListContributorInsightsCommandInput,
125127
ListContributorInsightsCommandOutput,
126128
} from "./commands/ListContributorInsightsCommand";
127129
import { ListExportsCommandInput, ListExportsCommandOutput } from "./commands/ListExportsCommand";
128130
import { ListGlobalTablesCommandInput, ListGlobalTablesCommandOutput } from "./commands/ListGlobalTablesCommand";
131+
import { ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
129132
import { ListTablesCommandInput, ListTablesCommandOutput } from "./commands/ListTablesCommand";
130133
import { ListTagsOfResourceCommandInput, ListTagsOfResourceCommandOutput } from "./commands/ListTagsOfResourceCommand";
131134
import { PutItemCommandInput, PutItemCommandOutput } from "./commands/PutItemCommand";
@@ -182,6 +185,7 @@ export type ServiceInputTypes =
182185
| DescribeExportCommandInput
183186
| DescribeGlobalTableCommandInput
184187
| DescribeGlobalTableSettingsCommandInput
188+
| DescribeImportCommandInput
185189
| DescribeKinesisStreamingDestinationCommandInput
186190
| DescribeLimitsCommandInput
187191
| DescribeTableCommandInput
@@ -193,10 +197,12 @@ export type ServiceInputTypes =
193197
| ExecuteTransactionCommandInput
194198
| ExportTableToPointInTimeCommandInput
195199
| GetItemCommandInput
200+
| ImportTableCommandInput
196201
| ListBackupsCommandInput
197202
| ListContributorInsightsCommandInput
198203
| ListExportsCommandInput
199204
| ListGlobalTablesCommandInput
205+
| ListImportsCommandInput
200206
| ListTablesCommandInput
201207
| ListTagsOfResourceCommandInput
202208
| PutItemCommandInput
@@ -234,6 +240,7 @@ export type ServiceOutputTypes =
234240
| DescribeExportCommandOutput
235241
| DescribeGlobalTableCommandOutput
236242
| DescribeGlobalTableSettingsCommandOutput
243+
| DescribeImportCommandOutput
237244
| DescribeKinesisStreamingDestinationCommandOutput
238245
| DescribeLimitsCommandOutput
239246
| DescribeTableCommandOutput
@@ -245,10 +252,12 @@ export type ServiceOutputTypes =
245252
| ExecuteTransactionCommandOutput
246253
| ExportTableToPointInTimeCommandOutput
247254
| GetItemCommandOutput
255+
| ImportTableCommandOutput
248256
| ListBackupsCommandOutput
249257
| ListContributorInsightsCommandOutput
250258
| ListExportsCommandOutput
251259
| ListGlobalTablesCommandOutput
260+
| ListImportsCommandOutput
252261
| ListTablesCommandOutput
253262
| ListTagsOfResourceCommandOutput
254263
| PutItemCommandOutput
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import { DynamoDBClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../DynamoDBClient";
16+
import {
17+
DescribeImportInput,
18+
DescribeImportInputFilterSensitiveLog,
19+
DescribeImportOutput,
20+
DescribeImportOutputFilterSensitiveLog,
21+
} from "../models/models_0";
22+
import {
23+
deserializeAws_json1_0DescribeImportCommand,
24+
serializeAws_json1_0DescribeImportCommand,
25+
} from "../protocols/Aws_json1_0";
26+
27+
export interface DescribeImportCommandInput extends DescribeImportInput {}
28+
export interface DescribeImportCommandOutput extends DescribeImportOutput, __MetadataBearer {}
29+
30+
/**
31+
* <p>
32+
* Represents the properties of the import.
33+
* </p>
34+
* @example
35+
* Use a bare-bones client and the command you need to make an API call.
36+
* ```javascript
37+
* import { DynamoDBClient, DescribeImportCommand } from "@aws-sdk/client-dynamodb"; // ES Modules import
38+
* // const { DynamoDBClient, DescribeImportCommand } = require("@aws-sdk/client-dynamodb"); // CommonJS import
39+
* const client = new DynamoDBClient(config);
40+
* const command = new DescribeImportCommand(input);
41+
* const response = await client.send(command);
42+
* ```
43+
*
44+
* @see {@link DescribeImportCommandInput} for command's `input` shape.
45+
* @see {@link DescribeImportCommandOutput} for command's `response` shape.
46+
* @see {@link DynamoDBClientResolvedConfig | config} for DynamoDBClient's `config` shape.
47+
*
48+
*/
49+
export class DescribeImportCommand extends $Command<
50+
DescribeImportCommandInput,
51+
DescribeImportCommandOutput,
52+
DynamoDBClientResolvedConfig
53+
> {
54+
// Start section: command_properties
55+
// End section: command_properties
56+
57+
constructor(readonly input: DescribeImportCommandInput) {
58+
// Start section: command_constructor
59+
super();
60+
// End section: command_constructor
61+
}
62+
63+
/**
64+
* @internal
65+
*/
66+
resolveMiddleware(
67+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
68+
configuration: DynamoDBClientResolvedConfig,
69+
options?: __HttpHandlerOptions
70+
): Handler<DescribeImportCommandInput, DescribeImportCommandOutput> {
71+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
72+
73+
const stack = clientStack.concat(this.middlewareStack);
74+
75+
const { logger } = configuration;
76+
const clientName = "DynamoDBClient";
77+
const commandName = "DescribeImportCommand";
78+
const handlerExecutionContext: HandlerExecutionContext = {
79+
logger,
80+
clientName,
81+
commandName,
82+
inputFilterSensitiveLog: DescribeImportInputFilterSensitiveLog,
83+
outputFilterSensitiveLog: DescribeImportOutputFilterSensitiveLog,
84+
};
85+
const { requestHandler } = configuration;
86+
return stack.resolve(
87+
(request: FinalizeHandlerArguments<any>) =>
88+
requestHandler.handle(request.request as __HttpRequest, options || {}),
89+
handlerExecutionContext
90+
);
91+
}
92+
93+
private serialize(input: DescribeImportCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
94+
return serializeAws_json1_0DescribeImportCommand(input, context);
95+
}
96+
97+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DescribeImportCommandOutput> {
98+
return deserializeAws_json1_0DescribeImportCommand(output, context);
99+
}
100+
101+
// Start section: command_body_extra
102+
// End section: command_body_extra
103+
}

0 commit comments

Comments
 (0)