Skip to content

Commit 4c0155b

Browse files
Update generated code (#1933)
update generated code
1 parent 6128726 commit 4c0155b

File tree

7 files changed

+278
-9
lines changed

7 files changed

+278
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
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 release 1/ Adds support for throttled keys mode for CloudWatch Contributor Insights, 2/ Adds throttling reasons to exceptions across dataplane APIs. 3/ Explicitly models ThrottlingException as a class in statically typed languages. Refer to the launch day blog post for more details.
8+
59
## 3.7.0
610

711
### Added

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"extra": {
3434
"branch-alias": {
35-
"dev-master": "3.7-dev"
35+
"dev-master": "3.8-dev"
3636
}
3737
}
3838
}

src/DynamoDbClient.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use AsyncAws\DynamoDb\Exception\RequestLimitExceededException;
2828
use AsyncAws\DynamoDb\Exception\ResourceInUseException;
2929
use AsyncAws\DynamoDb\Exception\ResourceNotFoundException;
30+
use AsyncAws\DynamoDb\Exception\ThrottlingException;
3031
use AsyncAws\DynamoDb\Exception\TransactionCanceledException;
3132
use AsyncAws\DynamoDb\Exception\TransactionConflictException;
3233
use AsyncAws\DynamoDb\Exception\TransactionInProgressException;
@@ -150,6 +151,7 @@ class DynamoDbClient extends AbstractApi
150151
* @throws ProvisionedThroughputExceededException
151152
* @throws RequestLimitExceededException
152153
* @throws ResourceNotFoundException
154+
* @throws ThrottlingException
153155
*/
154156
public function batchGetItem($input): BatchGetItemOutput
155157
{
@@ -159,6 +161,7 @@ public function batchGetItem($input): BatchGetItemOutput
159161
'ProvisionedThroughputExceededException' => ProvisionedThroughputExceededException::class,
160162
'RequestLimitExceeded' => RequestLimitExceededException::class,
161163
'ResourceNotFoundException' => ResourceNotFoundException::class,
164+
'ThrottlingException' => ThrottlingException::class,
162165
], 'usesEndpointDiscovery' => true]));
163166

164167
return new BatchGetItemOutput($response, $this, $input);
@@ -245,6 +248,7 @@ public function batchGetItem($input): BatchGetItemOutput
245248
* @throws ReplicatedWriteConflictException
246249
* @throws RequestLimitExceededException
247250
* @throws ResourceNotFoundException
251+
* @throws ThrottlingException
248252
*/
249253
public function batchWriteItem($input): BatchWriteItemOutput
250254
{
@@ -256,6 +260,7 @@ public function batchWriteItem($input): BatchWriteItemOutput
256260
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
257261
'RequestLimitExceeded' => RequestLimitExceededException::class,
258262
'ResourceNotFoundException' => ResourceNotFoundException::class,
263+
'ThrottlingException' => ThrottlingException::class,
259264
], 'usesEndpointDiscovery' => true]));
260265

261266
return new BatchWriteItemOutput($response);
@@ -352,6 +357,7 @@ public function createTable($input): CreateTableOutput
352357
* @throws ReplicatedWriteConflictException
353358
* @throws RequestLimitExceededException
354359
* @throws ResourceNotFoundException
360+
* @throws ThrottlingException
355361
* @throws TransactionConflictException
356362
*/
357363
public function deleteItem($input): DeleteItemOutput
@@ -365,6 +371,7 @@ public function deleteItem($input): DeleteItemOutput
365371
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
366372
'RequestLimitExceeded' => RequestLimitExceededException::class,
367373
'ResourceNotFoundException' => ResourceNotFoundException::class,
374+
'ThrottlingException' => ThrottlingException::class,
368375
'TransactionConflictException' => TransactionConflictException::class,
369376
], 'usesEndpointDiscovery' => true]));
370377

@@ -502,6 +509,7 @@ public function describeTable($input): DescribeTableOutput
502509
* @throws ProvisionedThroughputExceededException
503510
* @throws RequestLimitExceededException
504511
* @throws ResourceNotFoundException
512+
* @throws ThrottlingException
505513
* @throws TransactionConflictException
506514
*/
507515
public function executeStatement($input): ExecuteStatementOutput
@@ -515,6 +523,7 @@ public function executeStatement($input): ExecuteStatementOutput
515523
'ProvisionedThroughputExceededException' => ProvisionedThroughputExceededException::class,
516524
'RequestLimitExceeded' => RequestLimitExceededException::class,
517525
'ResourceNotFoundException' => ResourceNotFoundException::class,
526+
'ThrottlingException' => ThrottlingException::class,
518527
'TransactionConflictException' => TransactionConflictException::class,
519528
]]));
520529

