Skip to content

Commit

Permalink
Update generated code (#1705)
Browse files Browse the repository at this point in the history
update generated code
  • Loading branch information
async-aws-bot authored May 3, 2024
1 parent 5ab4b1a commit 590a60a
Show file tree
Hide file tree
Showing 20 changed files with 464 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- AWS api-change: This release modifies the existing 'CreateTable' API for the resource-based policy support. It also modifies several APIs to accept a 'TableArn' for the 'TableName' parameter.
- AWS api-change: This release adds support to specify an optional, maximum OnDemandThroughput for DynamoDB tables and global secondary indexes in the CreateTable or UpdateTable APIs. You can also override the OnDemandThroughput settings by calling the ImportTable, RestoreFromPointInTime, or RestoreFromBackup APIs.

### Changed

Expand Down
3 changes: 3 additions & 0 deletions src/DynamoDbClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
use AsyncAws\DynamoDb\ValueObject\KeysAndAttributes;
use AsyncAws\DynamoDb\ValueObject\KeySchemaElement;
use AsyncAws\DynamoDb\ValueObject\LocalSecondaryIndex;
use AsyncAws\DynamoDb\ValueObject\OnDemandThroughput;
use AsyncAws\DynamoDb\ValueObject\ProvisionedThroughput;
use AsyncAws\DynamoDb\ValueObject\ReplicationGroupUpdate;
use AsyncAws\DynamoDb\ValueObject\SSESpecification;
Expand Down Expand Up @@ -279,6 +280,7 @@ public function batchWriteItem($input): BatchWriteItemOutput
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* ResourcePolicy?: null|string,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* '@region'?: string|null,
* }|CreateTableInput $input
*
Expand Down Expand Up @@ -996,6 +998,7 @@ public function updateItem($input): UpdateItemOutput
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* '@region'?: string|null,
* }|UpdateTableInput $input
*
Expand Down
34 changes: 30 additions & 4 deletions src/Input/CreateTableInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use AsyncAws\DynamoDb\ValueObject\GlobalSecondaryIndex;
use AsyncAws\DynamoDb\ValueObject\KeySchemaElement;
use AsyncAws\DynamoDb\ValueObject\LocalSecondaryIndex;
use AsyncAws\DynamoDb\ValueObject\OnDemandThroughput;
use AsyncAws\DynamoDb\ValueObject\Projection;
use AsyncAws\DynamoDb\ValueObject\ProvisionedThroughput;
use AsyncAws\DynamoDb\ValueObject\SSESpecification;
Expand Down Expand Up @@ -221,19 +222,26 @@ final class CreateTableInput extends Input
/**
* An Amazon Web Services resource-based policy document in JSON format that will be attached to the table.
*
* When you attach a resource-based policy while creating a table, the policy creation is *strongly consistent*.
* When you attach a resource-based policy while creating a table, the policy application is *strongly consistent*.
*
* The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when
* calculating the size of a policy against this limit. You can’t request an increase for this limit. For a full list
* of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy
* considerations [^1].
* calculating the size of a policy against this limit. For a full list of all considerations that apply for
* resource-based policies, see Resource-based policy considerations [^1].
*
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html
*
* @var string|null
*/
private $resourcePolicy;

/**
* Sets 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.
*
* @var OnDemandThroughput|null
*/
private $onDemandThroughput;

/**
* @param array{
* AttributeDefinitions?: array<AttributeDefinition|array>,
Expand All @@ -249,6 +257,7 @@ final class CreateTableInput extends Input
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* ResourcePolicy?: null|string,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* '@region'?: string|null,
* } $input
*/
Expand All @@ -267,6 +276,7 @@ public function __construct(array $input = [])
$this->tableClass = $input['TableClass'] ?? null;
$this->deletionProtectionEnabled = $input['DeletionProtectionEnabled'] ?? null;
$this->resourcePolicy = $input['ResourcePolicy'] ?? null;
$this->onDemandThroughput = isset($input['OnDemandThroughput']) ? OnDemandThroughput::create($input['OnDemandThroughput']) : null;
parent::__construct($input);
}

Expand All @@ -285,6 +295,7 @@ public function __construct(array $input = [])
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* ResourcePolicy?: null|string,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* '@region'?: string|null,
* }|CreateTableInput $input
*/
Expand Down Expand Up @@ -338,6 +349,11 @@ public function getLocalSecondaryIndexes(): array
return $this->localSecondaryIndexes ?? [];
}

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

public function getProvisionedThroughput(): ?ProvisionedThroughput
{
return $this->provisionedThroughput;
Expand Down Expand Up @@ -461,6 +477,13 @@ public function setLocalSecondaryIndexes(array $value): self
return $this;
}

public function setOnDemandThroughput(?OnDemandThroughput $value): self
{
$this->onDemandThroughput = $value;

return $this;
}

public function setProvisionedThroughput(?ProvisionedThroughput $value): self
{
$this->provisionedThroughput = $value;
Expand Down Expand Up @@ -596,6 +619,9 @@ private function requestBody(): array
if (null !== $v = $this->resourcePolicy) {
$payload['ResourcePolicy'] = $v;
}
if (null !== $v = $this->onDemandThroughput) {
$payload['OnDemandThroughput'] = $v->requestBody();
}

return $payload;
}
Expand Down
27 changes: 27 additions & 0 deletions src/Input/UpdateTableInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use AsyncAws\DynamoDb\Enum\TableClass;
use AsyncAws\DynamoDb\ValueObject\AttributeDefinition;
use AsyncAws\DynamoDb\ValueObject\GlobalSecondaryIndexUpdate;
use AsyncAws\DynamoDb\ValueObject\OnDemandThroughput;
use AsyncAws\DynamoDb\ValueObject\ProvisionedThroughput;
use AsyncAws\DynamoDb\ValueObject\ReplicationGroupUpdate;
use AsyncAws\DynamoDb\ValueObject\SSESpecification;
Expand Down Expand Up @@ -123,6 +124,14 @@ final class UpdateTableInput extends Input
*/
private $deletionProtectionEnabled;

/**
* 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.
*
* @var OnDemandThroughput|null
*/
private $onDemandThroughput;

/**
* @param array{
* AttributeDefinitions?: null|array<AttributeDefinition|array>,
Expand All @@ -135,6 +144,7 @@ final class UpdateTableInput extends Input
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* '@region'?: string|null,
* } $input
*/
Expand All @@ -150,6 +160,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->onDemandThroughput = isset($input['OnDemandThroughput']) ? OnDemandThroughput::create($input['OnDemandThroughput']) : null;
parent::__construct($input);
}

Expand All @@ -165,6 +176,7 @@ public function __construct(array $input = [])
* ReplicaUpdates?: null|array<ReplicationGroupUpdate|array>,
* TableClass?: null|TableClass::*,
* DeletionProtectionEnabled?: null|bool,
* OnDemandThroughput?: null|OnDemandThroughput|array,
* '@region'?: string|null,
* }|UpdateTableInput $input
*/
Expand Down Expand Up @@ -202,6 +214,11 @@ public function getGlobalSecondaryIndexUpdates(): array
return $this->globalSecondaryIndexUpdates ?? [];
}

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

public function getProvisionedThroughput(): ?ProvisionedThroughput
{
return $this->provisionedThroughput;
Expand Down Expand Up @@ -300,6 +317,13 @@ public function setGlobalSecondaryIndexUpdates(array $value): self
return $this;
}

public function setOnDemandThroughput(?OnDemandThroughput $value): self
{
$this->onDemandThroughput = $value;

return $this;
}

public function setProvisionedThroughput(?ProvisionedThroughput $value): self
{
$this->provisionedThroughput = $value;
Expand Down Expand Up @@ -403,6 +427,9 @@ private function requestBody(): array
if (null !== $v = $this->deletionProtectionEnabled) {
$payload['DeletionProtectionEnabled'] = (bool) $v;
}
if (null !== $v = $this->onDemandThroughput) {
$payload['OnDemandThroughput'] = $v->requestBody();
}

return $payload;
}
Expand Down
21 changes: 21 additions & 0 deletions src/Result/CreateTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use AsyncAws\DynamoDb\ValueObject\GlobalSecondaryIndexDescription;
use AsyncAws\DynamoDb\ValueObject\KeySchemaElement;
use AsyncAws\DynamoDb\ValueObject\LocalSecondaryIndexDescription;
use AsyncAws\DynamoDb\ValueObject\OnDemandThroughput;
use AsyncAws\DynamoDb\ValueObject\OnDemandThroughputOverride;
use AsyncAws\DynamoDb\ValueObject\Projection;
use AsyncAws\DynamoDb\ValueObject\ProvisionedThroughputDescription;
use AsyncAws\DynamoDb\ValueObject\ProvisionedThroughputOverride;
Expand Down Expand Up @@ -97,6 +99,7 @@ private function populateResultGlobalSecondaryIndexDescription(array $json): Glo
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (int) $json['IndexSizeBytes'] : null,
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
'IndexArn' => isset($json['IndexArn']) ? (string) $json['IndexArn'] : null,
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
]);
}

Expand Down Expand Up @@ -175,6 +178,21 @@ private function populateResultNonKeyAttributeNameList(array $json): array
return $items;
}

private function populateResultOnDemandThroughput(array $json): OnDemandThroughput
{
return new OnDemandThroughput([
'MaxReadRequestUnits' => isset($json['MaxReadRequestUnits']) ? (int) $json['MaxReadRequestUnits'] : null,
'MaxWriteRequestUnits' => isset($json['MaxWriteRequestUnits']) ? (int) $json['MaxWriteRequestUnits'] : null,
]);
}

private function populateResultOnDemandThroughputOverride(array $json): OnDemandThroughputOverride
{
return new OnDemandThroughputOverride([
'MaxReadRequestUnits' => isset($json['MaxReadRequestUnits']) ? (int) $json['MaxReadRequestUnits'] : null,
]);
}

private function populateResultProjection(array $json): Projection
{
return new Projection([
Expand Down Expand Up @@ -210,6 +228,7 @@ private function populateResultReplicaDescription(array $json): ReplicaDescripti
'ReplicaStatusPercentProgress' => isset($json['ReplicaStatusPercentProgress']) ? (string) $json['ReplicaStatusPercentProgress'] : null,
'KMSMasterKeyId' => isset($json['KMSMasterKeyId']) ? (string) $json['KMSMasterKeyId'] : null,
'ProvisionedThroughputOverride' => empty($json['ProvisionedThroughputOverride']) ? null : $this->populateResultProvisionedThroughputOverride($json['ProvisionedThroughputOverride']),
'OnDemandThroughputOverride' => empty($json['OnDemandThroughputOverride']) ? null : $this->populateResultOnDemandThroughputOverride($json['OnDemandThroughputOverride']),
'GlobalSecondaryIndexes' => !isset($json['GlobalSecondaryIndexes']) ? null : $this->populateResultReplicaGlobalSecondaryIndexDescriptionList($json['GlobalSecondaryIndexes']),
'ReplicaInaccessibleDateTime' => (isset($json['ReplicaInaccessibleDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['ReplicaInaccessibleDateTime'])))) ? $d : null,
'ReplicaTableClassSummary' => empty($json['ReplicaTableClassSummary']) ? null : $this->populateResultTableClassSummary($json['ReplicaTableClassSummary']),
Expand All @@ -234,6 +253,7 @@ private function populateResultReplicaGlobalSecondaryIndexDescription(array $jso
return new ReplicaGlobalSecondaryIndexDescription([
'IndexName' => isset($json['IndexName']) ? (string) $json['IndexName'] : null,
'ProvisionedThroughputOverride' => empty($json['ProvisionedThroughputOverride']) ? null : $this->populateResultProvisionedThroughputOverride($json['ProvisionedThroughputOverride']),
'OnDemandThroughputOverride' => empty($json['OnDemandThroughputOverride']) ? null : $this->populateResultOnDemandThroughputOverride($json['OnDemandThroughputOverride']),
]);
}

Expand Down Expand Up @@ -312,6 +332,7 @@ private function populateResultTableDescription(array $json): TableDescription
'ArchivalSummary' => empty($json['ArchivalSummary']) ? null : $this->populateResultArchivalSummary($json['ArchivalSummary']),
'TableClassSummary' => empty($json['TableClassSummary']) ? null : $this->populateResultTableClassSummary($json['TableClassSummary']),
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
]);
}
}
21 changes: 21 additions & 0 deletions src/Result/DeleteTableOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use AsyncAws\DynamoDb\ValueObject\GlobalSecondaryIndexDescription;
use AsyncAws\DynamoDb\ValueObject\KeySchemaElement;
use AsyncAws\DynamoDb\ValueObject\LocalSecondaryIndexDescription;
use AsyncAws\DynamoDb\ValueObject\OnDemandThroughput;
use AsyncAws\DynamoDb\ValueObject\OnDemandThroughputOverride;
use AsyncAws\DynamoDb\ValueObject\Projection;
use AsyncAws\DynamoDb\ValueObject\ProvisionedThroughputDescription;
use AsyncAws\DynamoDb\ValueObject\ProvisionedThroughputOverride;
Expand Down Expand Up @@ -97,6 +99,7 @@ private function populateResultGlobalSecondaryIndexDescription(array $json): Glo
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (int) $json['IndexSizeBytes'] : null,
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
'IndexArn' => isset($json['IndexArn']) ? (string) $json['IndexArn'] : null,
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
]);
}

