/
RestoreTableToPointInTimeCommand.ts
416 lines (405 loc) · 16.8 KB
/
RestoreTableToPointInTimeCommand.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
} from "@aws-sdk/types";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { SerdeContext as __SerdeContext } from "@smithy/types";
import { DynamoDBClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../DynamoDBClient";
import { RestoreTableToPointInTimeInput, RestoreTableToPointInTimeOutput } from "../models/models_0";
import { de_RestoreTableToPointInTimeCommand, se_RestoreTableToPointInTimeCommand } from "../protocols/Aws_json1_0";
/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link RestoreTableToPointInTimeCommand}.
*/
export interface RestoreTableToPointInTimeCommandInput extends RestoreTableToPointInTimeInput {}
/**
* @public
*
* The output of {@link RestoreTableToPointInTimeCommand}.
*/
export interface RestoreTableToPointInTimeCommandOutput extends RestoreTableToPointInTimeOutput, __MetadataBearer {}
/**
* @public
* <p>Restores the specified table to the specified point in time within
* <code>EarliestRestorableDateTime</code> and <code>LatestRestorableDateTime</code>.
* You can restore your table to any point in time during the last 35 days. Any number of
* users can execute up to 4 concurrent restores (any type of restore) in a given account. </p>
* <p> When you restore using point in time recovery, DynamoDB restores your table data to
* the state based on the selected date and time (day:hour:minute:second) to a new table. </p>
* <p> Along with data, the following are also included on the new restored table using
* point in time recovery: </p>
* <ul>
* <li>
* <p>Global secondary indexes (GSIs)</p>
* </li>
* <li>
* <p>Local secondary indexes (LSIs)</p>
* </li>
* <li>
* <p>Provisioned read and write capacity</p>
* </li>
* <li>
* <p>Encryption settings</p>
* <important>
* <p> All these settings come from the current settings of the source table at
* the time of restore. </p>
* </important>
* </li>
* </ul>
* <p>You must manually set up the following on the restored table:</p>
* <ul>
* <li>
* <p>Auto scaling policies</p>
* </li>
* <li>
* <p>IAM policies</p>
* </li>
* <li>
* <p>Amazon CloudWatch metrics and alarms</p>
* </li>
* <li>
* <p>Tags</p>
* </li>
* <li>
* <p>Stream settings</p>
* </li>
* <li>
* <p>Time to Live (TTL) settings</p>
* </li>
* <li>
* <p>Point in time recovery settings</p>
* </li>
* </ul>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { DynamoDBClient, RestoreTableToPointInTimeCommand } from "@aws-sdk/client-dynamodb"; // ES Modules import
* // const { DynamoDBClient, RestoreTableToPointInTimeCommand } = require("@aws-sdk/client-dynamodb"); // CommonJS import
* const client = new DynamoDBClient(config);
* const input = { // RestoreTableToPointInTimeInput
* SourceTableArn: "STRING_VALUE",
* SourceTableName: "STRING_VALUE",
* TargetTableName: "STRING_VALUE", // required
* UseLatestRestorableTime: true || false,
* RestoreDateTime: new Date("TIMESTAMP"),
* BillingModeOverride: "PROVISIONED" || "PAY_PER_REQUEST",
* GlobalSecondaryIndexOverride: [ // GlobalSecondaryIndexList
* { // GlobalSecondaryIndex
* IndexName: "STRING_VALUE", // required
* KeySchema: [ // KeySchema // required
* { // KeySchemaElement
* AttributeName: "STRING_VALUE", // required
* KeyType: "HASH" || "RANGE", // required
* },
* ],
* Projection: { // Projection
* ProjectionType: "ALL" || "KEYS_ONLY" || "INCLUDE",
* NonKeyAttributes: [ // NonKeyAttributeNameList
* "STRING_VALUE",
* ],
* },
* ProvisionedThroughput: { // ProvisionedThroughput
* ReadCapacityUnits: Number("long"), // required
* WriteCapacityUnits: Number("long"), // required
* },
* },
* ],
* LocalSecondaryIndexOverride: [ // LocalSecondaryIndexList
* { // LocalSecondaryIndex
* IndexName: "STRING_VALUE", // required
* KeySchema: [ // required
* {
* AttributeName: "STRING_VALUE", // required
* KeyType: "HASH" || "RANGE", // required
* },
* ],
* Projection: {
* ProjectionType: "ALL" || "KEYS_ONLY" || "INCLUDE",
* NonKeyAttributes: [
* "STRING_VALUE",
* ],
* },
* },
* ],
* ProvisionedThroughputOverride: {
* ReadCapacityUnits: Number("long"), // required
* WriteCapacityUnits: Number("long"), // required
* },
* SSESpecificationOverride: { // SSESpecification
* Enabled: true || false,
* SSEType: "AES256" || "KMS",
* KMSMasterKeyId: "STRING_VALUE",
* },
* };
* const command = new RestoreTableToPointInTimeCommand(input);
* const response = await client.send(command);
* // { // RestoreTableToPointInTimeOutput
* // TableDescription: { // TableDescription
* // AttributeDefinitions: [ // AttributeDefinitions
* // { // AttributeDefinition
* // AttributeName: "STRING_VALUE", // required
* // AttributeType: "S" || "N" || "B", // required
* // },
* // ],
* // TableName: "STRING_VALUE",
* // KeySchema: [ // KeySchema
* // { // KeySchemaElement
* // AttributeName: "STRING_VALUE", // required
* // KeyType: "HASH" || "RANGE", // required
* // },
* // ],
* // TableStatus: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE" || "INACCESSIBLE_ENCRYPTION_CREDENTIALS" || "ARCHIVING" || "ARCHIVED",
* // CreationDateTime: new Date("TIMESTAMP"),
* // ProvisionedThroughput: { // ProvisionedThroughputDescription
* // LastIncreaseDateTime: new Date("TIMESTAMP"),
* // LastDecreaseDateTime: new Date("TIMESTAMP"),
* // NumberOfDecreasesToday: Number("long"),
* // ReadCapacityUnits: Number("long"),
* // WriteCapacityUnits: Number("long"),
* // },
* // TableSizeBytes: Number("long"),
* // ItemCount: Number("long"),
* // TableArn: "STRING_VALUE",
* // TableId: "STRING_VALUE",
* // BillingModeSummary: { // BillingModeSummary
* // BillingMode: "PROVISIONED" || "PAY_PER_REQUEST",
* // LastUpdateToPayPerRequestDateTime: new Date("TIMESTAMP"),
* // },
* // LocalSecondaryIndexes: [ // LocalSecondaryIndexDescriptionList
* // { // LocalSecondaryIndexDescription
* // IndexName: "STRING_VALUE",
* // KeySchema: [
* // {
* // AttributeName: "STRING_VALUE", // required
* // KeyType: "HASH" || "RANGE", // required
* // },
* // ],
* // Projection: { // Projection
* // ProjectionType: "ALL" || "KEYS_ONLY" || "INCLUDE",
* // NonKeyAttributes: [ // NonKeyAttributeNameList
* // "STRING_VALUE",
* // ],
* // },
* // IndexSizeBytes: Number("long"),
* // ItemCount: Number("long"),
* // IndexArn: "STRING_VALUE",
* // },
* // ],
* // GlobalSecondaryIndexes: [ // GlobalSecondaryIndexDescriptionList
* // { // GlobalSecondaryIndexDescription
* // IndexName: "STRING_VALUE",
* // KeySchema: [
* // {
* // AttributeName: "STRING_VALUE", // required
* // KeyType: "HASH" || "RANGE", // required
* // },
* // ],
* // Projection: {
* // ProjectionType: "ALL" || "KEYS_ONLY" || "INCLUDE",
* // NonKeyAttributes: [
* // "STRING_VALUE",
* // ],
* // },
* // IndexStatus: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE",
* // Backfilling: true || false,
* // ProvisionedThroughput: {
* // LastIncreaseDateTime: new Date("TIMESTAMP"),
* // LastDecreaseDateTime: new Date("TIMESTAMP"),
* // NumberOfDecreasesToday: Number("long"),
* // ReadCapacityUnits: Number("long"),
* // WriteCapacityUnits: Number("long"),
* // },
* // IndexSizeBytes: Number("long"),
* // ItemCount: Number("long"),
* // IndexArn: "STRING_VALUE",
* // },
* // ],
* // StreamSpecification: { // StreamSpecification
* // StreamEnabled: true || false, // required
* // StreamViewType: "NEW_IMAGE" || "OLD_IMAGE" || "NEW_AND_OLD_IMAGES" || "KEYS_ONLY",
* // },
* // LatestStreamLabel: "STRING_VALUE",
* // LatestStreamArn: "STRING_VALUE",
* // GlobalTableVersion: "STRING_VALUE",
* // Replicas: [ // ReplicaDescriptionList
* // { // ReplicaDescription
* // RegionName: "STRING_VALUE",
* // ReplicaStatus: "CREATING" || "CREATION_FAILED" || "UPDATING" || "DELETING" || "ACTIVE" || "REGION_DISABLED" || "INACCESSIBLE_ENCRYPTION_CREDENTIALS",
* // ReplicaStatusDescription: "STRING_VALUE",
* // ReplicaStatusPercentProgress: "STRING_VALUE",
* // KMSMasterKeyId: "STRING_VALUE",
* // ProvisionedThroughputOverride: { // ProvisionedThroughputOverride
* // ReadCapacityUnits: Number("long"),
* // },
* // GlobalSecondaryIndexes: [ // ReplicaGlobalSecondaryIndexDescriptionList
* // { // ReplicaGlobalSecondaryIndexDescription
* // IndexName: "STRING_VALUE",
* // ProvisionedThroughputOverride: {
* // ReadCapacityUnits: Number("long"),
* // },
* // },
* // ],
* // ReplicaInaccessibleDateTime: new Date("TIMESTAMP"),
* // ReplicaTableClassSummary: { // TableClassSummary
* // TableClass: "STANDARD" || "STANDARD_INFREQUENT_ACCESS",
* // LastUpdateDateTime: new Date("TIMESTAMP"),
* // },
* // },
* // ],
* // RestoreSummary: { // RestoreSummary
* // SourceBackupArn: "STRING_VALUE",
* // SourceTableArn: "STRING_VALUE",
* // RestoreDateTime: new Date("TIMESTAMP"), // required
* // RestoreInProgress: true || false, // required
* // },
* // SSEDescription: { // SSEDescription
* // Status: "ENABLING" || "ENABLED" || "DISABLING" || "DISABLED" || "UPDATING",
* // SSEType: "AES256" || "KMS",
* // KMSMasterKeyArn: "STRING_VALUE",
* // InaccessibleEncryptionDateTime: new Date("TIMESTAMP"),
* // },
* // ArchivalSummary: { // ArchivalSummary
* // ArchivalDateTime: new Date("TIMESTAMP"),
* // ArchivalReason: "STRING_VALUE",
* // ArchivalBackupArn: "STRING_VALUE",
* // },
* // TableClassSummary: {
* // TableClass: "STANDARD" || "STANDARD_INFREQUENT_ACCESS",
* // LastUpdateDateTime: new Date("TIMESTAMP"),
* // },
* // DeletionProtectionEnabled: true || false,
* // },
* // };
*
* ```
*
* @param RestoreTableToPointInTimeCommandInput - {@link RestoreTableToPointInTimeCommandInput}
* @returns {@link RestoreTableToPointInTimeCommandOutput}
* @see {@link RestoreTableToPointInTimeCommandInput} for command's `input` shape.
* @see {@link RestoreTableToPointInTimeCommandOutput} for command's `response` shape.
* @see {@link DynamoDBClientResolvedConfig | config} for DynamoDBClient's `config` shape.
*
* @throws {@link InternalServerError} (server fault)
* <p>An error occurred on the server side.</p>
*
* @throws {@link InvalidEndpointException} (client fault)
*
* @throws {@link InvalidRestoreTimeException} (client fault)
* <p>An invalid restore time was specified. RestoreDateTime must be between
* EarliestRestorableDateTime and LatestRestorableDateTime.</p>
*
* @throws {@link LimitExceededException} (client fault)
* <p>There is no limit to the number of daily on-demand backups that can be taken. </p>
* <p>For most purposes, up to 500 simultaneous table operations are allowed per account. These operations
* include <code>CreateTable</code>, <code>UpdateTable</code>,
* <code>DeleteTable</code>,<code>UpdateTimeToLive</code>,
* <code>RestoreTableFromBackup</code>, and <code>RestoreTableToPointInTime</code>. </p>
* <p>When you are creating a table with one or more secondary
* indexes, you can have up to 250 such requests running at a time. However, if the table or
* index specifications are complex, then DynamoDB might temporarily reduce the number
* of concurrent operations.</p>
* <p>When importing into DynamoDB, up to 50 simultaneous import table operations are allowed per account.</p>
* <p>There is a soft account quota of 2,500 tables.</p>
*
* @throws {@link PointInTimeRecoveryUnavailableException} (client fault)
* <p>Point in time recovery has not yet been enabled for this source table.</p>
*
* @throws {@link TableAlreadyExistsException} (client fault)
* <p>A target table with the specified name already exists. </p>
*
* @throws {@link TableInUseException} (client fault)
* <p>A target table with the specified name is either being created or deleted.
* </p>
*
* @throws {@link TableNotFoundException} (client fault)
* <p>A source table with the name <code>TableName</code> does not currently exist within
* the subscriber's account or the subscriber is operating in the wrong Amazon Web Services Region.</p>
*
* @throws {@link DynamoDBServiceException}
* <p>Base exception class for all service exceptions from DynamoDB service.</p>
*
*/
export class RestoreTableToPointInTimeCommand extends $Command<
RestoreTableToPointInTimeCommandInput,
RestoreTableToPointInTimeCommandOutput,
DynamoDBClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}
/**
* @public
*/
constructor(readonly input: RestoreTableToPointInTimeCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}
/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: DynamoDBClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<RestoreTableToPointInTimeCommandInput, RestoreTableToPointInTimeCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, RestoreTableToPointInTimeCommand.getEndpointParameterInstructions())
);
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "DynamoDBClient";
const commandName = "RestoreTableToPointInTimeCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}
/**
* @internal
*/
private serialize(input: RestoreTableToPointInTimeCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_RestoreTableToPointInTimeCommand(input, context);
}
/**
* @internal
*/
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<RestoreTableToPointInTimeCommandOutput> {
return de_RestoreTableToPointInTimeCommand(output, context);
}
// Start section: command_body_extra
// End section: command_body_extra
}