createClient() public method

Get a client by name using an array of constructor options.
See also: Aws\AwsClient::__construct for a list of available options for args.
public createClient ( string $name, array $args = [] ) : aws\AwsClientInterface
$name string Service name or namespace (e.g., DynamoDb, s3).
$args array Arguments to configure the client.
return aws\AwsClientInterface
Example #1
0
 /**
  * @param AWSCredentials $AWSCredentials
  * @param $service
  *
  * @throws \InvalidArgumentException
  *
  * @return mixed
  */
 public function get(AWSCredentials $AWSCredentials, $service)
 {
     $aws = new Aws($AWSCredentials->getParameters());
     return $aws->createClient($service, $AWSCredentials->getParameters($service));
 }
Example #2
0
 /**
  * Get a client by name using an array of constructor options.
  *
  * @param string $name Service name or namespace (e.g., DynamoDb, s3).
  * @param array $args Arguments to configure the client.
  * @return \Aws\AwsClientInterface
  * @throws \InvalidArgumentException if any required options are missing or
  *                                   the service is not supported.
  * @see Aws\AwsClient::__construct for a list of available options for args.
  * @static
  */
 public static function createClient($name, $args = array())
 {
     return \Aws\Sdk::createClient($name, $args);
 }
 protected function getClientFromConfig($config)
 {
     $awsConfig = ['credentials' => ['key' => $config['key'], 'secret' => $config['secret']], 'region' => $config['region'], 'version' => $config['version']];
     $sdk = new Sdk();
     return $sdk->createClient($config['name'], $awsConfig);
 }
 /**
  * Create aws service clients
  * @param $serviceType
  * @return mixed
  */
 public function createAwsServiceClient($serviceType)
 {
     return $this->sdk->createClient($serviceType);
 }
Example #5
0
 function __construct(Sdk $sdk)
 {
     $this->client = $sdk->createClient('DynamoDb');
     $this->marshaler = new Marshaler();
 }