Skip to content

Commit

Permalink
feat(client-dynamodb): This release adds support for importing data f…
Browse files Browse the repository at this point in the history
…rom S3 into a new DynamoDB table
  • Loading branch information
awstools committed Aug 18, 2022
1 parent a7c0bbd commit 58a3e7a
Show file tree
Hide file tree
Showing 11 changed files with 2,271 additions and 8 deletions.
98 changes: 98 additions & 0 deletions clients/client-dynamodb/src/DynamoDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ import {
DescribeGlobalTableSettingsCommandInput,
DescribeGlobalTableSettingsCommandOutput,
} from "./commands/DescribeGlobalTableSettingsCommand";
import {
DescribeImportCommand,
DescribeImportCommandInput,
DescribeImportCommandOutput,
} from "./commands/DescribeImportCommand";
import {
DescribeKinesisStreamingDestinationCommand,
DescribeKinesisStreamingDestinationCommandInput,
Expand Down Expand Up @@ -120,6 +125,7 @@ import {
ExportTableToPointInTimeCommandOutput,
} from "./commands/ExportTableToPointInTimeCommand";
import { GetItemCommand, GetItemCommandInput, GetItemCommandOutput } from "./commands/GetItemCommand";
import { ImportTableCommand, ImportTableCommandInput, ImportTableCommandOutput } from "./commands/ImportTableCommand";
import { ListBackupsCommand, ListBackupsCommandInput, ListBackupsCommandOutput } from "./commands/ListBackupsCommand";
import {
ListContributorInsightsCommand,
Expand All @@ -132,6 +138,7 @@ import {
ListGlobalTablesCommandInput,
ListGlobalTablesCommandOutput,
} from "./commands/ListGlobalTablesCommand";
import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
import { ListTablesCommand, ListTablesCommandInput, ListTablesCommandOutput } from "./commands/ListTablesCommand";
import {
ListTagsOfResourceCommand,
Expand Down Expand Up @@ -997,6 +1004,40 @@ export class DynamoDB extends DynamoDBClient {
}
}

/**
* <p>
* Represents the properties of the import.
* </p>
*/
public describeImport(
args: DescribeImportCommandInput,
options?: __HttpHandlerOptions
): Promise<DescribeImportCommandOutput>;
public describeImport(
args: DescribeImportCommandInput,
cb: (err: any, data?: DescribeImportCommandOutput) => void
): void;
public describeImport(
args: DescribeImportCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DescribeImportCommandOutput) => void
): void;
public describeImport(
args: DescribeImportCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DescribeImportCommandOutput) => void),
cb?: (err: any, data?: DescribeImportCommandOutput) => void
): Promise<DescribeImportCommandOutput> | void {
const command = new DescribeImportCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Returns information about the status of Kinesis streaming.</p>
*/
Expand Down Expand Up @@ -1460,6 +1501,35 @@ export class DynamoDB extends DynamoDBClient {
}
}

/**
* <p>
* Imports table data from an S3 bucket.
*
* </p>
*/
public importTable(args: ImportTableCommandInput, options?: __HttpHandlerOptions): Promise<ImportTableCommandOutput>;
public importTable(args: ImportTableCommandInput, cb: (err: any, data?: ImportTableCommandOutput) => void): void;
public importTable(
args: ImportTableCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ImportTableCommandOutput) => void
): void;
public importTable(
args: ImportTableCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ImportTableCommandOutput) => void),
cb?: (err: any, data?: ImportTableCommandOutput) => void
): Promise<ImportTableCommandOutput> | void {
const command = new ImportTableCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>List backups associated with an Amazon Web Services account. To list backups for a
* given table, specify <code>TableName</code>. <code>ListBackups</code> returns a
Expand Down Expand Up @@ -1587,6 +1657,34 @@ export class DynamoDB extends DynamoDBClient {
}
}

