in src/S3/BucketEndpointArnMiddleware.php [227:343]
private function validateArn($arn)
{
if ($arn instanceof AccessPointArnInterface) {
// Dualstack is not supported with Outposts access points
if ($arn instanceof OutpostsAccessPointArn
&& !empty($this->config['dual_stack'])
) {
throw new UnresolvedEndpointException(
'Dualstack is currently not supported with S3 Outposts access'
. ' points. Please disable dualstack or do not supply an'
. ' access point ARN.');
}
if ($arn instanceof MultiRegionAccessPointArn) {
if (!empty($this->config['disable_multiregion_access_points'])) {
throw new UnresolvedEndpointException(
'Multi-Region Access Point ARNs are disabled, but one was provided. Please'
. ' enable them or provide a different ARN.'
);
}
if (!empty($this->config['dual_stack'])) {
throw new UnresolvedEndpointException(
'Multi-Region Access Point ARNs do not currently support dual stack. Please'
. ' disable dual stack or provide a different ARN.'
);
}
}
// Accelerate is not supported with access points
if (!empty($this->config['accelerate'])) {
throw new UnresolvedEndpointException(
'Accelerate is currently not supported with access points.'
. ' Please disable accelerate or do not supply an access'
. ' point ARN.');
}
// Path-style is not supported with access points
if (!empty($this->config['path_style'])) {
throw new UnresolvedEndpointException(
'Path-style addressing is currently not supported with'
. ' access points. Please disable path-style or do not'
. ' supply an access point ARN.');
}
// Custom endpoint is not supported with access points
if (!is_null($this->config['endpoint'])
&& !$arn instanceof ObjectLambdaAccessPointArn
) {
throw new UnresolvedEndpointException(
'A custom endpoint has been supplied along with an access'
. ' point ARN, and these are not compatible with each other.'
. ' Please only use one or the other.');
}
// Dualstack is not supported with object lambda access points
if ($arn instanceof ObjectLambdaAccessPointArn
&& !empty($this->config['dual_stack'])
) {
throw new UnresolvedEndpointException(
'Dualstack is currently not supported with Object Lambda access'
. ' points. Please disable dualstack or do not supply an'
. ' access point ARN.');
}
// Global endpoints do not support cross-region requests
if ($this->isGlobal($this->region)
&& $this->config['use_arn_region']->isUseArnRegion() == false
&& $arn->getRegion() != $this->region
&& !$arn instanceof MultiRegionAccessPointArn
) {
throw new UnresolvedEndpointException(
'Global endpoints do not support cross region requests.'
. ' Please enable use_arn_region or do not supply a global region'
. ' with a different region in the ARN.');
}
// Get partitions for ARN and client region
$arnPart = $this->partitionProvider->getPartition(
$arn->getRegion(),
's3'
);
$clientPart = $this->partitionProvider->getPartition(
$this->region,
's3'
);
// If client partition not found, try removing pseudo-region qualifiers
if (!($clientPart->isRegionMatch($this->region, 's3'))) {
$clientPart = $this->partitionProvider->getPartition(
\Aws\strip_fips_pseudo_regions($this->region),
's3'
);
}
if (!$arn instanceof MultiRegionAccessPointArn) {
// Verify that the partition matches for supplied partition and region
if ($arn->getPartition() !== $clientPart->getName()) {
throw new InvalidRegionException('The supplied ARN partition'
. " does not match the client's partition.");
}
if ($clientPart->getName() !== $arnPart->getName()) {
throw new InvalidRegionException('The corresponding partition'
. ' for the supplied ARN region does not match the'
. " client's partition.");
}
// Ensure ARN region matches client region unless
// configured for using ARN region over client region
$this->validateMatchingRegion($arn);
// Ensure it is not resolved to fips pseudo-region for S3 Outposts
$this->validateFipsConfigurations($arn);
}
return $arnPart;
}
throw new InvalidArnException('Provided ARN was not a valid S3 access'
. ' point ARN or S3 Outposts access point ARN.');
}