class Aws::S3::Plugins::ARN
def validate_region_config!(arn, region, use_arn_region)
def validate_region_config!(arn, region, use_arn_region) if ['s3-external-1', 'aws-global'].include?(region) # These "regions" are not regional endpoints unless use_arn_region raise Aws::Errors::InvalidARNRegionError, 'Configured client region is not a regional endpoint.' end # These "regions" are in the AWS partition # Cannot use ARN region unless it's the same partition unless arn.partition == 'aws' raise Aws::Errors::InvalidARNPartitionError end else if region.include?('fips') # If ARN type doesn't support FIPS but the client region is FIPS unless arn.support_fips? raise ArgumentError, 'FIPS client regions are not supported for this type '\ 'of ARN.' end fips = true # Normalize the region so we can compare partition and regions region = region.gsub('fips-', '').gsub('-fips', '') end # Raise if the ARN and client regions are in different partitions if use_arn_region && !Aws::Partitions.partition(arn.partition).region?(region) raise Aws::Errors::InvalidARNPartitionError end # Raise if regions mismatch # Either when it's a fips client or not using the ARN region if (!use_arn_region || fips) && region != arn.region raise Aws::Errors::InvalidARNRegionError end end end