Merge pull request #12166 from helmutschneider/aws-2.7.5
Upgrade AWS sdk to 2.7.5. Fixes #12023remotes/origin/fix-10825
commit
1be5a3ca89
@ -0,0 +1,64 @@ |
||||
<?php |
||||
return array( |
||||
'version' => 2, |
||||
'endpoints' => array( |
||||
'*/*' => array( |
||||
'endpoint' => '{service}.{region}.amazonaws.com' |
||||
), |
||||
'cn-north-1/*' => array( |
||||
'endpoint' => '{service}.{region}.amazonaws.com.cn', |
||||
'signatureVersion' => 'v4' |
||||
), |
||||
'us-gov-west-1/iam' => array( |
||||
'endpoint' => 'iam.us-gov.amazonaws.com' |
||||
), |
||||
'us-gov-west-1/sts' => array( |
||||
'endpoint' => 'sts.us-gov.amazonaws.com' |
||||
), |
||||
'us-gov-west-1/s3' => array( |
||||
'endpoint' => 's3-{region}.amazonaws.com' |
||||
), |
||||
'*/cloudfront' => array( |
||||
'endpoint' => 'cloudfront.amazonaws.com' |
||||
), |
||||
'*/iam' => array( |
||||
'endpoint' => 'iam.amazonaws.com' |
||||
), |
||||
'*/importexport' => array( |
||||
'endpoint' => 'importexport.amazonaws.com' |
||||
), |
||||
'*/route53' => array( |
||||
'endpoint' => 'route53.amazonaws.com' |
||||
), |
||||
'*/sts' => array( |
||||
'endpoint' => 'sts.amazonaws.com' |
||||
), |
||||
'us-east-1/sdb' => array( |
||||
'endpoint' => 'sdb.amazonaws.com' |
||||
), |
||||
'us-east-1/s3' => array( |
||||
'endpoint' => 's3.amazonaws.com' |
||||
), |
||||
'us-west-1/s3' => array( |
||||
'endpoint' => 's3-{region}.amazonaws.com' |
||||
), |
||||
'us-west-2/s3' => array( |
||||
'endpoint' => 's3-{region}.amazonaws.com' |
||||
), |
||||
'eu-west-1/s3' => array( |
||||
'endpoint' => 's3-{region}.amazonaws.com' |
||||
), |
||||
'ap-southeast-1/s3' => array( |
||||
'endpoint' => 's3-{region}.amazonaws.com' |
||||
), |
||||
'ap-southeast-2/s3' => array( |
||||
'endpoint' => 's3-{region}.amazonaws.com' |
||||
), |
||||
'ap-northeast-1/s3' => array( |
||||
'endpoint' => 's3-{region}.amazonaws.com' |
||||
), |
||||
'sa-east-1/s3' => array( |
||||
'endpoint' => 's3-{region}.amazonaws.com' |
||||
) |
||||
) |
||||
); |
@ -0,0 +1,67 @@ |
||||
<?php |
||||
namespace Aws\Common; |
||||
|
||||
/** |
||||
* Provides endpoints based on a rules configuration file. |
||||
*/ |
||||
class RulesEndpointProvider |
||||
{ |
||||
/** @var array */ |
||||
private $patterns; |
||||
|
||||
/** |
||||
* @param array $patterns Hash of endpoint patterns mapping to endpoint |
||||
* configurations. |
||||
*/ |
||||
public function __construct(array $patterns) |
||||
{ |
||||
$this->patterns = $patterns; |
||||
} |
||||
|
||||
/** |
||||
* Creates and returns the default RulesEndpointProvider based on the |
||||
* public rule sets. |
||||
* |
||||
* @return self |
||||
*/ |
||||
public static function fromDefaults() |
||||
{ |
||||
return new self(require __DIR__ . '/Resources/public-endpoints.php'); |
||||
} |
||||
|
||||
public function __invoke(array $args = array()) |
||||
{ |
||||
if (!isset($args['service'])) { |
||||
throw new \InvalidArgumentException('Requires a "service" value'); |
||||
} |
||||
|
||||
if (!isset($args['region'])) { |
||||
throw new \InvalidArgumentException('Requires a "region" value'); |
||||
} |
||||
|
||||
foreach ($this->getKeys($args['region'], $args['service']) as $key) { |
||||
if (isset($this->patterns['endpoints'][$key])) { |
||||
return $this->expand($this->patterns['endpoints'][$key], $args); |
||||
} |
||||
} |
||||
|
||||
throw new \RuntimeException('Could not resolve endpoint'); |
||||
} |
||||
|
||||
private function expand(array $config, array $args) |
||||
{ |
||||
$scheme = isset($args['scheme']) ? $args['scheme'] : 'https'; |
||||
$config['endpoint'] = $scheme . '://' . str_replace( |
||||
array('{service}', '{region}'), |
||||
array($args['service'], $args['region']), |
||||
$config['endpoint'] |
||||
); |
||||
|
||||
return $config; |
||||
} |
||||
|
||||
private function getKeys($region, $service) |
||||
{ |
||||
return array("$region/$service", "$region/*", "*/$service", "*/*"); |
||||
} |
||||
} |
@ -1,14 +1,24 @@ |
||||
<?php |
||||
namespace { |
||||
class A {} |
||||
class A |
||||
{ |
||||
} |
||||
} |
||||
|
||||
namespace Alpha { |
||||
class A {} |
||||
class B {} |
||||
class A |
||||
{ |
||||
} |
||||
class B |
||||
{ |
||||
} |
||||
} |
||||
|
||||
namespace Beta { |
||||
class A {} |
||||
class B {} |
||||
class A |
||||
{ |
||||
} |
||||
class B |
||||
{ |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue