Skip to content

Commit c96da51

Browse files
author
awstools
committedDec 3, 2024
feat(client-dynamodb): This change adds support for global tables with multi-Region strong consistency (in preview). The UpdateTable API now supports a new attribute MultiRegionConsistency to set consistency when creating global tables. The DescribeTable output now optionally includes the MultiRegionConsistency attribute.
1 parent 40ef36d commit c96da51

13 files changed

+167
-3
lines changed
 

‎clients/client-dynamodb/src/commands/CreateTableCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ export interface CreateTableCommandOutput extends CreateTableOutput, __MetadataB
310310
* // WriteUnitsPerSecond: Number("long"),
311311
* // Status: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE" || "INACCESSIBLE_ENCRYPTION_CREDENTIALS" || "ARCHIVING" || "ARCHIVED",
312312
* // },
313+
* // MultiRegionConsistency: "EVENTUAL" || "STRONG",
313314
* // },
314315
* // };
315316
*

‎clients/client-dynamodb/src/commands/DeleteItemCommand.ts

+3
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ export interface DeleteItemCommandOutput extends DeleteItemOutput, __MetadataBea
224224
* successful, unless your retry queue is too large to finish. Reduce the frequency of
225225
* requests and use exponential backoff. For more information, go to <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff">Error Retries and Exponential Backoff</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
226226
*
227+
* @throws {@link ReplicatedWriteConflictException} (client fault)
228+
* <p>The request was rejected because one or more items in the request are being modified by a request in another Region. </p>
229+
*
227230
* @throws {@link RequestLimitExceeded} (client fault)
228231
* <p>Throughput exceeds the current throughput quota for your account. Please contact
229232
* <a href="https://aws.amazon.com/support">Amazon Web Services Support</a> to request a

‎clients/client-dynamodb/src/commands/DeleteTableCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ export interface DeleteTableCommandOutput extends DeleteTableOutput, __MetadataB
231231
* // WriteUnitsPerSecond: Number("long"),
232232
* // Status: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE" || "INACCESSIBLE_ENCRYPTION_CREDENTIALS" || "ARCHIVING" || "ARCHIVED",
233233
* // },
234+
* // MultiRegionConsistency: "EVENTUAL" || "STRONG",
234235
* // },
235236
* // };
236237
*

‎clients/client-dynamodb/src/commands/DescribeTableCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ export interface DescribeTableCommandOutput extends DescribeTableOutput, __Metad
222222
* // WriteUnitsPerSecond: Number("long"),
223223
* // Status: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE" || "INACCESSIBLE_ENCRYPTION_CREDENTIALS" || "ARCHIVING" || "ARCHIVED",
224224
* // },
225+
* // MultiRegionConsistency: "EVENTUAL" || "STRONG",
225226
* // },
226227
* // };
227228
*

‎clients/client-dynamodb/src/commands/PutItemCommand.ts

+3
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ export interface PutItemCommandOutput extends PutItemOutput, __MetadataBearer {}
234234
* successful, unless your retry queue is too large to finish. Reduce the frequency of
235235
* requests and use exponential backoff. For more information, go to <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff">Error Retries and Exponential Backoff</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
236236
*
237+
* @throws {@link ReplicatedWriteConflictException} (client fault)
238+
* <p>The request was rejected because one or more items in the request are being modified by a request in another Region. </p>
239+
*
237240
* @throws {@link RequestLimitExceeded} (client fault)
238241
* <p>Throughput exceeds the current throughput quota for your account. Please contact
239242
* <a href="https://aws.amazon.com/support">Amazon Web Services Support</a> to request a

‎clients/client-dynamodb/src/commands/RestoreTableFromBackupCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ export interface RestoreTableFromBackupCommandOutput extends RestoreTableFromBac
294294
* // WriteUnitsPerSecond: Number("long"),
295295
* // Status: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE" || "INACCESSIBLE_ENCRYPTION_CREDENTIALS" || "ARCHIVING" || "ARCHIVED",
296296
* // },
297+
* // MultiRegionConsistency: "EVENTUAL" || "STRONG",
297298
* // },
298299
* // };
299300
*

