Skip to content

Commit 4f4fe94

Browse files
Update generated code (#1813)
update generated code
1 parent f909f85 commit 4f4fe94

11 files changed

+129
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Added
6+
7+
- AWS api-change: 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.
8+
59
## 3.3.1
610

711
### Changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"extra": {
3434
"branch-alias": {
35-
"dev-master": "3.3-dev"
35+
"dev-master": "3.4-dev"
3636
}
3737
}
3838
}

src/DynamoDbClient.php

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use AsyncAws\Core\RequestContext;
1010
use AsyncAws\DynamoDb\Enum\BillingMode;
1111
use AsyncAws\DynamoDb\Enum\ConditionalOperator;
12+
use AsyncAws\DynamoDb\Enum\MultiRegionConsistency;
1213
use AsyncAws\DynamoDb\Enum\ReturnConsumedCapacity;
1314
use AsyncAws\DynamoDb\Enum\ReturnItemCollectionMetrics;
1415
use AsyncAws\DynamoDb\Enum\ReturnValue;
@@ -22,6 +23,7 @@
2223
use AsyncAws\DynamoDb\Exception\ItemCollectionSizeLimitExceededException;
2324
use AsyncAws\DynamoDb\Exception\LimitExceededException;
2425
use AsyncAws\DynamoDb\Exception\ProvisionedThroughputExceededException;
26+
use AsyncAws\DynamoDb\Exception\ReplicatedWriteConflictException;
2527
use AsyncAws\DynamoDb\Exception\RequestLimitExceededException;
2628
use AsyncAws\DynamoDb\Exception\ResourceInUseException;
2729
use AsyncAws\DynamoDb\Exception\ResourceNotFoundException;
@@ -345,6 +347,7 @@ public function createTable($input): CreateTableOutput
345347
* @throws TransactionConflictException
346348
* @throws RequestLimitExceededException
347349
* @throws InternalServerErrorException
350+
* @throws ReplicatedWriteConflictException
348351
*/
349352
public function deleteItem($input): DeleteItemOutput
350353
{
@@ -357,6 +360,7 @@ public function deleteItem($input): DeleteItemOutput
357360
'TransactionConflictException' => TransactionConflictException::class,
358361
'RequestLimitExceeded' => RequestLimitExceededException::class,
359362
'InternalServerError' => InternalServerErrorException::class,
363+
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
360364
], 'usesEndpointDiscovery' => true]));
361365

362366
return new DeleteItemOutput($response);
@@ -630,6 +634,7 @@ public function listTables($input = []): ListTablesOutput
630634
* @throws TransactionConflictException
631635
* @throws RequestLimitExceededException
632636
* @throws InternalServerErrorException
637+
* @throws ReplicatedWriteConflictException
633638
*/
634639
public function putItem($input): PutItemOutput
635640
{
@@ -642,6 +647,7 @@ public function putItem($input): PutItemOutput
642647
'TransactionConflictException' => TransactionConflictException::class,
643648
'RequestLimitExceeded' => RequestLimitExceededException::class,
644649
'InternalServerError' => InternalServerErrorException::class,
650+
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
645651
], 'usesEndpointDiscovery' => true]));
646652

647653
return new PutItemOutput($response);
@@ -953,6 +959,7 @@ public function transactWriteItems($input): TransactWriteItemsOutput
953959
* @throws TransactionConflictException
954960
* @throws RequestLimitExceededException
955961
* @throws InternalServerErrorException
962+
* @throws ReplicatedWriteConflictException
956963
*/
957964
public function updateItem($input): UpdateItemOutput
958965
{
@@ -965,6 +972,7 @@ public function updateItem($input): UpdateItemOutput
965972
'TransactionConflictException' => TransactionConflictException::class,
966973
'RequestLimitExceeded' => RequestLimitExceededException::class,
967974
'InternalServerError' => InternalServerErrorException::class,
975+
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
968976
], 'usesEndpointDiscovery' => true]));
969977

