Файл: includes/library/aws/Aws/Sdk.php
Строк: 237
<?php
namespace Aws;
/**
* Builds AWS clients based on configuration settings.
*
* @method AwsAutoScalingAutoScalingClient createAutoScaling(array $args = [])
* @method AwsCloudFormationCloudFormationClient createCloudFormation(array $args = [])
* @method AwsCloudFrontCloudFrontClient createCloudFront(array $args = [])
* @method AwsCloudHsmCloudHsmClient createCloudHsm(array $args = [])
* @method AwsCloudSearchCloudSearchClient createCloudSearch(array $args = [])
* @method AwsCloudSearchDomainCloudSearchDomainClient createCloudSearchDomain(array $args = [])
* @method AwsCloudTrailCloudTrailClient createCloudTrail(array $args = [])
* @method AwsCloudWatchCloudWatchClient createCloudWatch(array $args = [])
* @method AwsCloudWatchLogsCloudWatchLogsClient createCloudWatchLogs(array $args = [])
* @method AwsCodeDeployCodeDeployClient createCodeDeploy(array $args = [])
* @method AwsCognitoIdentityCognitoIdentityClient createCognitoIdentity(array $args = [])
* @method AwsCognitoSyncCognitoSyncClient createCognitoSync(array $args = [])
* @method AwsConfigServiceConfigServiceClient createConfigService(array $args = [])
* @method AwsDataPipelineDataPipelineClient createDataPipeline(array $args = [])
* @method AwsDirectConnectDirectConnectClient createDirectConnect(array $args = [])
* @method AwsDirectoryServiceDirectoryServiceClient createDirectoryService(array $args = [])
* @method AwsDynamoDbDynamoDbClient createDynamoDb(array $args = [])
* @method AwsEc2Ec2Client createEc2(array $args = [])
* @method AwsEcsEcsClient createEcs(array $args = [])
* @method AwsEfsEfsClient createEfs(array $args = [])
* @method AwsElastiCacheElastiCacheClient createElastiCache(array $args = [])
* @method AwsElasticBeanstalkElasticBeanstalkClient createElasticBeanstalk(array $args = [])
* @method AwsElasticLoadBalancingElasticLoadBalancingClient createElasticLoadBalancing(array $args = [])
* @method AwsElasticTranscoderElasticTranscoderClient createElasticTranscoder(array $args = [])
* @method AwsEmrEmrClient createEmr(array $args = [])
* @method AwsGlacierGlacierClient createGlacier(array $args = [])
* @method AwsIamIamClient createIam(array $args = [])
* @method AwsKinesisKinesisClient createKinesis(array $args = [])
* @method AwsKmsKmsClient createKms(array $args = [])
* @method AwsLambdaLambdaClient createLambda(array $args = [])
* @method AwsMachineLearningMachineLearningClient createMachineLearning(array $args = [])
* @method AwsOpsWorksOpsWorksClient createOpsWorks(array $args = [])
* @method AwsRdsRdsClient createRds(array $args = [])
* @method AwsRedshiftRedshiftClient createRedshift(array $args = [])
* @method AwsRoute53Route53Client createRoute53(array $args = [])
* @method AwsRoute53DomainsRoute53DomainsClient createRoute53Domains(array $args = [])
* @method AwsS3S3Client createS3(array $args = [])
* @method AwsSesSesClient createSes(array $args = [])
* @method AwsSnsSnsClient createSns(array $args = [])
* @method AwsSqsSqsClient createSqs(array $args = [])
* @method AwsSsmSsmClient createSsm(array $args = [])
* @method AwsStorageGatewayStorageGatewayClient createStorageGateway(array $args = [])
* @method AwsStsStsClient createSts(array $args = [])
* @method AwsSupportSupportClient createSupport(array $args = [])
* @method AwsSwfSwfClient createSwf(array $args = [])
* @method AwsWorkSpacesWorkSpacesClient createWorkSpaces(array $args = [])
*/
class Sdk
{
const VERSION = '3.0.6';
/** @var array Arguments for creating clients */
private $args;
/**
* Constructs a new SDK object with an associative array of default
* client settings.
*
* @param array $args
*
* @throws InvalidArgumentException
* @see AwsSdk::getClient for a list of available options.
*/
public function __construct(array $args = [])
{
$this->args = $args;
if (!isset($args['handler']) && !isset($args['http_handler'])) {
$this->args['http_handler'] = default_http_handler();
}
}
public function __call($name, array $args = [])
{
if (strpos($name, 'create') === 0) {
return $this->createClient(
substr($name, 6),
isset($args[0]) ? $args[0] : []
);
}
throw new BadMethodCallException("Unknown method: {$name}.");
}
/**
* 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 AwsClientInterface
* @throws InvalidArgumentException if any required options are missing or
* the service is not supported.
* @see AwsAwsClient::__construct for a list of available options for args.
*/
public function createClient($name, array $args = [])
{
// Get information about the service from the manifest file.
$service = manifest($name);
$namespace = $service['namespace'];
// Merge provided args with stored, service-specific args.
if (isset($this->args[$namespace])) {
$args += $this->args[$namespace];
}
// Provide the endpoint prefix in the args.
if (!isset($args['service'])) {
$args['service'] = $service['endpoint'];
}
// Instantiate the client class.
$client = "Aws\{$namespace}\{$namespace}Client";
return new $client($args + $this->args);
}
/**
* Determine the endpoint prefix from a client namespace.
*
* @param string $name Namespace name
*
* @return string
* @internal
* @deprecated Use the `Awsmanifest()` function instead.
*/
public static function getEndpointPrefix($name)
{
return manifest($name)['endpoint'];
}
}