@@ -547,6 +556,7 @@ public function executeStatement($input): ExecuteStatementOutput
547556
* @throws ProvisionedThroughputExceededException
548557
* @throws RequestLimitExceededException
549558
* @throws ResourceNotFoundException
559+
* @throws ThrottlingException
550560
*/
551561
public function getItem($input): GetItemOutput
552562
{
@@ -556,6 +566,7 @@ public function getItem($input): GetItemOutput
556566
'ProvisionedThroughputExceededException' => ProvisionedThroughputExceededException::class,
557567
'RequestLimitExceeded' => RequestLimitExceededException::class,
558568
'ResourceNotFoundException' => ResourceNotFoundException::class,
569+
'ThrottlingException' => ThrottlingException::class,
559570
], 'usesEndpointDiscovery' => true]));
560571

561572
return new GetItemOutput($response);
@@ -635,6 +646,7 @@ public function listTables($input = []): ListTablesOutput
635646
* @throws ReplicatedWriteConflictException
636647
* @throws RequestLimitExceededException
637648
* @throws ResourceNotFoundException
649+
* @throws ThrottlingException
638650
* @throws TransactionConflictException
639651
*/
640652
public function putItem($input): PutItemOutput
@@ -648,6 +660,7 @@ public function putItem($input): PutItemOutput
648660
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
649661
'RequestLimitExceeded' => RequestLimitExceededException::class,
650662
'ResourceNotFoundException' => ResourceNotFoundException::class,
663+
'ThrottlingException' => ThrottlingException::class,
651664
'TransactionConflictException' => TransactionConflictException::class,
652665
], 'usesEndpointDiscovery' => true]));
653666

@@ -724,6 +737,7 @@ public function putItem($input): PutItemOutput
724737
* @throws ProvisionedThroughputExceededException
725738
* @throws RequestLimitExceededException
726739
* @throws ResourceNotFoundException
740+
* @throws ThrottlingException
727741
*/
728742
public function query($input): QueryOutput
729743
{
@@ -733,6 +747,7 @@ public function query($input): QueryOutput
733747
'ProvisionedThroughputExceededException' => ProvisionedThroughputExceededException::class,
734748
'RequestLimitExceeded' => RequestLimitExceededException::class,
735749
'ResourceNotFoundException' => ResourceNotFoundException::class,
750+
'ThrottlingException' => ThrottlingException::class,
736751
], 'usesEndpointDiscovery' => true]));
737752

738753
return new QueryOutput($response, $this, $input);
@@ -801,6 +816,7 @@ public function query($input): QueryOutput
801816
* @throws ProvisionedThroughputExceededException
802817
* @throws RequestLimitExceededException
803818
* @throws ResourceNotFoundException
819+
* @throws ThrottlingException
804820
*/
805821
public function scan($input): ScanOutput
806822
{
@@ -810,6 +826,7 @@ public function scan($input): ScanOutput
810826
'ProvisionedThroughputExceededException' => ProvisionedThroughputExceededException::class,
811827
'RequestLimitExceeded' => RequestLimitExceededException::class,
812828
'ResourceNotFoundException' => ResourceNotFoundException::class,
829+
'ThrottlingException' => ThrottlingException::class,
813830
], 'usesEndpointDiscovery' => true]));
814831

