/home/techb158/ileadtechnology.com/vendor/aws/aws-sdk-php/src/S3Control
Edit: /home/techb158/ileadtechnology.com/vendor/aws/aws-sdk-php/src/S3Control/S3ControlClient.php (14994B)
[
'type' => 'config',
'valid' => ['bool'],
'doc' => 'Set to true to send requests to an S3 Control Dual Stack'
. ' endpoint by default, which enables IPv6 Protocol.'
. ' Can be enabled or disabled on individual operations by setting'
. ' \'@use_dual_stack_endpoint\' to true or false.',
'default' => false,
],
'use_arn_region' => [
'type' => 'config',
'valid' => [
'bool',
Configuration::class,
CacheInterface::class,
'callable'
],
'doc' => 'Set to true to allow passed in ARNs to override'
. ' client region. Accepts...',
'fn' => [__CLASS__, '_apply_use_arn_region'],
'default' => [UseArnRegionConfigurationProvider::class, 'defaultProvider'],
],
];
}
public static function _apply_use_arn_region($value, array &$args, HandlerList $list)
{
if ($value instanceof CacheInterface) {
$value = UseArnRegionConfigurationProvider::defaultProvider($args);
}
if (is_callable($value)) {
$value = $value();
}
if ($value instanceof PromiseInterface) {
$value = $value->wait();
}
if ($value instanceof ConfigurationInterface) {
$args['use_arn_region'] = $value;
} else {
// The Configuration class itself will validate other inputs
$args['use_arn_region'] = new Configuration($value);
}
}
/**
* {@inheritdoc}
*
* In addition to the options available to
* {@see Aws\AwsClient::__construct}, S3ControlClient accepts the following
* option:
*
* - use_dual_stack_endpoint: (bool) Set to true to send requests to an S3
* Control Dual Stack endpoint by default, which enables IPv6 Protocol.
* Can be enabled or disabled on individual operations by setting
* '@use_dual_stack_endpoint\' to true or false. Note:
* you cannot use it together with an accelerate endpoint.
*
* @param array $args
*/
public function __construct(array $args)
{
parent::__construct($args);
if ($this->isUseEndpointV2()) {
$this->processEndpointV2Model();
}
$stack = $this->getHandlerList();
$stack->appendBuild(
EndpointArnMiddleware::wrap(
$this->getApi(),
$this->getRegion(),
[
'use_arn_region' => $this->getConfig('use_arn_region'),
'dual_stack' =>
$this->getConfig('use_dual_stack_endpoint')->isUseDualStackEndpoint(),
'endpoint' => isset($args['endpoint'])
? $args['endpoint']
: null,
'use_fips_endpoint' => $this->getConfig('use_fips_endpoint'),
],
$this->isUseEndpointV2()
),
's3control.endpoint_arn_middleware'
);
}
/**
* Modifies API definition to remove `AccountId`
* host prefix. This is now handled by the endpoint ruleset.
*
* @return void
*
* @internal
*/
private function processEndpointV2Model()
{
$definition = $this->getApi()->getDefinition();
$this->removeHostPrefix($definition);
$this->removeRequiredMember($definition);
$this->getApi()->setDefinition($definition);
}
private function removeHostPrefix(&$definition)
{
foreach($definition['operations'] as &$operation) {
if (isset($operation['endpoint']['hostPrefix'])
&& $operation['endpoint']['hostPrefix'] === '{AccountId}.'
) {
$operation['endpoint']['hostPrefix'] = str_replace(
'{AccountId}.',
'',
$operation['endpoint']['hostPrefix']
);
}
}
}
private function removeRequiredMember(&$definition)
{
foreach($definition['shapes'] as &$shape) {
if (isset($shape['required'])
) {
$found = array_search('AccountId', $shape['required']);
if ($found !== false) {
unset($shape['required'][$found]);
}
}
}
}
}