‎clients/client-dynamodb/src/commands/RestoreTableToPointInTimeCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ export interface RestoreTableToPointInTimeCommandOutput extends RestoreTableToPo
322322
* // WriteUnitsPerSecond: Number("long"),
323323
* // Status: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE" || "INACCESSIBLE_ENCRYPTION_CREDENTIALS" || "ARCHIVING" || "ARCHIVED",
324324
* // },
325+
* // MultiRegionConsistency: "EVENTUAL" || "STRONG",
325326
* // },
326327
* // };
327328
*

‎clients/client-dynamodb/src/commands/UpdateItemCommand.ts

+3
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ export interface UpdateItemCommandOutput extends UpdateItemOutput, __MetadataBea
227227
* successful, unless your retry queue is too large to finish. Reduce the frequency of
228228
* requests and use exponential backoff. For more information, go to <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff">Error Retries and Exponential Backoff</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
229229
*
230+
* @throws {@link ReplicatedWriteConflictException} (client fault)
231+
* <p>The request was rejected because one or more items in the request are being modified by a request in another Region. </p>
232+
*
230233
* @throws {@link RequestLimitExceeded} (client fault)
231234
* <p>Throughput exceeds the current throughput quota for your account. Please contact
232235
* <a href="https://aws.amazon.com/support">Amazon Web Services Support</a> to request a