Expand Down Expand Up @@ -175,6 +178,21 @@ private function populateResultNonKeyAttributeNameList(array $json): array
return $items;
}

private function populateResultOnDemandThroughput(array $json): OnDemandThroughput
{
return new OnDemandThroughput([
'MaxReadRequestUnits' => isset($json['MaxReadRequestUnits']) ? (int) $json['MaxReadRequestUnits'] : null,
'MaxWriteRequestUnits' => isset($json['MaxWriteRequestUnits']) ? (int) $json['MaxWriteRequestUnits'] : null,
]);
}

private function populateResultOnDemandThroughputOverride(array $json): OnDemandThroughputOverride
{
return new OnDemandThroughputOverride([
'MaxReadRequestUnits' => isset($json['MaxReadRequestUnits']) ? (int) $json['MaxReadRequestUnits'] : null,
]);
}

private function populateResultProjection(array $json): Projection
{
return new Projection([
Expand Down Expand Up @@ -210,6 +228,7 @@ private function populateResultReplicaDescription(array $json): ReplicaDescripti
'ReplicaStatusPercentProgress' => isset($json['ReplicaStatusPercentProgress']) ? (string) $json['ReplicaStatusPercentProgress'] : null,
'KMSMasterKeyId' => isset($json['KMSMasterKeyId']) ? (string) $json['KMSMasterKeyId'] : null,
'ProvisionedThroughputOverride' => empty($json['ProvisionedThroughputOverride']) ? null : $this->populateResultProvisionedThroughputOverride($json['ProvisionedThroughputOverride']),
'OnDemandThroughputOverride' => empty($json['OnDemandThroughputOverride']) ? null : $this->populateResultOnDemandThroughputOverride($json['OnDemandThroughputOverride']),
'GlobalSecondaryIndexes' => !isset($json['GlobalSecondaryIndexes']) ? null : $this->populateResultReplicaGlobalSecondaryIndexDescriptionList($json['GlobalSecondaryIndexes']),
'ReplicaInaccessibleDateTime' => (isset($json['ReplicaInaccessibleDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['ReplicaInaccessibleDateTime'])))) ? $d : null,
'ReplicaTableClassSummary' => empty($json['ReplicaTableClassSummary']) ? null : $this->populateResultTableClassSummary($json['ReplicaTableClassSummary']),
Expand All @@ -234,6 +253,7 @@ private function populateResultReplicaGlobalSecondaryIndexDescription(array $jso
return new ReplicaGlobalSecondaryIndexDescription([
'IndexName' => isset($json['IndexName']) ? (string) $json['IndexName'] : null,
'ProvisionedThroughputOverride' => empty($json['ProvisionedThroughputOverride']) ? null : $this->populateResultProvisionedThroughputOverride($json['ProvisionedThroughputOverride']),
'OnDemandThroughputOverride' => empty($json['OnDemandThroughputOverride']) ? null : $this->populateResultOnDemandThroughputOverride($json['OnDemandThroughputOverride']),
]);
}

Expand Down Expand Up @@ -312,6 +332,7 @@ private function populateResultTableDescription(array $json): TableDescription
'ArchivalSummary' => empty($json['ArchivalSummary']) ? null : $this->populateResultArchivalSummary($json['ArchivalSummary']),
'TableClassSummary' => empty($json['TableClassSummary']) ? null : $this->populateResultTableClassSummary($json['TableClassSummary']),
'DeletionProtectionEnabled' => isset($json['DeletionProtectionEnabled']) ? filter_var($json['DeletionProtectionEnabled'], \FILTER_VALIDATE_BOOLEAN) : null,
'OnDemandThroughput' => empty($json['OnDemandThroughput']) ? null : $this->populateResultOnDemandThroughput($json['OnDemandThroughput']),
]);
}
}
Loading

0 comments on commit 590a60a

Please sign in to comment.