1 |
efrain |
1 |
<?php
|
|
|
2 |
namespace Aws\DynamoDb;
|
|
|
3 |
|
|
|
4 |
use Aws\Api\Parser\Crc32ValidatingParser;
|
|
|
5 |
use Aws\AwsClient;
|
|
|
6 |
use Aws\ClientResolver;
|
|
|
7 |
use Aws\Exception\AwsException;
|
|
|
8 |
use Aws\HandlerList;
|
|
|
9 |
use Aws\Middleware;
|
|
|
10 |
use Aws\RetryMiddleware;
|
|
|
11 |
use Aws\RetryMiddlewareV2;
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
* This client is used to interact with the **Amazon DynamoDB** service.
|
|
|
15 |
*
|
|
|
16 |
* @method \Aws\Result batchGetItem(array $args = [])
|
|
|
17 |
* @method \GuzzleHttp\Promise\Promise batchGetItemAsync(array $args = [])
|
|
|
18 |
* @method \Aws\Result batchWriteItem(array $args = [])
|
|
|
19 |
* @method \GuzzleHttp\Promise\Promise batchWriteItemAsync(array $args = [])
|
|
|
20 |
* @method \Aws\Result createTable(array $args = [])
|
|
|
21 |
* @method \GuzzleHttp\Promise\Promise createTableAsync(array $args = [])
|
|
|
22 |
* @method \Aws\Result deleteItem(array $args = [])
|
|
|
23 |
* @method \GuzzleHttp\Promise\Promise deleteItemAsync(array $args = [])
|
|
|
24 |
* @method \Aws\Result deleteTable(array $args = [])
|
|
|
25 |
* @method \GuzzleHttp\Promise\Promise deleteTableAsync(array $args = [])
|
|
|
26 |
* @method \Aws\Result describeTable(array $args = [])
|
|
|
27 |
* @method \GuzzleHttp\Promise\Promise describeTableAsync(array $args = [])
|
|
|
28 |
* @method \Aws\Result getItem(array $args = [])
|
|
|
29 |
* @method \GuzzleHttp\Promise\Promise getItemAsync(array $args = [])
|
|
|
30 |
* @method \Aws\Result listTables(array $args = [])
|
|
|
31 |
* @method \GuzzleHttp\Promise\Promise listTablesAsync(array $args = [])
|
|
|
32 |
* @method \Aws\Result putItem(array $args = [])
|
|
|
33 |
* @method \GuzzleHttp\Promise\Promise putItemAsync(array $args = [])
|
|
|
34 |
* @method \Aws\Result query(array $args = [])
|
|
|
35 |
* @method \GuzzleHttp\Promise\Promise queryAsync(array $args = [])
|
|
|
36 |
* @method \Aws\Result scan(array $args = [])
|
|
|
37 |
* @method \GuzzleHttp\Promise\Promise scanAsync(array $args = [])
|
|
|
38 |
* @method \Aws\Result updateItem(array $args = [])
|
|
|
39 |
* @method \GuzzleHttp\Promise\Promise updateItemAsync(array $args = [])
|
|
|
40 |
* @method \Aws\Result updateTable(array $args = [])
|
|
|
41 |
* @method \GuzzleHttp\Promise\Promise updateTableAsync(array $args = [])
|
|
|
42 |
* @method \Aws\Result batchExecuteStatement(array $args = []) (supported in versions 2012-08-10)
|
|
|
43 |
* @method \GuzzleHttp\Promise\Promise batchExecuteStatementAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
44 |
* @method \Aws\Result createBackup(array $args = []) (supported in versions 2012-08-10)
|
|
|
45 |
* @method \GuzzleHttp\Promise\Promise createBackupAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
46 |
* @method \Aws\Result createGlobalTable(array $args = []) (supported in versions 2012-08-10)
|
|
|
47 |
* @method \GuzzleHttp\Promise\Promise createGlobalTableAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
48 |
* @method \Aws\Result deleteBackup(array $args = []) (supported in versions 2012-08-10)
|
|
|
49 |
* @method \GuzzleHttp\Promise\Promise deleteBackupAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
50 |
* @method \Aws\Result describeBackup(array $args = []) (supported in versions 2012-08-10)
|
|
|
51 |
* @method \GuzzleHttp\Promise\Promise describeBackupAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
52 |
* @method \Aws\Result describeContinuousBackups(array $args = []) (supported in versions 2012-08-10)
|
|
|
53 |
* @method \GuzzleHttp\Promise\Promise describeContinuousBackupsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
54 |
* @method \Aws\Result describeContributorInsights(array $args = []) (supported in versions 2012-08-10)
|
|
|
55 |
* @method \GuzzleHttp\Promise\Promise describeContributorInsightsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
56 |
* @method \Aws\Result describeEndpoints(array $args = []) (supported in versions 2012-08-10)
|
|
|
57 |
* @method \GuzzleHttp\Promise\Promise describeEndpointsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
58 |
* @method \Aws\Result describeExport(array $args = []) (supported in versions 2012-08-10)
|
|
|
59 |
* @method \GuzzleHttp\Promise\Promise describeExportAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
60 |
* @method \Aws\Result describeGlobalTable(array $args = []) (supported in versions 2012-08-10)
|
|
|
61 |
* @method \GuzzleHttp\Promise\Promise describeGlobalTableAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
62 |
* @method \Aws\Result describeGlobalTableSettings(array $args = []) (supported in versions 2012-08-10)
|
|
|
63 |
* @method \GuzzleHttp\Promise\Promise describeGlobalTableSettingsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
64 |
* @method \Aws\Result describeImport(array $args = []) (supported in versions 2012-08-10)
|
|
|
65 |
* @method \GuzzleHttp\Promise\Promise describeImportAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
66 |
* @method \Aws\Result describeKinesisStreamingDestination(array $args = []) (supported in versions 2012-08-10)
|
|
|
67 |
* @method \GuzzleHttp\Promise\Promise describeKinesisStreamingDestinationAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
68 |
* @method \Aws\Result describeLimits(array $args = []) (supported in versions 2012-08-10)
|
|
|
69 |
* @method \GuzzleHttp\Promise\Promise describeLimitsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
70 |
* @method \Aws\Result describeTableReplicaAutoScaling(array $args = []) (supported in versions 2012-08-10)
|
|
|
71 |
* @method \GuzzleHttp\Promise\Promise describeTableReplicaAutoScalingAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
72 |
* @method \Aws\Result describeTimeToLive(array $args = []) (supported in versions 2012-08-10)
|
|
|
73 |
* @method \GuzzleHttp\Promise\Promise describeTimeToLiveAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
74 |
* @method \Aws\Result disableKinesisStreamingDestination(array $args = []) (supported in versions 2012-08-10)
|
|
|
75 |
* @method \GuzzleHttp\Promise\Promise disableKinesisStreamingDestinationAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
76 |
* @method \Aws\Result enableKinesisStreamingDestination(array $args = []) (supported in versions 2012-08-10)
|
|
|
77 |
* @method \GuzzleHttp\Promise\Promise enableKinesisStreamingDestinationAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
78 |
* @method \Aws\Result executeStatement(array $args = []) (supported in versions 2012-08-10)
|
|
|
79 |
* @method \GuzzleHttp\Promise\Promise executeStatementAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
80 |
* @method \Aws\Result executeTransaction(array $args = []) (supported in versions 2012-08-10)
|
|
|
81 |
* @method \GuzzleHttp\Promise\Promise executeTransactionAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
82 |
* @method \Aws\Result exportTableToPointInTime(array $args = []) (supported in versions 2012-08-10)
|
|
|
83 |
* @method \GuzzleHttp\Promise\Promise exportTableToPointInTimeAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
84 |
* @method \Aws\Result importTable(array $args = []) (supported in versions 2012-08-10)
|
|
|
85 |
* @method \GuzzleHttp\Promise\Promise importTableAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
86 |
* @method \Aws\Result listBackups(array $args = []) (supported in versions 2012-08-10)
|
|
|
87 |
* @method \GuzzleHttp\Promise\Promise listBackupsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
88 |
* @method \Aws\Result listContributorInsights(array $args = []) (supported in versions 2012-08-10)
|
|
|
89 |
* @method \GuzzleHttp\Promise\Promise listContributorInsightsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
90 |
* @method \Aws\Result listExports(array $args = []) (supported in versions 2012-08-10)
|
|
|
91 |
* @method \GuzzleHttp\Promise\Promise listExportsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
92 |
* @method \Aws\Result listGlobalTables(array $args = []) (supported in versions 2012-08-10)
|
|
|
93 |
* @method \GuzzleHttp\Promise\Promise listGlobalTablesAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
94 |
* @method \Aws\Result listImports(array $args = []) (supported in versions 2012-08-10)
|
|
|
95 |
* @method \GuzzleHttp\Promise\Promise listImportsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
96 |
* @method \Aws\Result listTagsOfResource(array $args = []) (supported in versions 2012-08-10)
|
|
|
97 |
* @method \GuzzleHttp\Promise\Promise listTagsOfResourceAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
98 |
* @method \Aws\Result restoreTableFromBackup(array $args = []) (supported in versions 2012-08-10)
|
|
|
99 |
* @method \GuzzleHttp\Promise\Promise restoreTableFromBackupAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
100 |
* @method \Aws\Result restoreTableToPointInTime(array $args = []) (supported in versions 2012-08-10)
|
|
|
101 |
* @method \GuzzleHttp\Promise\Promise restoreTableToPointInTimeAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
102 |
* @method \Aws\Result tagResource(array $args = []) (supported in versions 2012-08-10)
|
|
|
103 |
* @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
104 |
* @method \Aws\Result transactGetItems(array $args = []) (supported in versions 2012-08-10)
|
|
|
105 |
* @method \GuzzleHttp\Promise\Promise transactGetItemsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
106 |
* @method \Aws\Result transactWriteItems(array $args = []) (supported in versions 2012-08-10)
|
|
|
107 |
* @method \GuzzleHttp\Promise\Promise transactWriteItemsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
108 |
* @method \Aws\Result untagResource(array $args = []) (supported in versions 2012-08-10)
|
|
|
109 |
* @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
110 |
* @method \Aws\Result updateContinuousBackups(array $args = []) (supported in versions 2012-08-10)
|
|
|
111 |
* @method \GuzzleHttp\Promise\Promise updateContinuousBackupsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
112 |
* @method \Aws\Result updateContributorInsights(array $args = []) (supported in versions 2012-08-10)
|
|
|
113 |
* @method \GuzzleHttp\Promise\Promise updateContributorInsightsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
114 |
* @method \Aws\Result updateGlobalTable(array $args = []) (supported in versions 2012-08-10)
|
|
|
115 |
* @method \GuzzleHttp\Promise\Promise updateGlobalTableAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
116 |
* @method \Aws\Result updateGlobalTableSettings(array $args = []) (supported in versions 2012-08-10)
|
|
|
117 |
* @method \GuzzleHttp\Promise\Promise updateGlobalTableSettingsAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
118 |
* @method \Aws\Result updateTableReplicaAutoScaling(array $args = []) (supported in versions 2012-08-10)
|
|
|
119 |
* @method \GuzzleHttp\Promise\Promise updateTableReplicaAutoScalingAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
120 |
* @method \Aws\Result updateTimeToLive(array $args = []) (supported in versions 2012-08-10)
|
|
|
121 |
* @method \GuzzleHttp\Promise\Promise updateTimeToLiveAsync(array $args = []) (supported in versions 2012-08-10)
|
|
|
122 |
*/
|
|
|
123 |
class DynamoDbClient extends AwsClient
|
|
|
124 |
{
|
|
|
125 |
public static function getArguments()
|
|
|
126 |
{
|
|
|
127 |
$args = parent::getArguments();
|
|
|
128 |
$args['retries']['default'] = 10;
|
|
|
129 |
$args['retries']['fn'] = [__CLASS__, '_applyRetryConfig'];
|
|
|
130 |
$args['api_provider']['fn'] = [__CLASS__, '_applyApiProvider'];
|
|
|
131 |
|
|
|
132 |
return $args;
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
/**
|
|
|
136 |
* Convenience method for instantiating and registering the DynamoDB
|
|
|
137 |
* Session handler with this DynamoDB client object.
|
|
|
138 |
*
|
|
|
139 |
* @param array $config Array of options for the session handler factory
|
|
|
140 |
*
|
|
|
141 |
* @return SessionHandler
|
|
|
142 |
*/
|
|
|
143 |
public function registerSessionHandler(array $config = [])
|
|
|
144 |
{
|
|
|
145 |
$handler = SessionHandler::fromClient($this, $config);
|
|
|
146 |
$handler->register();
|
|
|
147 |
|
|
|
148 |
return $handler;
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
/** @internal */
|
|
|
152 |
public static function _applyRetryConfig($value, array &$args, HandlerList $list)
|
|
|
153 |
{
|
|
|
154 |
if ($value) {
|
|
|
155 |
$config = \Aws\Retry\ConfigurationProvider::unwrap($value);
|
|
|
156 |
|
|
|
157 |
if ($config->getMode() === 'legacy') {
|
|
|
158 |
$list->appendSign(
|
|
|
159 |
Middleware::retry(
|
|
|
160 |
RetryMiddleware::createDefaultDecider(
|
|
|
161 |
$config->getMaxAttempts() - 1,
|
|
|
162 |
['error_codes' => ['TransactionInProgressException']]
|
|
|
163 |
),
|
|
|
164 |
function ($retries) {
|
|
|
165 |
return $retries
|
|
|
166 |
? RetryMiddleware::exponentialDelay($retries) / 2
|
|
|
167 |
: 0;
|
|
|
168 |
},
|
|
|
169 |
isset($args['stats']['retries'])
|
|
|
170 |
? (bool)$args['stats']['retries']
|
|
|
171 |
: false
|
|
|
172 |
),
|
|
|
173 |
'retry'
|
|
|
174 |
);
|
|
|
175 |
} else {
|
|
|
176 |
$list->appendSign(
|
|
|
177 |
RetryMiddlewareV2::wrap(
|
|
|
178 |
$config,
|
|
|
179 |
[
|
|
|
180 |
'collect_stats' => $args['stats']['retries'],
|
|
|
181 |
'transient_error_codes' => ['TransactionInProgressException']
|
|
|
182 |
]
|
|
|
183 |
),
|
|
|
184 |
'retry'
|
|
|
185 |
);
|
|
|
186 |
}
|
|
|
187 |
}
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
/** @internal */
|
|
|
191 |
public static function _applyApiProvider($value, array &$args, HandlerList $list)
|
|
|
192 |
{
|
|
|
193 |
ClientResolver::_apply_api_provider($value, $args);
|
|
|
194 |
$args['parser'] = new Crc32ValidatingParser($args['parser']);
|
|
|
195 |
}
|
|
|
196 |
}
|