Skip to content

Commit

Permalink
Update generated code (#1813)
Browse files Browse the repository at this point in the history
update generated code
  • Loading branch information
async-aws-bot authored Dec 4, 2024
1 parent f909f85 commit 4f4fe94
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## NOT RELEASED

### Added

- 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.

## 3.3.1

### Changed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "3.4-dev"
}
}
}
9 changes: 9 additions & 0 deletions src/DynamoDbClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use AsyncAws\Core\RequestContext;
use AsyncAws\DynamoDb\Enum\BillingMode;
use AsyncAws\DynamoDb\Enum\ConditionalOperator;
use AsyncAws\DynamoDb\Enum\MultiRegionConsistency;
use AsyncAws\DynamoDb\Enum\ReturnConsumedCapacity;
use AsyncAws\DynamoDb\Enum\ReturnItemCollectionMetrics;
use AsyncAws\DynamoDb\Enum\ReturnValue;
Expand All @@ -22,6 +23,7 @@
use AsyncAws\DynamoDb\Exception\ItemCollectionSizeLimitExceededException;
use AsyncAws\DynamoDb\Exception\LimitExceededException;
use AsyncAws\DynamoDb\Exception\ProvisionedThroughputExceededException;
use AsyncAws\DynamoDb\Exception\ReplicatedWriteConflictException;
use AsyncAws\DynamoDb\Exception\RequestLimitExceededException;
use AsyncAws\DynamoDb\Exception\ResourceInUseException;
use AsyncAws\DynamoDb\Exception\ResourceNotFoundException;
Expand Down Expand Up @@ -345,6 +347,7 @@ public function createTable($input): CreateTableOutput
* @throws TransactionConflictException
* @throws RequestLimitExceededException
* @throws InternalServerErrorException
* @throws ReplicatedWriteConflictException
*/
public function deleteItem($input): DeleteItemOutput
{
Expand All @@ -357,6 +360,7 @@ public function deleteItem($input): DeleteItemOutput
'TransactionConflictException' => TransactionConflictException::class,
'RequestLimitExceeded' => RequestLimitExceededException::class,
'InternalServerError' => InternalServerErrorException::class,
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
], 'usesEndpointDiscovery' => true]));

return new DeleteItemOutput($response);
Expand Down Expand Up @@ -630,6 +634,7 @@ public function listTables($input = []): ListTablesOutput
* @throws TransactionConflictException
* @throws RequestLimitExceededException
* @throws InternalServerErrorException
* @throws ReplicatedWriteConflictException
*/
public function putItem($input): PutItemOutput
{
Expand All @@ -642,6 +647,7 @@ public function putItem($input): PutItemOutput
'TransactionConflictException' => TransactionConflictException::class,
'RequestLimitExceeded' => RequestLimitExceededException::class,
'InternalServerError' => InternalServerErrorException::class,
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
], 'usesEndpointDiscovery' => true]));

return new PutItemOutput($response);
Expand Down Expand Up @@ -953,6 +959,7 @@ public function transactWriteItems($input): TransactWriteItemsOutput
* @throws TransactionConflictException
* @throws RequestLimitExceededException
* @throws InternalServerErrorException
* @throws ReplicatedWriteConflictException
*/
public function updateItem($input): UpdateItemOutput
{
Expand All @@ -965,6 +972,7 @@ public function updateItem($input): UpdateItemOutput
'TransactionConflictException' => TransactionConflictException::class,
'RequestLimitExceeded' => RequestLimitExceededException::class,
'InternalServerError' => InternalServerErrorException::class,
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
], 'usesEndpointDiscovery' => true]));

return new UpdateItemOutput($response);
Expand Down Expand Up @@ -1001,6 +1009,7 @@ public function updateItem($input): UpdateItemOutput
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* WarmThroughput?: null|WarmThroughput|array,
* '@region'?: string|null,
Expand Down
17 changes: 17 additions & 0 deletions src/Enum/MultiRegionConsistency.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace AsyncAws\DynamoDb\Enum;

final class MultiRegionConsistency
{
public const EVENTUAL = 'EVENTUAL';
public const STRONG = 'STRONG';

public static function exists(string $value): bool
{
return isset([
self::EVENTUAL => true,
self::STRONG => true,
][$value]);
}
}
12 changes: 12 additions & 0 deletions src/Exception/ReplicatedWriteConflictException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace AsyncAws\DynamoDb\Exception;

use AsyncAws\Core\Exception\Http\ClientException;