970978
return new UpdateItemOutput($response);
@@ -1001,6 +1009,7 @@ public function updateItem($input): UpdateItemOutput
10011009
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
10021010
* TableClass?: null|TableClass::*,
10031011
* DeletionProtectionEnabled?: null|bool,
1012+
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
10041013
* OnDemandThroughput?: null|OnDemandThroughput|array,
10051014
* WarmThroughput?: null|WarmThroughput|array,
10061015
* '@region'?: string|null,

src/Enum/MultiRegionConsistency.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace AsyncAws\DynamoDb\Enum;
4+
5+
final class MultiRegionConsistency
6+
{
7+
public const EVENTUAL = 'EVENTUAL';
8+
public const STRONG = 'STRONG';
9+
10+
public static function exists(string $value): bool
11+
{
12+
return isset([
13+
self::EVENTUAL => true,
14+
self::STRONG => true,
15+
][$value]);
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace AsyncAws\DynamoDb\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
7+
/**
8+
* The request was rejected because one or more items in the request are being modified by a request in another Region.
9+
*/
10+
final class ReplicatedWriteConflictException extends ClientException
11+
{
12+
}

src/Input/UpdateTableInput.php

+52
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use AsyncAws\Core\Request;
88
use AsyncAws\Core\Stream\StreamFactory;
99
use AsyncAws\DynamoDb\Enum\BillingMode;
10+
use AsyncAws\DynamoDb\Enum\MultiRegionConsistency;
1011
use AsyncAws\DynamoDb\Enum\TableClass;
1112
use AsyncAws\DynamoDb\ValueObject\AttributeDefinition;
1213
use AsyncAws\DynamoDb\ValueObject\GlobalSecondaryIndexUpdate;
@@ -123,6 +124,30 @@ final class UpdateTableInput extends Input
123124
*/
124125
private $deletionProtectionEnabled;
125126

127+
/**
128+
* Specifies the consistency mode for a new global table. This parameter is only valid when you create a global table by
129+
* specifying one or more Create [^1] actions in the ReplicaUpdates [^2] action list.
130+
*
131+
* You can specify one of the following consistency modes:
132+
*
133+
* - `EVENTUAL`: Configures a new global table for multi-Region eventual consistency. This is the default consistency
134+
* mode for global tables.
135+
* - `STRONG`: Configures a new global table for multi-Region strong consistency (preview).
136+
*
137+
* > Multi-Region strong consistency (MRSC) is a new DynamoDB global tables capability currently available in preview
138+
* > mode. For more information, see Global tables multi-Region strong consistency [^3].
139+
*
140+
*
141+
* If you don't specify this parameter, the global table consistency mode defaults to `EVENTUAL`.
142+
*
143+
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ReplicationGroupUpdate.html#DDB-Type-ReplicationGroupUpdate-Create
144+
* [^2]: https://docs.aws.amazon.com/https:/docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html#DDB-UpdateTable-request-ReplicaUpdates
145+
* [^3]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/PreviewFeatures.html#multi-region-strong-consistency-gt
146+
*
147+
* @var MultiRegionConsistency::*|null
148+
*/
149+
private $multiRegionConsistency;
150+
126151
/**
127152
* Updates the maximum number of read and write units for the specified table in on-demand capacity mode. If you use
128153
* this parameter, you must specify `MaxReadRequestUnits`, `MaxWriteRequestUnits`, or both.
@@ -150,6 +175,7 @@ final class UpdateTableInput extends Input
150175
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
151176
* TableClass?: null|TableClass::*,
152177
* DeletionProtectionEnabled?: null|bool,
178+
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
153179
* OnDemandThroughput?: null|OnDemandThroughput|array,
154180
* WarmThroughput?: null|WarmThroughput|array,
155181
* '@region'?: string|null,
@@ -167,6 +193,7 @@ public function __construct(array $input = [])
167193
$this->replicaUpdates = isset($input['ReplicaUpdates']) ? array_map([ReplicationGroupUpdate::class, 'create'], $input['ReplicaUpdates']) : null;
168194
$this->tableClass = $input['TableClass'] ?? null;
169195
$this->deletionProtectionEnabled = $input['DeletionProtectionEnabled'] ?? null;
196+
$this->multiRegionConsistency = $input['MultiRegionConsistency'] ?? null;
170197
$this->onDemandThroughput = isset($input['OnDemandThroughput']) ? OnDemandThroughput::create($input['OnDemandThroughput']) : null;
171198
$this->warmThroughput = isset($input['WarmThroughput']) ? WarmThroughput::create($input['WarmThroughput']) : null;
172199
parent::__construct($input);
@@ -184,6 +211,7 @@ public function __construct(array $input = [])
184211
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
185212
* TableClass?: null|TableClass::*,
186213
* DeletionProtectionEnabled?: null|bool,
214+
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
187215
* OnDemandThroughput?: null|OnDemandThroughput|array,
188216
* WarmThroughput?: null|WarmThroughput|array,
189217
* '@region'?: string|null,
@@ -223,6 +251,14 @@ public function getGlobalSecondaryIndexUpdates(): array
223251
return $this->globalSecondaryIndexUpdates ?? [];
224252
}
225253

254+
/**
255+
* @return MultiRegionConsistency::*|null
256+
*/
257+
public function getMultiRegionConsistency(): ?string
258+
{
259+
return $this->multiRegionConsistency;
260+
}
261+
226262
public function getOnDemandThroughput(): ?OnDemandThroughput
227263
{
228264
return $this->onDemandThroughput;
@@ -332,6 +368,16 @@ public function setGlobalSecondaryIndexUpdates(array $value): self
332368
return $this;
333369
}
334370

371+
/**
372+
* @param MultiRegionConsistency::*|null $value
373+
*/
374+
public function setMultiRegionConsistency(?string $value): self
375+
{
376+
$this->multiRegionConsistency = $value;
377+
378+
return $this;
379+
}
380+
335381
public function setOnDemandThroughput(?OnDemandThroughput $value): self
336382
{
337383
$this->onDemandThroughput = $value;
@@ -449,6 +495,12 @@ private function requestBody(): array
449495
if (null !== $v = $this->deletionProtectionEnabled) {
450496
$payload['DeletionProtectionEnabled'] = (bool) $v;
451497
}
498+
if (null !== $v = $this->multiRegionConsistency) {
499+
if (!MultiRegionConsistency::exists($v)) {
500+
throw new InvalidArgument(\sprintf('Invalid parameter "MultiRegionConsistency" for "%s". The value "%s" is not a valid "MultiRegionConsistency".', __CLASS__, $v));
501+
}
502+
$payload['MultiRegionConsistency'] = $v;
503+
}
452504
if (null !== $v = $this->onDemandThroughput) {
453505
$payload['OnDemandThroughput'] = $v->requestBody();
454506
}

src/Result/CreateTableOutput.php

+1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ private function populateResultTableDescription(array $json): TableDescription
348348
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
349349
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
350350
'WarmThroughput' => empty($json['WarmThroughput']) ? null : $this->populateResultTableWarmThroughputDescription($json['WarmThroughput']),
351+
'MultiRegionConsistency' => isset($json['MultiRegionConsistency']) ? (string) $json['MultiRegionConsistency'] : null,
351352
]);
352353
}
353354