/**
* <p>
* Lists completed imports within the past 90 days.
* </p>
*/
public listImports(args: ListImportsCommandInput, options?: __HttpHandlerOptions): Promise<ListImportsCommandOutput>;
public listImports(args: ListImportsCommandInput, cb: (err: any, data?: ListImportsCommandOutput) => void): void;
public listImports(
args: ListImportsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListImportsCommandOutput) => void
): void;
public listImports(
args: ListImportsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListImportsCommandOutput) => void),
cb?: (err: any, data?: ListImportsCommandOutput) => void
): Promise<ListImportsCommandOutput> | void {
const command = new ListImportsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Returns an array of table names associated with the current account and endpoint. The
* output from <code>ListTables</code> is paginated, with each page returning a maximum of
Expand Down
9 changes: 9 additions & 0 deletions clients/client-dynamodb/src/DynamoDBClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import {
DescribeGlobalTableSettingsCommandInput,
DescribeGlobalTableSettingsCommandOutput,
} from "./commands/DescribeGlobalTableSettingsCommand";
import { DescribeImportCommandInput, DescribeImportCommandOutput } from "./commands/DescribeImportCommand";
import {
DescribeKinesisStreamingDestinationCommandInput,
DescribeKinesisStreamingDestinationCommandOutput,
Expand All @@ -119,13 +120,15 @@ import {
ExportTableToPointInTimeCommandOutput,
} from "./commands/ExportTableToPointInTimeCommand";
import { GetItemCommandInput, GetItemCommandOutput } from "./commands/GetItemCommand";
import { ImportTableCommandInput, ImportTableCommandOutput } from "./commands/ImportTableCommand";
import { ListBackupsCommandInput, ListBackupsCommandOutput } from "./commands/ListBackupsCommand";
import {
ListContributorInsightsCommandInput,
ListContributorInsightsCommandOutput,
} from "./commands/ListContributorInsightsCommand";
import { ListExportsCommandInput, ListExportsCommandOutput } from "./commands/ListExportsCommand";
import { ListGlobalTablesCommandInput, ListGlobalTablesCommandOutput } from "./commands/ListGlobalTablesCommand";
import { ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
import { ListTablesCommandInput, ListTablesCommandOutput } from "./commands/ListTablesCommand";
import { ListTagsOfResourceCommandInput, ListTagsOfResourceCommandOutput } from "./commands/ListTagsOfResourceCommand";
import { PutItemCommandInput, PutItemCommandOutput } from "./commands/PutItemCommand";
Expand Down Expand Up @@ -182,6 +185,7 @@ export type ServiceInputTypes =
| DescribeExportCommandInput
| DescribeGlobalTableCommandInput
| DescribeGlobalTableSettingsCommandInput
| DescribeImportCommandInput
| DescribeKinesisStreamingDestinationCommandInput
| DescribeLimitsCommandInput
| DescribeTableCommandInput
Expand All @@ -193,10 +197,12 @@ export type ServiceInputTypes =
| ExecuteTransactionCommandInput
| ExportTableToPointInTimeCommandInput
| GetItemCommandInput
| ImportTableCommandInput
| ListBackupsCommandInput
| ListContributorInsightsCommandInput
| ListExportsCommandInput
| ListGlobalTablesCommandInput
| ListImportsCommandInput
| ListTablesCommandInput
| ListTagsOfResourceCommandInput
| PutItemCommandInput
Expand Down Expand Up @@ -234,6 +240,7 @@ export type ServiceOutputTypes =
| DescribeExportCommandOutput
| DescribeGlobalTableCommandOutput
| DescribeGlobalTableSettingsCommandOutput
| DescribeImportCommandOutput
| DescribeKinesisStreamingDestinationCommandOutput
| DescribeLimitsCommandOutput
| DescribeTableCommandOutput
Expand All @@ -245,10 +252,12 @@ export type ServiceOutputTypes =
| ExecuteTransactionCommandOutput
| ExportTableToPointInTimeCommandOutput
| GetItemCommandOutput
| ImportTableCommandOutput
| ListBackupsCommandOutput
| ListContributorInsightsCommandOutput
| ListExportsCommandOutput
| ListGlobalTablesCommandOutput
| ListImportsCommandOutput
| ListTablesCommandOutput
| ListTagsOfResourceCommandOutput
| PutItemCommandOutput
Expand Down
103 changes: 103 additions & 0 deletions clients/client-dynamodb/src/commands/DescribeImportCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// smithy-typescript generated code
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { DynamoDBClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../DynamoDBClient";
import {
DescribeImportInput,
DescribeImportInputFilterSensitiveLog,
DescribeImportOutput,
DescribeImportOutputFilterSensitiveLog,
} from "../models/models_0";
import {
deserializeAws_json1_0DescribeImportCommand,
serializeAws_json1_0DescribeImportCommand,
} from "../protocols/Aws_json1_0";

export interface DescribeImportCommandInput extends DescribeImportInput {}
export interface DescribeImportCommandOutput extends DescribeImportOutput, __MetadataBearer {}

/**
* <p>
* Represents the properties of the import.
* </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { DynamoDBClient, DescribeImportCommand } from "@aws-sdk/client-dynamodb"; // ES Modules import
* // const { DynamoDBClient, DescribeImportCommand } = require("@aws-sdk/client-dynamodb"); // CommonJS import
* const client = new DynamoDBClient(config);
* const command = new DescribeImportCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link DescribeImportCommandInput} for command's `input` shape.
* @see {@link DescribeImportCommandOutput} for command's `response` shape.
* @see {@link DynamoDBClientResolvedConfig | config} for DynamoDBClient's `config` shape.
*
*/
export class DescribeImportCommand extends $Command<
DescribeImportCommandInput,
DescribeImportCommandOutput,
DynamoDBClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: DescribeImportCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: DynamoDBClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DescribeImportCommandInput, DescribeImportCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "DynamoDBClient";
const commandName = "DescribeImportCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: DescribeImportInputFilterSensitiveLog,
outputFilterSensitiveLog: DescribeImportOutputFilterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: DescribeImportCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_json1_0DescribeImportCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DescribeImportCommandOutput> {
return deserializeAws_json1_0DescribeImportCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
Loading

0 comments on commit 58a3e7a

Please sign in to comment.