815832
return new ScanOutput($response, $this, $input);
@@ -905,6 +922,7 @@ public function tableNotExists($input): TableNotExistsWaiter
905922
* @throws ProvisionedThroughputExceededException
906923
* @throws RequestLimitExceededException
907924
* @throws ResourceNotFoundException
925+
* @throws ThrottlingException
908926
* @throws TransactionCanceledException
909927
* @throws TransactionInProgressException
910928
*/
@@ -917,6 +935,7 @@ public function transactWriteItems($input): TransactWriteItemsOutput
917935
'ProvisionedThroughputExceededException' => ProvisionedThroughputExceededException::class,
918936
'RequestLimitExceeded' => RequestLimitExceededException::class,
919937
'ResourceNotFoundException' => ResourceNotFoundException::class,
938+
'ThrottlingException' => ThrottlingException::class,
920939
'TransactionCanceledException' => TransactionCanceledException::class,
921940
'TransactionInProgressException' => TransactionInProgressException::class,
922941
], 'usesEndpointDiscovery' => true]));
@@ -960,6 +979,7 @@ public function transactWriteItems($input): TransactWriteItemsOutput
960979
* @throws ReplicatedWriteConflictException
961980
* @throws RequestLimitExceededException
962981
* @throws ResourceNotFoundException
982+
* @throws ThrottlingException
963983
* @throws TransactionConflictException
964984
*/
965985
public function updateItem($input): UpdateItemOutput
@@ -973,6 +993,7 @@ public function updateItem($input): UpdateItemOutput
973993
'ReplicatedWriteConflictException' => ReplicatedWriteConflictException::class,
974994
'RequestLimitExceeded' => RequestLimitExceededException::class,
975995
'ResourceNotFoundException' => ResourceNotFoundException::class,
996+
'ThrottlingException' => ThrottlingException::class,
976997
'TransactionConflictException' => TransactionConflictException::class,
977998
], 'usesEndpointDiscovery' => true]));
978999

src/Exception/ProvisionedThroughputExceededException.php

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,64 @@
33
namespace AsyncAws\DynamoDb\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6+
use AsyncAws\DynamoDb\ValueObject\ThrottlingReason;
7+
use Symfony\Contracts\HttpClient\ResponseInterface;
68

79
/**
8-
* Your request rate is too high. The Amazon Web Services SDKs for DynamoDB automatically retry requests that receive
9-
* this exception. Your request is eventually successful, unless your retry queue is too large to finish. Reduce the
10-
* frequency of requests and use exponential backoff. For more information, go to Error Retries and Exponential Backoff
11-
* [^1] in the *Amazon DynamoDB Developer Guide*.
10+
* The request was denied due to request throttling. For detailed information about why the request was throttled and
11+
* the ARN of the impacted resource, find the ThrottlingReason [^1] field in the returned exception. The Amazon Web
12+
* Services SDKs for DynamoDB automatically retry requests that receive this exception. Your request is eventually
13+
* successful, unless your retry queue is too large to finish. Reduce the frequency of requests and use exponential
14+
* backoff. For more information, go to Error Retries and Exponential Backoff [^2] in the *Amazon DynamoDB Developer
15+
* Guide*.
1216
*
13-
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff
17+
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html
18+
* [^2]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff
1419
*/
1520
final class ProvisionedThroughputExceededException extends ClientException
1621
{
22+
/**
23+
* A list of ThrottlingReason [^1] that provide detailed diagnostic information about why the request was throttled.
24+
*
25+
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html
26+
*
27+
* @var ThrottlingReason[]
28+
*/
29+
private $throttlingReasons;
30+
31+
/**
32+
* @return ThrottlingReason[]
33+
*/
34+
public function getThrottlingReasons(): array
35+
{
36+
return $this->throttlingReasons;
37+
}
38+
39+
protected function populateResult(ResponseInterface $response): void
40+
{
41+
$data = $response->toArray(false);
42+
43+
$this->throttlingReasons = empty($data['ThrottlingReasons']) ? [] : $this->populateResultThrottlingReasonList($data['ThrottlingReasons']);
44+
}
45+
46+
private function populateResultThrottlingReason(array $json): ThrottlingReason
47+
{
48+
return new ThrottlingReason([
49+
'reason' => isset($json['reason']) ? (string) $json['reason'] : null,
50+
'resource' => isset($json['resource']) ? (string) $json['resource'] : null,
51+
]);
52+
}
53+
54+
/**
55+
* @return ThrottlingReason[]
56+
*/
57+
private function populateResultThrottlingReasonList(array $json): array
58+
{
59+
$items = [];
60+
foreach ($json as $item) {
61+
$items[] = $this->populateResultThrottlingReason($item);
62+
}
63+
64+
return $items;
65+
}
1766
}

src/Exception/RequestLimitExceededException.php

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,61 @@
33
namespace AsyncAws\DynamoDb\Exception;
44