‎clients/client-dynamodb/src/commands/UpdateTableCommand.ts

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export interface UpdateTableCommandOutput extends UpdateTableOutput, __MetadataB
184184
* ],
185185
* TableClass: "STANDARD" || "STANDARD_INFREQUENT_ACCESS",
186186
* DeletionProtectionEnabled: true || false,
187+
* MultiRegionConsistency: "EVENTUAL" || "STRONG",
187188
* OnDemandThroughput: {
188189
* MaxReadRequestUnits: Number("long"),
189190
* MaxWriteRequestUnits: Number("long"),
@@ -364,6 +365,7 @@ export interface UpdateTableCommandOutput extends UpdateTableOutput, __MetadataB
364365
* // WriteUnitsPerSecond: Number("long"),
365366
* // Status: "CREATING" || "UPDATING" || "DELETING" || "ACTIVE" || "INACCESSIBLE_ENCRYPTION_CREDENTIALS" || "ARCHIVING" || "ARCHIVED",
366367
* // },
368+
* // MultiRegionConsistency: "EVENTUAL" || "STRONG",
367369
* // },
368370
* // };
369371
*

‎clients/client-dynamodb/src/endpoint/ruleset.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ D=[k],
4747
E=[l],
4848
F=[n],
4949
G=[o,{[J]:g,[K]:[p,"disabled"]}];
50-
const _data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i,AccountId:i,AccountIdEndpointMode:i},rules:[{conditions:[{[J]:b,[K]:[{[L]:"Endpoint"}]}],rules:[{conditions:D,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[I]:c},{conditions:E,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[I]:c},{endpoint:{[M]:"{Endpoint}",[N]:m,[O]:m},[I]:d}],[I]:e},{conditions:[{[J]:b,[K]:F}],rules:[{conditions:[{[J]:"aws.partition",[K]:F,assign:f}],rules:[{conditions:[{[J]:g,[K]:[n,"local"]}],rules:[{conditions:D,error:"Invalid Configuration: FIPS and local endpoint are not supported",[I]:c},{conditions:E,error:"Invalid Configuration: Dualstack and local endpoint are not supported",[I]:c},{endpoint:{[M]:"http://localhost:8000",[N]:{authSchemes:[{name:"sigv4",signingName:"dynamodb",signingRegion:"us-east-1"}]},[O]:m},[I]:d}],[I]:e},{conditions:[o,{[J]:g,[K]:[p,"required"]},{[J]:h,[K]:[q]}],error:"AccountIdEndpointMode is required but no AccountID was provided or able to be loaded.",[I]:c},{conditions:[q,s,u,v,{[J]:h,[K]:[{[J]:"isValidHostLabel",[K]:[r,a]}]}],error:"Credentials-sourced account ID parameter is invalid",[I]:c},{conditions:[k,l],rules:[{conditions:[w,x],rules:[{conditions:G,endpoint:y,[I]:d},{endpoint:y,[I]:d}],[I]:e},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[I]:c}],[I]:e},{conditions:D,rules:[{conditions:[w],rules:[{conditions:[{[J]:g,[K]:[t,"aws-us-gov"]}],rules:[z,A],[I]:e},{conditions:G,endpoint:B,[I]:d},{endpoint:B,[I]:d}],[I]:e},{error:"FIPS is enabled but this partition does not support FIPS",[I]:c}],[I]:e},{conditions:E,rules:[{conditions:[x],rules:[{conditions:G,endpoint:C,[I]:d},{endpoint:C,[I]:d}],[I]:e},{error:"DualStack is enabled but this partition does not support DualStack",[I]:c}],[I]:e},z,{conditions:[q,s,u,v],endpoint:{[M]:"https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",[N]:m,[O]:m},[I]:d},A],[I]:e}],[I]:e},{error:"Invalid Configuration: Missing Region",[I]:c}]};
50+
const _data={version:"1.0",parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i,AccountId:i,AccountIdEndpointMode:i},rules:[{conditions:[{[J]:b,[K]:[{[L]:"Endpoint"}]}],rules:[{conditions:D,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[I]:c},{conditions:E,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[I]:c},{endpoint:{[M]:"{Endpoint}",[N]:m,[O]:m},[I]:d}],[I]:e},{conditions:[{[J]:b,[K]:F}],rules:[{conditions:[{[J]:"aws.partition",[K]:F,assign:f}],rules:[{conditions:[{[J]:g,[K]:[n,"local"]}],rules:[{conditions:D,error:"Invalid Configuration: FIPS and local endpoint are not supported",[I]:c},{conditions:E,error:"Invalid Configuration: Dualstack and local endpoint are not supported",[I]:c},{endpoint:{[M]:"http://localhost:8000",[N]:{authSchemes:[{signingRegion:"us-east-1",signingName:"dynamodb",name:"sigv4"}]},[O]:m},[I]:d}],[I]:e},{conditions:[o,{[J]:g,[K]:[p,"required"]},{[J]:h,[K]:[q]}],error:"AccountIdEndpointMode is required but no AccountID was provided or able to be loaded.",[I]:c},{conditions:[q,s,u,v,{[J]:h,[K]:[{[J]:"isValidHostLabel",[K]:[r,a]}]}],error:"Credentials-sourced account ID parameter is invalid",[I]:c},{conditions:[k,l],rules:[{conditions:[w,x],rules:[{conditions:G,endpoint:y,[I]:d},{endpoint:y,[I]:d}],[I]:e},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[I]:c}],[I]:e},{conditions:D,rules:[{conditions:[w],rules:[{conditions:[{[J]:g,[K]:[t,"aws-us-gov"]}],rules:[z,A],[I]:e},{conditions:G,endpoint:B,[I]:d},{endpoint:B,[I]:d}],[I]:e},{error:"FIPS is enabled but this partition does not support FIPS",[I]:c}],[I]:e},{conditions:E,rules:[{conditions:[x],rules:[{conditions:G,endpoint:C,[I]:d},{endpoint:C,[I]:d}],[I]:e},{error:"DualStack is enabled but this partition does not support DualStack",[I]:c}],[I]:e},z,{conditions:[q,s,u,v],endpoint:{[M]:"https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",[N]:m,[O]:m},[I]:d},A],[I]:e}],[I]:e},{error:"Invalid Configuration: Missing Region",[I]:c}]};
5151
export const ruleSet: RuleSetObject = _data;

‎clients/client-dynamodb/src/models/models_0.ts

