PHP 7.4.33
Preview: EndpointRegionHelperTrait.php Size: 3.26 KB
/home/godevadmin/www/admin/vendor/aws/Aws/S3/EndpointRegionHelperTrait.php

<?php
namespace Aws\S3;

use Aws\Api\Service;
use Aws\Arn\ArnInterface;
use Aws\Arn\S3\OutpostsArnInterface;
use Aws\Endpoint\PartitionEndpointProvider;
use Aws\Exception\InvalidRegionException;

/**
 * @internal
 */
trait EndpointRegionHelperTrait
{
    /** @var array */
    private $config;

    /** @var PartitionEndpointProvider */
    private $partitionProvider;

    /** @var string */
    private $region;

    /** @var Service */
    private $service;

    private function getPartitionSuffix(
        ArnInterface $arn,
        PartitionEndpointProvider $provider
    ) {
        $partition = $provider->getPartition(
            $arn->getRegion(),
            $arn->getService()
        );
        return $partition->getDnsSuffix();
    }

    private function getSigningRegion(
        $region,
        $service,
        PartitionEndpointProvider $provider
    ) {
        $partition = $provider->getPartition($region, $service);
        $data = $partition->toArray();
        if (isset($data['services'][$service]['endpoints'][$region]['credentialScope']['region'])) {
            return $data['services'][$service]['endpoints'][$region]['credentialScope']['region'];
        }
        return $region;
    }

    private function isMatchingSigningRegion(
        $arnRegion,
        $clientRegion,
        $service,
        PartitionEndpointProvider $provider
    ) {
        $arnRegion = \Aws\strip_fips_pseudo_regions(strtolower($arnRegion));
        $clientRegion = strtolower($clientRegion);
        if ($arnRegion === $clientRegion) {
            return true;
        }
        if ($this->getSigningRegion($clientRegion, $service, $provider) === $arnRegion) {
            return true;
        }
        return false;
    }

    private function validateFipsConfigurations(ArnInterface $arn)
    {
        $useFipsEndpoint = !empty($this->config['use_fips_endpoint']);
        if ($arn instanceof OutpostsArnInterface) {
            if (empty($this->config['use_arn_region'])
                || !($this->config['use_arn_region']->isUseArnRegion())
            ) {
                $region = $this->region;
            } else {
                $region = $arn->getRegion();
            }
            if (\Aws\is_fips_pseudo_region($region)) {
                throw new InvalidRegionException(
                    'Fips is currently not supported with S3 Outposts access'
                    . ' points. Please provide a non-fips region or do not supply an'
                    . ' access point ARN.');
            }
        }
    }

    private function validateMatchingRegion(ArnInterface $arn)
    {
        if (!($this->isMatchingSigningRegion(
            $arn->getRegion(),
            $this->region,
            $this->service->getEndpointPrefix(),
            $this->partitionProvider)
        )) {
            if (empty($this->config['use_arn_region'])
                || !($this->config['use_arn_region']->isUseArnRegion())
            ) {
                throw new InvalidRegionException('The region'
                    . " specified in the ARN (" . $arn->getRegion()
                    . ") does not match the client region ("
                    . "{$this->region}).");
            }
        }
    }
}

Directory Contents

Dirs: 4 × Files: 28

Name Size Perms Modified Actions
Crypto DIR
- drwxrwxr-x 2024-06-18 20:10:40
Edit Download
Exception DIR
- drwxrwxr-x 2024-06-18 20:10:40
Edit Download
- drwxrwxr-x 2024-06-18 20:10:40
Edit Download
- drwxrwxr-x 2024-06-18 20:10:40
Edit Download
2.30 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
3.91 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
7.71 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
13.47 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
1.94 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
1.76 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
3.26 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
1.34 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
9.05 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
6.14 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
3.99 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
5.85 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
5.25 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
1.76 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
3.99 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
5.49 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
1.59 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
1.47 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
44.55 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
14.46 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
10.56 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
11.39 KB lrwxrwxr-x 2024-06-18 20:10:38
Edit Download
19.68 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
5.07 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
2.31 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
31.62 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
15.52 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
5.23 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).