transferito
/
vendor
/
aws
/
aws-sdk-php
/
src
/
Endpoint
/
UseDualstackEndpoint
/
Configuration.php
Exception
11 months ago
Configuration.php
11 months ago
ConfigurationInterface.php
11 months ago
ConfigurationProvider.php
11 months ago
Configuration.php
42 lines
| 1 | <?php |
| 2 | namespace Aws\Endpoint\UseDualstackEndpoint; |
| 3 | |
| 4 | use Aws; |
| 5 | use Aws\Endpoint\UseDualstackEndpoint\Exception\ConfigurationException; |
| 6 | |
| 7 | class Configuration implements ConfigurationInterface |
| 8 | { |
| 9 | private $useDualstackEndpoint; |
| 10 | |
| 11 | public function __construct($useDualstackEndpoint, $region) |
| 12 | { |
| 13 | $this->useDualstackEndpoint = Aws\boolean_value($useDualstackEndpoint); |
| 14 | if (is_null($this->useDualstackEndpoint)) { |
| 15 | throw new ConfigurationException("'use_dual_stack_endpoint' config option" |
| 16 | . " must be a boolean value."); |
| 17 | } |
| 18 | if ($this->useDualstackEndpoint == true |
| 19 | && (strpos($region, "iso-") !== false || strpos($region, "-iso") !== false) |
| 20 | ) { |
| 21 | throw new ConfigurationException("Dual-stack is not supported in ISO regions"); } |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * {@inheritdoc} |
| 26 | */ |
| 27 | public function isUseDualstackEndpoint() |
| 28 | { |
| 29 | return $this->useDualstackEndpoint; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * {@inheritdoc} |
| 34 | */ |
| 35 | public function toArray() |
| 36 | { |
| 37 | return [ |
| 38 | 'use_dual_stack_endpoint' => $this->isUseDualstackEndpoint(), |
| 39 | ]; |
| 40 | } |
| 41 | } |
| 42 |