+75
Original file line numberDiff line numberDiff line change
@@ -3143,6 +3143,20 @@ export interface LocalSecondaryIndexDescription {
31433143
IndexArn?: string | undefined;
31443144
}
31453145

3146+
/**
3147+
* @public
3148+
* @enum
3149+
*/
3150+
export const MultiRegionConsistency = {
3151+
EVENTUAL: "EVENTUAL",
3152+
STRONG: "STRONG",
3153+
} as const;
3154+
3155+
/**
3156+
* @public
3157+
*/
3158+
export type MultiRegionConsistency = (typeof MultiRegionConsistency)[keyof typeof MultiRegionConsistency];
3159+
31463160
/**
31473161
* <p>Contains details for the restore.</p>
31483162
* @public
@@ -3612,6 +3626,26 @@ export interface TableDescription {
36123626
* @public
36133627
*/
36143628
WarmThroughput?: TableWarmThroughputDescription | undefined;
3629+
3630+
/**
3631+
* <p>Indicates one of the following consistency modes for a global table:</p>
3632+
* <ul>
3633+
* <li>
3634+
* <p>
3635+
* <code>EVENTUAL</code>: Indicates that the global table is configured for multi-Region eventual consistency.</p>
3636+
* </li>
3637+
* <li>
3638+
* <p>
3639+
* <code>STRONG</code>: Indicates that the global table is configured for multi-Region strong consistency (preview).</p>
3640+
* <note>
3641+
* <p>Multi-Region strong consistency (MRSC) is a new DynamoDB global tables capability currently available in preview mode. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/PreviewFeatures.html#multi-region-strong-consistency-gt">Global tables multi-Region strong consistency</a>.</p>
3642+
* </note>
3643+
* </li>
3644+
* </ul>
3645+
* <p>If you don't specify this field, the global table consistency mode defaults to <code>EVENTUAL</code>.</p>
3646+
* @public
3647+
*/
3648+
MultiRegionConsistency?: MultiRegionConsistency | undefined;
36153649
}
36163650

36173651
/**
@@ -3730,6 +3764,26 @@ export const ReturnValue = {
37303764
*/
37313765
export type ReturnValue = (typeof ReturnValue)[keyof typeof ReturnValue];
37323766

3767+
/**
3768+
* <p>The request was rejected because one or more items in the request are being modified by a request in another Region. </p>
3769+
* @public
3770+
*/
3771+
export class ReplicatedWriteConflictException extends __BaseException {
3772+
readonly name: "ReplicatedWriteConflictException" = "ReplicatedWriteConflictException";
3773+
readonly $fault: "client" = "client";
3774+
/**
3775+
* @internal
3776+
*/
3777+
constructor(opts: __ExceptionOptionType<ReplicatedWriteConflictException, __BaseException>) {
3778+
super({
3779+
name: "ReplicatedWriteConflictException",
3780+
$fault: "client",
3781+
...opts,
3782+
});
3783+
Object.setPrototypeOf(this, ReplicatedWriteConflictException.prototype);
3784+
}
3785+
}
3786+
37333787
/**
37343788
* <p>Operation was rejected because there is an ongoing transaction for the
37353789
* item.</p>
@@ -7228,6 +7282,27 @@ export interface UpdateTableInput {
72287282
*/
72297283
DeletionProtectionEnabled?: boolean | undefined;
72307284

