本文整理汇总了PHP中Aws\DynamoDb\DynamoDbClient::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamoDbClient::factory方法的具体用法?PHP DynamoDbClient::factory怎么用?PHP DynamoDbClient::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\DynamoDb\DynamoDbClient
的用法示例。
在下文中一共展示了DynamoDbClient::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the route.
* This method is invoked after the route is created by the route manager.
*/
public function init()
{
$credentials = new Credentials($this->params['key'], $this->params['secret']);
$this->dynamoDb = DynamoDbClient::factory(['region' => $this->params['region'], 'credentials' => $credentials, 'base_url' => isset($this->params['base_url']) ? $this->params['base_url'] : '']);
$this->tableName = $this->sessionTable;
parent::init();
}
示例2: connect
/**
* (non-PHPdoc)
*
* @see common_persistence_Driver::connect()
*/
function connect($key, array $params)
{
$connectConfig = isset($params['client']) ? $params['client'] : array_intersect_key($params, array_flip(array('key', 'secret', 'region')));
$this->client = DynamoDbClient::factory($connectConfig);
$this->tableName = $params['table'];
return new common_persistence_AdvKeyValuePersistence($params, $this);
}
示例3: __construct
/**
* @param string $key The AWS access Key
* @param string $secret The AWS secret Key
* @param string $region The DynamoDB region endpoint
* @throws \RuntimeException
*/
public function __construct($key, $secret, $region)
{
if (!class_exists('Aws\\DynamoDb\\DynamoDbClient')) {
throw new \RuntimeException('Missing AWS PHP SDK');
}
$this->connector = DynamoDbClient::factory(array('key' => $key, 'secret' => $secret, 'region' => $region, 'version' => '2011-12-05'));
}
示例4: init
/**
* Initialize the dynamodb client.
*/
public function init()
{
parent::init();
//For v2 compatibility.
//TODO: remove deprecated.
$this->_client = DynamoDbClient::factory($this->config);
}
示例5: init
/**
* Initialize the client.
*/
public function init()
{
$this->_client = DynamoDbClient::factory($this->config);
if ($this->keyPrefix === null) {
$this->keyPrefix = substr(md5(Yii::$app->id), 0, 5);
}
parent::init();
}
示例6: __construct
public function __construct($region = false)
{
if (!$region && !($region = getenv("AWS_DEFAULT_REGION"))) {
throw new \Exception("Set 'AWS_DEFAULT_REGION' environment variable!");
}
$this->region = $region;
$this->sns = SnsClient::factory(['region' => $region]);
$this->ddb = DynamoDbClient::factory(['region' => $region]);
}
示例7: __construct
/**
* @param null $table
*/
public function __construct($table = null)
{
if (empty($table)) {
$this->table = ORDER_QUEUE_TABLE_NAME;
} else {
$this->table = $table;
}
/**
* Get client
*/
$this->client = DynamoDbClient::factory(["key" => AWS_TEAM_COMMUNICATION_KEY, "secret" => AWS_TEAM_COMMUNICATION_SECRET, 'region' => AWS_TEAM_COMMUNICATION_TABLE_REGION]);
}
示例8: __construct
public function __construct()
{
$bucket = Config::get('storage.bucket', 'default');
$key = Config::get('storage.key');
$secret = Config::get('storage.secret');
$client = DynamoDbClient::factory(array('key' => $key, 'secret' => $secret, 'region' => '<region name>'));
$config = new SessionHandlerConfig(array('table_name' => 'sessions'));
// Make sure locking strategy has been provided or provide a default
$factory = new LockingStrategyFactory();
$strategy = $factory->factory($strategy, $config);
// Return an instance of the session handler
parent::__construct($client, $strategy, $config);
}
示例9: __construct
public function __construct($connection, $config = array())
{
if (!$connection instanceof DynamoDbClient) {
if (!is_array($connection)) {
throw new \InvalidArgumentException('First argument to OAuth2\\Storage\\Dynamodb must be an instance a configuration array containt key, secret, region');
}
if (!array_key_exists("key", $connection) || !array_key_exists("secret", $connection) || !array_key_exists("region", $connection)) {
throw new \InvalidArgumentException('First argument to OAuth2\\Storage\\Dynamodb must be an instance a configuration array containt key, secret, region');
}
$this->client = DynamoDbClient::factory(array('key' => $connection["key"], 'secret' => $connection["secret"], 'region' => $connection["region"]));
} else {
$this->client = $connection;
}
$this->config = array_merge(array('client_table' => 'oauth_clients', 'access_token_table' => 'oauth_access_tokens', 'refresh_token_table' => 'oauth_refresh_tokens', 'code_table' => 'oauth_authorization_codes', 'user_table' => 'oauth_users', 'jwt_table' => 'oauth_jwt', 'scope_table' => 'oauth_scopes', 'public_key_table' => 'oauth_public_keys'), $config);
}
示例10: get
public static function get()
{
if (LocalDBClientBuilder::$client == null) {
LocalDBClientBuilder::$client = DynamoDbClient::factory(array('region' => 'us-west-2', 'version' => 'latest', 'endpoint' => 'http://localhost:8000', 'key' => 'myKey', 'secret' => 'mySecret'));
// AMO: TODO remove debug plugin
//LocalDBClientBuilder::$client->addSubscriber(LogPlugin::getDebugPlugin());
}
return LocalDBClientBuilder::$client;
/* $sdk = new Aws\Sdk([
'region' => 'us-west-2',
'version' => 'latest',
'endpoint' => 'http://localhost:8080'
]);
$dynamodb = $sdk->createDynamoDb();*/
}
示例11: testClientsUseInstanceProfileCredentials
/**
* @depends testUsesInstanceProfileCredentialsByDefault
*/
public function testClientsUseInstanceProfileCredentials(array $creds)
{
$this->skipIfNotEc2();
list($credentials, $client) = $creds;
$dynamo = DynamoDbClient::factory(array('credentials' => $credentials));
// Ensure that the correct credentials object and client are being used
$this->assertSame($credentials, $dynamo->getCredentials());
if ($this->useMocks()) {
$this->setMockResponse($client, array('metadata/iam_security_credentials', 'metadata/iam_security_credentials_webapp'));
$this->setMockResponse($dynamo, 'dynamodb/list_tables_final');
}
// Expire the credentials
$credentials->setExpiration(0);
// List a table, causing a credential refresh and list table request
$this->assertInternalType('array', $dynamo->listTables());
}
开发者ID:njbhatt18,项目名称:Amazon_API,代码行数:19,代码来源:RefreshableInstanceProfileCredentialsIntegrationTest.php
示例12: __construct
public function __construct($options, $table)
{
// refer to the Session class to find the session timeout value (if it exists)
// in terms of DynamoDB, session_lifetime is the time to mark the inactive
// session to be garbage collected
// if {@link GarbageCollectSessionCronTask} is running periodically on your
// server (via the silverstripe-crontask module), then the inactive session
// will get removed from the DynamoDB session table.
if (!isset($options['session_lifetime'])) {
$timeout = Config::inst()->get('Session', 'timeout');
if ($timeout != null) {
$options['session_lifetime'] = $timeout;
}
}
$this->client = DynamoDbClient::factory($options);
$this->table = $table;
$this->handler = SessionHandler::factory(array('dynamodb_client' => $this->client, 'table_name' => $this->table));
}
示例13: getNonceObjectByDatabaseType
/**
* @return NonceInterface
*/
private function getNonceObjectByDatabaseType($app)
{
$connection = $app['config']->get('vjroby-laravel-nonce::database_connection');
switch ($app['config']->get('vjroby-laravel-nonce::database_type')) {
case self::DATABASE_TYPE_DYNAMODB:
if (isset($this->client)) {
return $this->client;
}
$dynamoDbDomain = App::make('aws')->get('DynamoDb');
$client = DynamoDbClient::factory(['credentials' => $dynamoDbDomain->getCredentials(), 'region' => $app['config']->get('vjroby-laravel-nonce::dynamodb_table_region')]);
$nonceDynamo = new NonceDynamoStorage();
$nonceDynamo->setClient($client);
$nonceDynamo->setTableName($app['config']->get('vjroby-laravel-nonce::dynamodb_table_name'));
return $nonceDynamo;
break;
case self::DATABASE_TYPE_MYSQL:
return new Nonce($connection);
break;
default:
return new Nonce($connection);
break;
}
}
示例14: setupSession
public function setupSession() {
if( defined('DEBUG') ){
session_start();
return;
}
$client = DynamoDbClient::factory(array(
'key' => 'AKIAIDBPOWSJGOKXMFXQ',
'secret' => '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',
'region' => Region::EU_WEST_1
));
$sessionHandler = $client->registerSessionHandler(
array('table_name' => 'session_table',
'hash_key' => 'id',
'lifetime' => 86400,
'session_locking' => false));
session_start();
}
示例15: array
echo "<option value='pdf materials'>PDF Materials</option>";
echo "</optgroup>";
echo "</select></label></br>";
echo "<label>Upload Image:</label>";
echo "<input type='file' name='image'><br>";
echo "<input type='submit' value='Add to basket'>";
echo "</form>";
echo "<form action='sellsure.php' method='post'>";
echo "<input type='submit' value='Go back to search page'>";
echo "</form>";
require 'aws-autoloader.php';
use Aws\DynamoDb\DynamoDbClient;
use Aws\Common\Enum\Region;
use Aws\DynamoDb\Enum\Type;
use Aws\S3\S3Client;
$client = DynamoDbClient::factory(array('credentials' => array('key' => 'key', 'secret' => 'secret'), 'region' => 'us-east-1'));
if (isset($_POST['itemname']) && isset($_POST['itemdesc'])) {
$category = @$_POST['category'];
$itemid = uniqid();
$itemname = $_POST['itemname'];
$itemdescription = $_POST['itemdesc'];
$image_name = @$_FILES['image']['name'];
$image_temp = @$_FILES['image']['tmp_name'];
$image_type = pathinfo($image_name, PATHINFO_EXTENSION);
$size = @$_FILES['image']['size'];
/*echo $userid;
echo "<br>";
echo $itemid;
echo "<br>";
echo $itemdescription;
echo "<br>";