/**
* The request was rejected because one or more items in the request are being modified by a request in another Region.
*/
final class ReplicatedWriteConflictException extends ClientException
{
}
52 changes: 52 additions & 0 deletions src/Input/UpdateTableInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use AsyncAws\Core\Request;
use AsyncAws\Core\Stream\StreamFactory;
use AsyncAws\DynamoDb\Enum\BillingMode;
use AsyncAws\DynamoDb\Enum\MultiRegionConsistency;
use AsyncAws\DynamoDb\Enum\TableClass;
use AsyncAws\DynamoDb\ValueObject\AttributeDefinition;
use AsyncAws\DynamoDb\ValueObject\GlobalSecondaryIndexUpdate;
Expand Down Expand Up @@ -123,6 +124,30 @@ final class UpdateTableInput extends Input
*/
private $deletionProtectionEnabled;

/**
* 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 Create [^1] actions in the ReplicaUpdates [^2] action list.
*
* You can specify one of the following consistency modes:
*
* - `EVENTUAL`: Configures a new global table for multi-Region eventual consistency. This is the default consistency
* mode for global tables.
* - `STRONG`: Configures a new global table for multi-Region strong consistency (preview).
*
* > Multi-Region strong consistency (MRSC) is a new DynamoDB global tables capability currently available in preview
* > mode. For more information, see Global tables multi-Region strong consistency [^3].
*
*
* If you don't specify this parameter, the global table consistency mode defaults to `EVENTUAL`.
*
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ReplicationGroupUpdate.html#DDB-Type-ReplicationGroupUpdate-Create
* [^2]: https://docs.aws.amazon.com/https:/docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html#DDB-UpdateTable-request-ReplicaUpdates
* [^3]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/PreviewFeatures.html#multi-region-strong-consistency-gt
*
* @var MultiRegionConsistency::*|null
*/
private $multiRegionConsistency;

/**
* Updates the maximum number of read and write units for the specified table in on-demand capacity mode. If you use
* this parameter, you must specify `MaxReadRequestUnits`, `MaxWriteRequestUnits`, or both.
Expand Down Expand Up @@ -150,6 +175,7 @@ final class UpdateTableInput extends Input
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* WarmThroughput?: null|WarmThroughput|array,
* '@region'?: string|null,
Expand All @@ -167,6 +193,7 @@ public function __construct(array $input = [])
$this->replicaUpdates = isset($input['ReplicaUpdates']) ? array_map([ReplicationGroupUpdate::class, 'create'], $input['ReplicaUpdates']) : null;
$this->tableClass = $input['TableClass'] ?? null;
$this->deletionProtectionEnabled = $input['DeletionProtectionEnabled'] ?? null;
$this->multiRegionConsistency = $input['MultiRegionConsistency'] ?? null;
$this->onDemandThroughput = isset($input['OnDemandThroughput']) ? OnDemandThroughput::create($input['OnDemandThroughput']) : null;
$this->warmThroughput = isset($input['WarmThroughput']) ? WarmThroughput::create($input['WarmThroughput']) : null;
parent::__construct($input);
Expand All @@ -184,6 +211,7 @@ public function __construct(array $input = [])
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* WarmThroughput?: null|WarmThroughput|array,
* '@region'?: string|null,
Expand Down Expand Up @@ -223,6 +251,14 @@ public function getGlobalSecondaryIndexUpdates(): array
return $this->globalSecondaryIndexUpdates ?? [];
}

/**
* @return MultiRegionConsistency::*|null
*/
public function getMultiRegionConsistency(): ?string
{
return $this->multiRegionConsistency;
}

public function getOnDemandThroughput(): ?OnDemandThroughput
{
return $this->onDemandThroughput;
Expand Down Expand Up @@ -332,6 +368,16 @@ public function setGlobalSecondaryIndexUpdates(array $value): self
return $this;
}

/**
* @param MultiRegionConsistency::*|null $value
*/
public function setMultiRegionConsistency(?string $value): self
{
$this->multiRegionConsistency = $value;

return $this;
}

public function setOnDemandThroughput(?OnDemandThroughput $value): self
{
$this->onDemandThroughput = $value;
Expand Down Expand Up @@ -449,6 +495,12 @@ private function requestBody(): array
if (null !== $v = $this->deletionProtectionEnabled) {
$payload['DeletionProtectionEnabled'] = (bool) $v;
}
if (null !== $v = $this->multiRegionConsistency) {
if (!MultiRegionConsistency::exists($v)) {
throw new InvalidArgument(\sprintf('Invalid parameter "MultiRegionConsistency" for "%s". The value "%s" is not a valid "MultiRegionConsistency".', __CLASS__, $v));
}
$payload['MultiRegionConsistency'] = $v;
}
if (null !== $v = $this->onDemandThroughput) {
$payload['OnDemandThroughput'] = $v->requestBody();
}
Expand Down
1 change: 1 addition & 0 deletions src/Result/CreateTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ private function populateResultTableDescription(array $json): TableDescription
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
'WarmThroughput' => empty($json['WarmThroughput']) ? null : $this->populateResultTableWarmThroughputDescription($json['WarmThroughput']),
'MultiRegionConsistency' => isset($json['MultiRegionConsistency']) ? (string) $json['MultiRegionConsistency'] : null,
]);
}