55
use AsyncAws\Core\Exception\Http\ClientException;
6+
use AsyncAws\DynamoDb\ValueObject\ThrottlingReason;
7+
use Symfony\Contracts\HttpClient\ResponseInterface;
68

79
/**
8-
* Throughput exceeds the current throughput quota for your account. Please contact Amazon Web ServicesSupport [^1] to
9-
* request a quota increase.
10+
* Throughput exceeds the current throughput quota for your account. For detailed information about why the request was
11+
* throttled and the ARN of the impacted resource, find the ThrottlingReason [^1] field in the returned exception.
12+
* Contact Amazon Web ServicesSupport [^2] to request a quota increase.
1013
*
11-
* [^1]: https://aws.amazon.com/support
14+
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html
15+
* [^2]: https://aws.amazon.com/support
1216
*/
1317
final class RequestLimitExceededException extends ClientException
1418
{
19+
/**
20+
* A list of ThrottlingReason [^1] that provide detailed diagnostic information about why the request was throttled.
21+
*
22+
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html
23+
*
24+
* @var ThrottlingReason[]
25+
*/
26+
private $throttlingReasons;
27+
28+
/**
29+
* @return ThrottlingReason[]
30+
*/
31+
public function getThrottlingReasons(): array
32+
{
33+
return $this->throttlingReasons;
34+
}
35+
36+
protected function populateResult(ResponseInterface $response): void
37+
{
38+
$data = $response->toArray(false);
39+
40+
$this->throttlingReasons = empty($data['ThrottlingReasons']) ? [] : $this->populateResultThrottlingReasonList($data['ThrottlingReasons']);
41+
}
42+
43+
private function populateResultThrottlingReason(array $json): ThrottlingReason
44+
{
45+
return new ThrottlingReason([
46+
'reason' => isset($json['reason']) ? (string) $json['reason'] : null,
47+
'resource' => isset($json['resource']) ? (string) $json['resource'] : null,
48+
]);
49+
}
50+
51+
/**
52+
* @return ThrottlingReason[]
53+
*/
54+
private function populateResultThrottlingReasonList(array $json): array
55+
{
56+
$items = [];
57+
foreach ($json as $item) {
58+
$items[] = $this->populateResultThrottlingReason($item);
59+
}
60+
61+
return $items;
62+
}
1563
}

src/Exception/ThrottlingException.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
namespace AsyncAws\DynamoDb\Exception;
4+
5+
use AsyncAws\Core\Exception\Http\ClientException;
6+
use AsyncAws\DynamoDb\ValueObject\ThrottlingReason;
7+
use Symfony\Contracts\HttpClient\ResponseInterface;
8+
9+
/**
10+
* The request was denied due to request throttling. For detailed information about why the request was throttled and
11+
* the ARN of the impacted resource, find the ThrottlingReason [^1] field in the returned exception.
12+
*
13+
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html
14+
*/
15+
final class ThrottlingException extends ClientException
16+
{
17+
/**
18+
* A list of ThrottlingReason [^1] that provide detailed diagnostic information about why the request was throttled.
19+
*
20+
* [^1]: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html
21+
*
22+
* @var ThrottlingReason[]
23+
*/
24+
private $throttlingReasons;
25+
26+
/**
27+
* @return ThrottlingReason[]
28+
*/
29+
public function getThrottlingReasons(): array
30+
{
31+
return $this->throttlingReasons;
32+
}
33+
34+
protected function populateResult(ResponseInterface $response): void
35+
{
36+
$data = $response->toArray(false);
37+
38+
$this->throttlingReasons = empty($data['throttlingReasons']) ? [] : $this->populateResultThrottlingReasonList($data['throttlingReasons']);
39+
}
40+
41+
private function populateResultThrottlingReason(array $json): ThrottlingReason
42+
{
43+
return new ThrottlingReason([
44+
'reason' => isset($json['reason']) ? (string) $json['reason'] : null,
45+
'resource' => isset($json['resource']) ? (string) $json['resource'] : null,
46+
]);
47+
}
48+
49+
/**
50+
* @return ThrottlingReason[]
51+
*/
52+
private function populateResultThrottlingReasonList(array $json): array
53+
{
54+
$items = [];
55+
foreach ($json as $item) {
56+
$items[] = $this->populateResultThrottlingReason($item);
57+
}
58+
59+
return $items;
60+
}
61+
}

0 commit comments

Comments
 (0)