7285+
/**
7286+
* <p>Specifies the consistency mode for a new global table. This parameter is only valid when you create a global table by specifying one or more <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ReplicationGroupUpdate.html#DDB-Type-ReplicationGroupUpdate-Create">Create</a> actions in the <a href="https://docs.aws.amazon.com/https:/docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html#DDB-UpdateTable-request-ReplicaUpdates">ReplicaUpdates</a> action list.</p>
7287+
* <p>You can specify one of the following consistency modes:</p>
7288+
* <ul>
7289+
* <li>
7290+
* <p>
7291+
* <code>EVENTUAL</code>: Configures a new global table for multi-Region eventual consistency. This is the default consistency mode for global tables.</p>
7292+
* </li>
7293+
* <li>
7294+
* <p>
7295+
* <code>STRONG</code>: Configures a new global table for multi-Region strong consistency (preview).</p>
7296+
* <note>
7297+
* <p>Multi-Region strong consistency (MRSC) is a new DynamoDB global tables capability currently available in preview mode. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/PreviewFeatures.html#multi-region-strong-consistency-gt">Global tables multi-Region strong consistency</a>.</p>
7298+
* </note>
7299+
* </li>
7300+
* </ul>
7301+
* <p>If you don't specify this parameter, the global table consistency mode defaults to <code>EVENTUAL</code>.</p>
7302+
* @public
7303+
*/
7304+
MultiRegionConsistency?: MultiRegionConsistency | undefined;
7305+
72317306
/**
72327307
* <p>Updates the maximum number of read and write units for the specified table in
72337308
* on-demand capacity mode. If you use this parameter, you must specify

‎clients/client-dynamodb/src/protocols/Aws_json1_0.ts

+23
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ import {
310310
ReplicaNotFoundException,
311311
ReplicaSettingsDescription,
312312
ReplicaSettingsUpdate,
313+
ReplicatedWriteConflictException,
313314
ReplicationGroupUpdate,
314315
ReplicaUpdate,
315316
RequestLimitExceeded,
@@ -2289,6 +2290,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext):
22892290
case "ConditionalCheckFailedException":
22902291
case "com.amazonaws.dynamodb#ConditionalCheckFailedException":
22912292
throw await de_ConditionalCheckFailedExceptionRes(parsedOutput, context);
2293+
case "ReplicatedWriteConflictException":
2294+
case "com.amazonaws.dynamodb#ReplicatedWriteConflictException":
2295+
throw await de_ReplicatedWriteConflictExceptionRes(parsedOutput, context);
22922296
case "TransactionConflictException":
22932297
case "com.amazonaws.dynamodb#TransactionConflictException":
22942298
throw await de_TransactionConflictExceptionRes(parsedOutput, context);
@@ -2734,6 +2738,22 @@ const de_ReplicaNotFoundExceptionRes = async (
27342738
return __decorateServiceException(exception, body);
27352739
};
27362740

2741+
/**
2742+
* deserializeAws_json1_0ReplicatedWriteConflictExceptionRes
2743+
*/
2744+
const de_ReplicatedWriteConflictExceptionRes = async (
2745+
parsedOutput: any,
2746+
context: __SerdeContext
2747+
): Promise<ReplicatedWriteConflictException> => {
2748+
const body = parsedOutput.body;
2749+
const deserialized: any = _json(body);
2750+
const exception = new ReplicatedWriteConflictException({
2751+
$metadata: deserializeMetadata(parsedOutput),
2752+
...deserialized,
2753+
});
2754+
return __decorateServiceException(exception, body);
2755+
};
2756+
27372757
/**
27382758
* deserializeAws_json1_0RequestLimitExceededRes
27392759
*/
@@ -5305,6 +5325,8 @@ const de_ReplicaSettingsDescriptionList = (output: any, context: __SerdeContext)
53055325
return retVal;
53065326
};
53075327

5328+
// de_ReplicatedWriteConflictException omitted.
5329+
53085330
// de_RequestLimitExceeded omitted.
53095331

53105332
// de_ResourceInUseException omitted.
@@ -5460,6 +5482,7 @@ const de_TableDescription = (output: any, context: __SerdeContext): TableDescrip
54605482
LatestStreamArn: __expectString,
54615483
LatestStreamLabel: __expectString,
54625484
LocalSecondaryIndexes: _json,
5485+
MultiRegionConsistency: __expectString,
54635486
OnDemandThroughput: _json,
54645487
ProvisionedThroughput: (_: any) => de_ProvisionedThroughputDescription(_, context),
54655488
Replicas: (_: any) => de_ReplicaDescriptionList(_, context),

0 commit comments

Comments
 (0)
Please sign in to comment.