本文整理汇总了PHP中Aws\DynamoDb\DynamoDbClient::listTables方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamoDbClient::listTables方法的具体用法?PHP DynamoDbClient::listTables怎么用?PHP DynamoDbClient::listTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\DynamoDb\DynamoDbClient
的用法示例。
在下文中一共展示了DynamoDbClient::listTables方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createTable
/**
* Create the table
*/
protected static function createTable($wait = false)
{
$tables = self::$dynamodb->listTables();
if (in_array(self::TABLE_NAME, $tables['TableNames'])) {
self::deleteTable(true);
}
self::$dynamodb->createTable(['TableName' => self::TABLE_NAME, 'AttributeDefinitions' => [['AttributeName' => 'key', 'AttributeType' => 'S']], 'KeySchema' => [['AttributeName' => 'key', 'KeyType' => 'HASH']], 'ProvisionedThroughput' => ['ReadCapacityUnits' => 1, 'WriteCapacityUnits' => 1]]);
if (!$wait) {
return;
}
self::$dynamodb->waitUntil('TableExists', ['TableName' => self::TABLE_NAME, 'waiter.interval' => 1, 'waiter.max_attempts' => 5]);
}
示例2: listTables
/**
* List tables via the list_tables call
* @param integer $limit
* @param string $exclusiveStartTableName
* @return Table\TableCollection
*/
public function listTables($limit = null, $exclusiveStartTableName = null)
{
if (null !== $this->logger) {
$this->log('List tables');
}
$parameters = array();
if (null !== $limit) {
$parameters['Limit'] = $limit;
}
if (null !== $exclusiveStartTableName) {
$parameters['ExclusiveStartTableName'] = $exclusiveStartTableName;
}
if (null !== $this->logger) {
$this->log('ListTable request paramaters : ' . print_r($parameters, true), Logger::DEBUG);
}
$response = $this->connector->listTables($parameters);
if (null !== $this->logger) {
$this->log('ListTable request response : ' . print_r($response, true), Logger::DEBUG);
}
$tables = new Table\TableCollection(isset($response['LastEvaluatedTableName']) ? $response['LastEvaluatedTableName'] : null);
if (!empty($response['TableNames'])) {
foreach ($response['TableNames'] as $table) {
$tables->add($table);
}
}
return $tables;
}
示例3: getTables
/**
* @return array
*/
public function getTables()
{
$out = [];
do {
$result = $this->dbConn->listTables(['Limit' => 100, 'ExclusiveStartTableName' => isset($result) ? $result['LastEvaluatedTableName'] : null]);
$out = array_merge($out, $result['TableNames']);
} while ($result['LastEvaluatedTableName']);
return $out;
}
示例4: listTables
/**
* Returns an array of all the tables associated with the current account and endpoint.
*
* @param string $exclusiveStartTableName Name of the table that starts the list.
* @param integer $limit A maximum number of tables to return.
*
* @return Guzzle\Service\Resource\Model
*
* @see http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.DynamoDb.DynamoDbClient.html#_listTables
*/
public function listTables($exclusiveStartTableName = null, $limit = null)
{
$params = [];
if (is_string($exclusiveStartTableName)) {
$params['ExclusiveStartTableName'] = $exclusiveStartTableName;
}
if (is_numeric($limit)) {
$params['Limit'] = $limit;
}
return $this->client->listTables($params);
}
示例5: testListsTables
/**
* @depends testCreatesTable
*/
public function testListsTables()
{
$result = $this->client->listTables();
$this->assertContains($this->table, $result['TableNames']);
}