Expand Down
1 change: 1 addition & 0 deletions src/Result/DeleteTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ private function populateResultTableDescription(array $json): TableDescription
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
'WarmThroughput' => empty($json['WarmThroughput']) ? null : $this->populateResultTableWarmThroughputDescription($json['WarmThroughput']),
'MultiRegionConsistency' => isset($json['MultiRegionConsistency']) ? (string) $json['MultiRegionConsistency'] : null,
]);
}

Expand Down
1 change: 1 addition & 0 deletions src/Result/DescribeTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ private function populateResultTableDescription(array $json): TableDescription
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
'WarmThroughput' => empty($json['WarmThroughput']) ? null : $this->populateResultTableWarmThroughputDescription($json['WarmThroughput']),
'MultiRegionConsistency' => isset($json['MultiRegionConsistency']) ? (string) $json['MultiRegionConsistency'] : null,
]);
}

Expand Down
1 change: 1 addition & 0 deletions src/Result/UpdateTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ private function populateResultTableDescription(array $json): TableDescription
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
'WarmThroughput' => empty($json['WarmThroughput']) ? null : $this->populateResultTableWarmThroughputDescription($json['WarmThroughput']),
'MultiRegionConsistency' => isset($json['MultiRegionConsistency']) ? (string) $json['MultiRegionConsistency'] : null,
]);
}

Expand Down
30 changes: 30 additions & 0 deletions src/ValueObject/TableDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AsyncAws\DynamoDb\ValueObject;

use AsyncAws\DynamoDb\Enum\MultiRegionConsistency;
use AsyncAws\DynamoDb\Enum\TableStatus;

/**
Expand Down Expand Up @@ -308,6 +309,24 @@ final class TableDescription
*/
private $warmThroughput;

/**
* Indicates one of the following consistency modes for a global table:
*
* - `EVENTUAL`: Indicates that the global table is configured for multi-Region eventual consistency.
* - `STRONG`: Indicates that the global table is configured for multi-Region strong consistency (preview).
*
* > Multi-Region strong consistency (MRSC) is a new DynamoDB global tables capability currently available in preview
* > mode. For more information, see Global tables multi-Region strong consistency [^1].
*
*
* If you don't specify this field, the global table consistency mode defaults to `EVENTUAL`.
*
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/PreviewFeatures.html#multi-region-strong-consistency-gt
*
* @var MultiRegionConsistency::*|null
*/
private $multiRegionConsistency;

/**
* @param array{
* AttributeDefinitions?: null|array<AttributeDefinition|array>,
Expand Down Expand Up @@ -335,6 +354,7 @@ final class TableDescription
* DeletionProtectionEnabled?: null|bool,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* WarmThroughput?: null|TableWarmThroughputDescription|array,
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
* } $input
*/
public function __construct(array $input)
Expand Down Expand Up @@ -364,6 +384,7 @@ public function __construct(array $input)
$this->deletionProtectionEnabled = $input['DeletionProtectionEnabled'] ?? null;
$this->onDemandThroughput = isset($input['OnDemandThroughput']) ? OnDemandThroughput::create($input['OnDemandThroughput']) : null;
$this->warmThroughput = isset($input['WarmThroughput']) ? TableWarmThroughputDescription::create($input['WarmThroughput']) : null;
$this->multiRegionConsistency = $input['MultiRegionConsistency'] ?? null;
}

/**
Expand Down Expand Up @@ -393,6 +414,7 @@ public function __construct(array $input)
* DeletionProtectionEnabled?: null|bool,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* WarmThroughput?: null|TableWarmThroughputDescription|array,
* MultiRegionConsistency?: null|MultiRegionConsistency::*,
* }|TableDescription $input
*/
public static function create($input): self
Expand Down Expand Up @@ -472,6 +494,14 @@ public function getLocalSecondaryIndexes(): array
return $this->localSecondaryIndexes ?? [];
}

/**
* @return MultiRegionConsistency::*|null
*/
public function getMultiRegionConsistency(): ?string
{
return $this->multiRegionConsistency;
}

public function getOnDemandThroughput(): ?OnDemandThroughput
{
return $this->onDemandThroughput;
Expand Down

0 comments on commit 4f4fe94

Please sign in to comment.