src/Result/DeleteTableOutput.php

+1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ private function populateResultTableDescription(array $json): TableDescription
348348
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
349349
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
350350
'WarmThroughput' => empty($json['WarmThroughput']) ? null : $this->populateResultTableWarmThroughputDescription($json['WarmThroughput']),
351+
'MultiRegionConsistency' => isset($json['MultiRegionConsistency']) ? (string) $json['MultiRegionConsistency'] : null,
351352
]);
352353
}
353354

src/Result/DescribeTableOutput.php

+1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ private function populateResultTableDescription(array $json): TableDescription
348348
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
349349
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
350350
'WarmThroughput' => empty($json['WarmThroughput']) ? null : $this->populateResultTableWarmThroughputDescription($json['WarmThroughput']),
351+
'MultiRegionConsistency' => isset($json['MultiRegionConsistency']) ? (string) $json['MultiRegionConsistency'] : null,
351352
]);
352353
}
353354

src/Result/UpdateTableOutput.php

+1
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ private function populateResultTableDescription(array $json): TableDescription
348348
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
349349
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
350350
'WarmThroughput' => empty($json['WarmThroughput']) ? null : $this->populateResultTableWarmThroughputDescription($json['WarmThroughput']),
351+
'MultiRegionConsistency' => isset($json['MultiRegionConsistency']) ? (string) $json['MultiRegionConsistency'] : null,
351352
]);
352353
}
353354

