DynamoDbClient.php
3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
namespace Aws\DynamoDb;
use Aws\Api\Parser\Crc32ValidatingParser;
use Aws\AwsClient;
use Aws\ClientResolver;
use Aws\HandlerList;
use Aws\Middleware;
use Aws\RetryMiddleware;
/**
* This client is used to interact with the **Amazon DynamoDB** service.
*
* @method \Aws\Result batchGetItem(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchGetItemAsync(array $args = [])
* @method \Aws\Result batchWriteItem(array $args = [])
* @method \GuzzleHttp\Promise\Promise batchWriteItemAsync(array $args = [])
* @method \Aws\Result createTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise createTableAsync(array $args = [])
* @method \Aws\Result deleteItem(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteItemAsync(array $args = [])
* @method \Aws\Result deleteTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise deleteTableAsync(array $args = [])
* @method \Aws\Result describeLimits(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeLimitsAsync(array $args = [])
* @method \Aws\Result describeTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise describeTableAsync(array $args = [])
* @method \Aws\Result getItem(array $args = [])
* @method \GuzzleHttp\Promise\Promise getItemAsync(array $args = [])
* @method \Aws\Result listTables(array $args = [])
* @method \GuzzleHttp\Promise\Promise listTablesAsync(array $args = [])
* @method \Aws\Result putItem(array $args = [])
* @method \GuzzleHttp\Promise\Promise putItemAsync(array $args = [])
* @method \Aws\Result query(array $args = [])
* @method \GuzzleHttp\Promise\Promise queryAsync(array $args = [])
* @method \Aws\Result scan(array $args = [])
* @method \GuzzleHttp\Promise\Promise scanAsync(array $args = [])
* @method \Aws\Result updateItem(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateItemAsync(array $args = [])
* @method \Aws\Result updateTable(array $args = [])
* @method \GuzzleHttp\Promise\Promise updateTableAsync(array $args = [])
*/
class DynamoDbClient extends AwsClient
{
public static function getArguments()
{
$args = parent::getArguments();
$args['retries']['default'] = 10;
$args['retries']['fn'] = [__CLASS__, '_applyRetryConfig'];
$args['api_provider']['fn'] = [__CLASS__, '_applyApiProvider'];
return $args;
}
/**
* Convenience method for instantiating and registering the DynamoDB
* Session handler with this DynamoDB client object.
*
* @param array $config Array of options for the session handler factory
*
* @return SessionHandler
*/
public function registerSessionHandler(array $config = [])
{
$handler = SessionHandler::fromClient($this, $config);
$handler->register();
return $handler;
}
/** @internal */
public static function _applyRetryConfig($value, array &$args, HandlerList $list)
{
if (!$value) {
return;
}
$list->appendSign(
Middleware::retry(
RetryMiddleware::createDefaultDecider($value),
function ($retries) {
return $retries
? RetryMiddleware::exponentialDelay($retries) / 2
: 0;
},
isset($args['stats']['retries'])
? (bool) $args['stats']['retries']
: false
),
'retry'
);
}
/** @internal */
public static function _applyApiProvider($value, array &$args, HandlerList $list)
{
ClientResolver::_apply_api_provider($value, $args, $list);
$args['parser'] = new Crc32ValidatingParser($args['parser']);
}
}