src/ValueObject/TableDescription.php

+30
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace AsyncAws\DynamoDb\ValueObject;
44

5+
use AsyncAws\DynamoDb\Enum\MultiRegionConsistency;
56
use AsyncAws\DynamoDb\Enum\TableStatus;
67

78
/**
@@ -308,6 +309,24 @@ final class TableDescription
308309
*/
309310
private $warmThroughput;
310311

312+
/**
313+
* Indicates one of the following consistency modes for a global table:
314+
*
315+
* - `EVENTUAL`: Indicates that the global table is configured for multi-Region eventual consistency.
316+
* - `STRONG`: Indicates that the global table is configured for multi-Region strong consistency (preview).
317+
*
318+
* > Multi-Region strong consistency (MRSC) is a new DynamoDB global tables capability currently available in preview
319+
* > mode. For more information, see Global tables multi-Region strong consistency [^1].
320+
*
321+
*
322+
* If you don't specify this field, the global table consistency mode defaults to `EVENTUAL`.
323+
*
324+
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/PreviewFeatures.html#multi-region-strong-consistency-gt
325+
*
326+
* @var MultiRegionConsistency::*|null
327+
*/
328+
private $multiRegionConsistency;
329+
311330
/**
312331
* @param array{
313332
* AttributeDefinitions?: null|array<AttributeDefinition|array>,
@@ -335,6 +354,7 @@ final class TableDescription
335354
* DeletionProtectionEnabled?: null|bool,
336355
* OnDemandThroughput?: null|OnDemandThroughput|array,
337356
* WarmThroughput?: null|TableWarmThroughputDescription|array,
357+
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
338358
* } $input
339359
*/
340360
public function __construct(array $input)
@@ -364,6 +384,7 @@ public function __construct(array $input)
364384
$this->deletionProtectionEnabled = $input['DeletionProtectionEnabled'] ?? null;
365385
$this->onDemandThroughput = isset($input['OnDemandThroughput']) ? OnDemandThroughput::create($input['OnDemandThroughput']) : null;
366386
$this->warmThroughput = isset($input['WarmThroughput']) ? TableWarmThroughputDescription::create($input['WarmThroughput']) : null;
387+
$this->multiRegionConsistency = $input['MultiRegionConsistency'] ?? null;
367388
}
368389

369390
/**
@@ -393,6 +414,7 @@ public function __construct(array $input)
393414
* DeletionProtectionEnabled?: null|bool,
394415
* OnDemandThroughput?: null|OnDemandThroughput|array,
395416
* WarmThroughput?: null|TableWarmThroughputDescription|array,
417+
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
396418
* }|TableDescription $input
397419
*/
398420
public static function create($input): self
@@ -472,6 +494,14 @@ public function getLocalSecondaryIndexes(): array
472494
return $this->localSecondaryIndexes ?? [];
473495
}
474496

497+
/**
498+
* @return MultiRegionConsistency::*|null
499+
*/
500+
public function getMultiRegionConsistency(): ?string
501+
{
502+
return $this->multiRegionConsistency;
503+
}
504+
475505
public function getOnDemandThroughput(): ?OnDemandThroughput
476506
{
477507
return $this->onDemandThroughput;

0 commit comments

Comments
 (0)