diff --git a/.changes/next-release/service.wildcard-bugfix-1617228709351413000.json b/.changes/next-release/service.wildcard-bugfix-1617228709351413000.json new file mode 100644 index 00000000000..315f2c64f59 --- /dev/null +++ b/.changes/next-release/service.wildcard-bugfix-1617228709351413000.json @@ -0,0 +1,267 @@ +{ + "ID": "service.wildcard-bugfix-1617228709351413000", + "SchemaVersion": 1, + "Module": "service/...", + "Type": "bugfix", + "Description": "Refactored internal endpoints model for accessors", + "MinVersion": "", + "AffectedModules": [ + "service/accessanalyzer", + "service/acm", + "service/acmpca", + "service/alexaforbusiness", + "service/amp", + "service/amplify", + "service/amplifybackend", + "service/apigateway", + "service/apigatewaymanagementapi", + "service/apigatewayv2", + "service/appconfig", + "service/appflow", + "service/appintegrations", + "service/applicationautoscaling", + "service/applicationdiscoveryservice", + "service/applicationinsights", + "service/appmesh", + "service/appstream", + "service/appsync", + "service/athena", + "service/auditmanager", + "service/autoscaling", + "service/autoscalingplans", + "service/backup", + "service/batch", + "service/braket", + "service/budgets", + "service/chime", + "service/cloud9", + "service/clouddirectory", + "service/cloudformation", + "service/cloudfront", + "service/cloudhsm", + "service/cloudhsmv2", + "service/cloudsearch", + "service/cloudsearchdomain", + "service/cloudtrail", + "service/cloudwatch", + "service/cloudwatchevents", + "service/cloudwatchlogs", + "service/codeartifact", + "service/codebuild", + "service/codecommit", + "service/codedeploy", + "service/codeguruprofiler", + "service/codegurureviewer", + "service/codepipeline", + "service/codestar", + "service/codestarconnections", + "service/codestarnotifications", + "service/cognitoidentity", + "service/cognitoidentityprovider", + "service/cognitosync", + "service/comprehend", + "service/comprehendmedical", + "service/computeoptimizer", + "service/configservice", + "service/connect", + "service/connectcontactlens", + "service/connectparticipant", + "service/costandusagereportservice", + "service/costexplorer", + "service/customerprofiles", + "service/databasemigrationservice", + "service/databrew", + "service/dataexchange", + "service/datapipeline", + "service/datasync", + "service/dax", + "service/detective", + "service/devicefarm", + "service/devopsguru", + "service/directconnect", + "service/directoryservice", + "service/dlm", + "service/docdb", + "service/dynamodb", + "service/dynamodbstreams", + "service/ebs", + "service/ec2", + "service/ec2instanceconnect", + "service/ecr", + "service/ecrpublic", + "service/ecs", + "service/efs", + "service/eks", + "service/elasticache", + "service/elasticbeanstalk", + "service/elasticinference", + "service/elasticloadbalancing", + "service/elasticloadbalancingv2", + "service/elasticsearchservice", + "service/elastictranscoder", + "service/emr", + "service/emrcontainers", + "service/eventbridge", + "service/firehose", + "service/fis", + "service/fms", + "service/forecast", + "service/forecastquery", + "service/frauddetector", + "service/fsx", + "service/gamelift", + "service/glacier", + "service/globalaccelerator", + "service/glue", + "service/greengrass", + "service/greengrassv2", + "service/groundstation", + "service/guardduty", + "service/health", + "service/healthlake", + "service/honeycode", + "service/iam", + "service/identitystore", + "service/imagebuilder", + "service/inspector", + "service/iot", + "service/iot1clickdevicesservice", + "service/iot1clickprojects", + "service/iotanalytics", + "service/iotdataplane", + "service/iotdeviceadvisor", + "service/iotevents", + "service/ioteventsdata", + "service/iotfleethub", + "service/iotjobsdataplane", + "service/iotsecuretunneling", + "service/iotsitewise", + "service/iotthingsgraph", + "service/iotwireless", + "service/ivs", + "service/kafka", + "service/kendra", + "service/kinesis", + "service/kinesisanalytics", + "service/kinesisanalyticsv2", + "service/kinesisvideo", + "service/kinesisvideoarchivedmedia", + "service/kinesisvideomedia", + "service/kinesisvideosignaling", + "service/kms", + "service/lakeformation", + "service/lambda", + "service/lexmodelbuildingservice", + "service/lexmodelsv2", + "service/lexruntimeservice", + "service/lexruntimev2", + "service/licensemanager", + "service/lightsail", + "service/lookoutvision", + "service/machinelearning", + "service/macie", + "service/macie2", + "service/managedblockchain", + "service/marketplacecatalog", + "service/marketplacecommerceanalytics", + "service/marketplaceentitlementservice", + "service/marketplacemetering", + "service/mediaconnect", + "service/mediaconvert", + "service/medialive", + "service/mediapackage", + "service/mediapackagevod", + "service/mediastore", + "service/mediastoredata", + "service/mediatailor", + "service/migrationhub", + "service/migrationhubconfig", + "service/mobile", + "service/mq", + "service/mturk", + "service/mwaa", + "service/neptune", + "service/networkfirewall", + "service/networkmanager", + "service/opsworks", + "service/opsworkscm", + "service/organizations", + "service/outposts", + "service/personalize", + "service/personalizeevents", + "service/personalizeruntime", + "service/pi", + "service/pinpoint", + "service/pinpointemail", + "service/pinpointsmsvoice", + "service/polly", + "service/pricing", + "service/qldb", + "service/qldbsession", + "service/quicksight", + "service/ram", + "service/rds", + "service/rdsdata", + "service/redshift", + "service/redshiftdata", + "service/rekognition", + "service/resourcegroups", + "service/resourcegroupstaggingapi", + "service/robomaker", + "service/route53", + "service/route53domains", + "service/route53resolver", + "service/s3", + "service/s3control", + "service/s3control/internal/endpoints/s3/endpoints.go", + "service/s3outposts", + "service/sagemaker", + "service/sagemakera2iruntime", + "service/sagemakeredge", + "service/sagemakerfeaturestoreruntime", + "service/sagemakerruntime", + "service/savingsplans", + "service/schemas", + "service/secretsmanager", + "service/securityhub", + "service/serverlessapplicationrepository", + "service/servicecatalog", + "service/servicecatalogappregistry", + "service/servicediscovery", + "service/servicequotas", + "service/ses", + "service/sesv2", + "service/sfn", + "service/shield", + "service/signer", + "service/sms", + "service/snowball", + "service/sns", + "service/sqs", + "service/ssm", + "service/sso", + "service/ssoadmin", + "service/ssooidc", + "service/storagegateway", + "service/sts", + "service/support", + "service/swf", + "service/synthetics", + "service/textract", + "service/timestreamquery", + "service/timestreamwrite", + "service/transcribe", + "service/transfer", + "service/translate", + "service/waf", + "service/wafregional", + "service/wafv2", + "service/wellarchitected", + "service/workdocs", + "service/worklink", + "service/workmail", + "service/workmailmessageflow", + "service/workspaces", + "service/xray" + ] +} \ No newline at end of file diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEndpointGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEndpointGenerator.java index 28291d024d1..da3663147af 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEndpointGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEndpointGenerator.java @@ -17,6 +17,7 @@ import java.util.List; import java.util.function.Consumer; +import software.amazon.smithy.aws.traits.ServiceTrait; import software.amazon.smithy.codegen.core.SymbolProvider; import software.amazon.smithy.go.codegen.GoSettings; import software.amazon.smithy.go.codegen.GoWriter; @@ -43,7 +44,16 @@ public void writeAdditionalFiles( SymbolProvider symbolProvider, TriConsumer> writerFactory ) { - new EndpointGenerator(settings, model, writerFactory).run(); + String serviceId = settings.getService(model).expectTrait(ServiceTrait.class).getSdkId(); + boolean generateQueryHelpers = serviceId.equalsIgnoreCase("S3"); + + EndpointGenerator.builder() + .settings(settings) + .model(model) + .writerFactory(writerFactory) + .modelQueryHelpers(generateQueryHelpers) + .build() + .run(); } @Override diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java index ba7ee133140..7a67c9d6d4a 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java @@ -39,12 +39,13 @@ import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.utils.IoUtils; import software.amazon.smithy.utils.ListUtils; +import software.amazon.smithy.utils.SmithyBuilder; /** * Writes out a file that resolves endpoints using endpoints.json, but the * created resolver resolves endpoints for a single service. */ -public class EndpointGenerator implements Runnable { +public final class EndpointGenerator implements Runnable { public static final String MIDDLEWARE_NAME = "ResolveEndpoint"; public static final String ADD_MIDDLEWARE_HELPER_NAME = String.format("add%sMiddleware", MIDDLEWARE_NAME); public static final String RESOLVER_INTERFACE_NAME = "EndpointResolver"; @@ -53,6 +54,7 @@ public class EndpointGenerator implements Runnable { public static final String CLIENT_CONFIG_RESOLVER = "resolveDefaultEndpointConfiguration"; public static final String RESOLVER_CONSTRUCTOR_NAME = "NewDefaultEndpointResolver"; public static final String AWS_ENDPOINT_RESOLVER_HELPER = "withEndpointResolver"; + private static final String EndpointResolverFromURL = "EndpointResolverFromURL"; private static final String ENDPOINT_SOURCE_CUSTOM = "EndpointSourceCustom"; private static final Symbol AWS_ENDPOINT = SymbolUtils.createPointableSymbolBuilder( @@ -78,42 +80,36 @@ public class EndpointGenerator implements Runnable { private final ObjectNode endpointData; private final String endpointPrefix; private final Map partitions = new TreeMap<>(); - private final Boolean isInternalOnly; + private final boolean isInternalOnly; + private final boolean isGenerateModelQueryHelpers; private final String resolvedSdkID; - public EndpointGenerator( - GoSettings settings, - Model model, - TriConsumer> writerFactory - ) { - this( - settings, - model, - writerFactory, - settings.getService(model).expectTrait(ServiceTrait.class) - .getSdkId(), - settings.getService(model).expectTrait(ServiceTrait.class) - .getArnNamespace(), - false - ); - } - - public EndpointGenerator( - GoSettings settings, - Model model, - TriConsumer> writerFactory, - String sdkID, - String arnNamespace, - Boolean internalOnly - ) { - this.settings = settings; - this.model = model; - this.writerFactory = writerFactory; + private EndpointGenerator(Builder builder) { + settings = SmithyBuilder.requiredState("settings", builder.settings); + model = SmithyBuilder.requiredState("model", builder.model); + writerFactory = SmithyBuilder.requiredState("writerFactory", builder.writerFactory); + isInternalOnly = builder.internalOnly; serviceShape = settings.getService(model); - this.endpointPrefix = getEndpointPrefix(sdkID, arnNamespace); - this.endpointData = Node.parse(IoUtils.readUtf8Resource(getClass(), "endpoints.json")).expectObjectNode(); - this.isInternalOnly = internalOnly; - this.resolvedSdkID = sdkID; + isGenerateModelQueryHelpers = builder.modelQueryHelpers; + + ServiceTrait serviceTrait = serviceShape.expectTrait(ServiceTrait.class); + + if (builder.sdkID != null) { + resolvedSdkID = builder.sdkID; + } else { + resolvedSdkID = serviceTrait.getSdkId(); + } + + String arnNamespace; + if (builder.arnNamespace != null) { + arnNamespace = builder.arnNamespace; + } else { + arnNamespace = serviceTrait.getArnNamespace(); + } + + endpointPrefix = getEndpointPrefix(resolvedSdkID, arnNamespace); + endpointData = Node.parse(IoUtils.readUtf8Resource(getClass(), "endpoints.json")).expectObjectNode(); + validateVersion(); loadPartitions(); } @@ -165,6 +161,9 @@ public void run() { writerFactory.accept(pkgName + "/endpoints.go", getInternalEndpointImportPath(), (writer) -> { generateInternalResolverImplementation(writer); generateInternalEndpointsModel(writer); + if (isGenerateModelQueryHelpers) { + generateInternalModelHelpers(writer); + } }); if (!this.isInternalOnly) { @@ -180,6 +179,46 @@ public void run() { } + private void generateInternalModelHelpers(GoWriter writer) { + generateDNSSuffixFunction(writer); + generateDNSSuffixFromRegionFunction(writer); + } + + private void generateDNSSuffixFunction(GoWriter writer) { + writer.addUseImports(SmithyGoDependency.FMT); + writer.writeDocs("GetDNSSuffix returns the dnsSuffix URL component for the given partition id"); + writer.openBlock("func GetDNSSuffix(id string) (string, error) {", "}", () -> { + Symbol equalFold = SymbolUtils.createValueSymbolBuilder("EqualFold", SmithyGoDependency.STRINGS) + .build(); + writer.openBlock("switch {", "}", () -> { + partitions.forEach((s, partition) -> { + writer.openBlock("case $T(id, $S):", "", equalFold, partition.id, () -> { + writer.write("return $S, nil", partition.dnsSuffix); + }); + }); + writer.openBlock("default:", "", () -> writer.write("return \"\", fmt.Errorf(\"unknown partition\")")); + }); + }); + writer.write(""); + } + + private void generateDNSSuffixFromRegionFunction(GoWriter writer) { + writer.addUseImports(SmithyGoDependency.FMT); + writer.writeDocs("GetDNSSuffixFromRegion returns the dnsSuffix URL component for the given partition id"); + writer.openBlock("func GetDNSSuffixFromRegion(region string) (string, error) {", "}", () -> { + writer.openBlock("switch {", "}", () -> { + getSortedPartitions().forEach(partition -> { + writer.openBlock("case partitionRegexp.$L.MatchString(region):", "", + getPartitionIDFieldName(partition.getId()), () -> { + writer.write("return $S, nil", partition.dnsSuffix); + }); + }); + writer.openBlock("default:", "", () -> writer.write("return \"\", fmt.Errorf(\"unknown region partition\")")); + }); + }); + writer.write(""); + } + private void generateAwsEndpointResolverWrapper(GoWriter writer) { Symbol awsEndpointResolver = SymbolUtils.createValueSymbolBuilder("EndpointResolver", AwsGoDependency.AWS_CORE) .build(); @@ -380,9 +419,9 @@ private void generatePublicResolverTypes(GoWriter writer) { // Generate EndpointResolverFromURL helper writer.writeDocs(String.format("%s returns an EndpointResolver configured using the provided endpoint url. " - + "By default, the resolved endpoint resolver uses the client region as signing region, and " - + "the endpoint source is set to EndpointSourceCustom." - + "You can provide functional options to configure endpoint values for the resolved endpoint.", + + "By default, the resolved endpoint resolver uses the client region as signing region, and " + + "the endpoint source is set to EndpointSourceCustom." + + "You can provide functional options to configure endpoint values for the resolved endpoint.", EndpointResolverFromURL)); writer.openBlock("func $L(url string, optFns ...func($P)) EndpointResolver {", "}", EndpointResolverFromURL, AWS_ENDPOINT, () -> { @@ -493,27 +532,66 @@ private void generateInternalResolverImplementation(GoWriter writer) { })); } + private static String getPartitionIDFieldName(String id) { + StringBuilder builder = new StringBuilder(); + + char[] charArray = id.toCharArray(); + boolean capitalize = true; + for (int i = 0; i < charArray.length; i++) { + if (!Character.isAlphabetic(charArray[i])) { + capitalize = true; + continue; + } + + if (capitalize) { + builder.append(Character.toUpperCase(charArray[i])); + capitalize = false; + } else { + builder.append(Character.toLowerCase(charArray[i])); + } + } + + return builder.toString(); + } + private void generateInternalEndpointsModel(GoWriter writer) { writer.addUseImports(AwsGoDependency.AWS_ENDPOINTS); + List sortedPartitions = getSortedPartitions(); + + writer.openBlock("var partitionRegexp = struct{", "}{", () -> { + sortedPartitions.forEach(partition -> { + writer.write("$L $P", getPartitionIDFieldName(partition.getId()), + SymbolUtils.createPointableSymbolBuilder("Regexp", AwsGoDependency.REGEXP).build()); + }); + }).openBlock("", "}", () -> { + sortedPartitions.forEach(partition -> { + writer.write("$L: regexp.MustCompile($S),", getPartitionIDFieldName(partition.getId()), + partition.getConfig().expectStringMember("regionRegex").getValue()); + }); + }); + writer.write(""); + Symbol partitionsSymbol = SymbolUtils.createPointableSymbolBuilder("Partitions", AwsGoDependency.AWS_ENDPOINTS) .build(); writer.openBlock("var $L = $T{", "}", INTERNAL_ENDPOINTS_DATA_NAME, partitionsSymbol, () -> { - List entries = partitions.entrySet().stream() - .sorted((x, y) -> { - // Always sort standard aws partition first - if (x.getKey().equals("aws")) { - return -1; - } - return x.getKey().compareTo(y.getKey()); - }).map(Map.Entry::getValue).collect(Collectors.toList()); - - entries.forEach(entry -> { + sortedPartitions.forEach(entry -> { writer.openBlock("{", "},", () -> writePartition(writer, entry)); }); }); } + private List getSortedPartitions() { + return partitions.entrySet().stream() + .sorted((x, y) -> { + // Always sort standard aws partition first + if (x.getKey().equals("aws")) { + return -1; + } + return x.getKey().compareTo(y.getKey()); + }).map(Map.Entry::getValue).collect(Collectors.toList()); + } + private void writePartition(GoWriter writer, Partition partition) { writer.write("ID: $S,", partition.getId()); Symbol endpointSymbol = SymbolUtils.createValueSymbolBuilder("Endpoint", @@ -522,8 +600,7 @@ private void writePartition(GoWriter writer, Partition partition) { () -> writeEndpoint(writer, partition.getDefaults())); writer.addUseImports(AwsGoDependency.REGEXP); - writer.write("RegionRegex: regexp.MustCompile($S),", partition.getConfig().expectStringMember("regionRegex") - .getValue()); + writer.write("RegionRegex: partitionRegexp.$L,", getPartitionIDFieldName(partition.getId())); Optional optionalPartitionEndpoint = partition.getPartitionEndpoint(); Symbol isRegionalizedValue = SymbolUtils.createValueSymbolBuilder(optionalPartitionEndpoint.isPresent() @@ -694,4 +771,58 @@ public ObjectNode getConfig() { return config; } } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder implements SmithyBuilder { + private GoSettings settings; + private Model model; + private TriConsumer> writerFactory; + private boolean internalOnly; + private boolean modelQueryHelpers; + private String sdkID; + private String arnNamespace; + + public Builder settings(GoSettings settings) { + this.settings = settings; + return this; + } + + public Builder model(Model model) { + this.model = model; + return this; + } + + public Builder writerFactory(TriConsumer> writerFactory) { + this.writerFactory = writerFactory; + return this; + } + + public Builder internalOnly(boolean internalOnly) { + this.internalOnly = internalOnly; + return this; + } + + public Builder modelQueryHelpers(boolean modelQueryHelpers) { + this.modelQueryHelpers = modelQueryHelpers; + return this; + } + + public Builder sdkID(String sdkID) { + this.sdkID = sdkID; + return this; + } + + public Builder arnNamespace(String arnNamespace) { + this.arnNamespace = arnNamespace; + return this; + } + + @Override + public EndpointGenerator build() { + return new EndpointGenerator(this); + } + } } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ControlEndpointResolver.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ControlEndpointResolver.java index 07088d17899..3293eaca4f0 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ControlEndpointResolver.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ControlEndpointResolver.java @@ -13,7 +13,7 @@ * S3ControlEndpointResolverCustomizations adds an internal endpoint resolver * for s3 service endpoints */ -public class S3ControlEndpointResolver implements GoIntegration { +public class S3ControlEndpointResolver implements GoIntegration { @Override public void writeAdditionalFiles( @@ -22,11 +22,19 @@ public void writeAdditionalFiles( SymbolProvider symbolProvider, TriConsumer> writerFactory ) { - if (!S3ModelUtils.isServiceS3Control(model, settings.getService(model))){ - return; + if (!S3ModelUtils.isServiceS3Control(model, settings.getService(model))) { + return; } // Generate S3 internal endpoint resolver for S3 Control service - new EndpointGenerator(settings, model, writerFactory,"S3","s3", true).run(); + EndpointGenerator.builder() + .settings(settings) + .model(model) + .writerFactory(writerFactory) + .sdkID("S3") + .arnNamespace("s3") + .internalOnly(true) + .build() + .run(); } } diff --git a/config/go.sum b/config/go.sum index 5bcd0a6cb9f..b8b430c5c70 100644 --- a/config/go.sum +++ b/config/go.sum @@ -1,5 +1,4 @@ github.com/aws/smithy-go v1.2.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/aws/smithy-go v1.2.1-0.20210330191137-b290458ce30a/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.2.1-0.20210330205207-0917d08124fa h1:63Pm+ZJp4/4S5eVtp+C4+cnJvo4s8UZX7+0BDDmHXI8= github.com/aws/smithy-go v1.2.1-0.20210330205207-0917d08124fa/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go b/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go index 51a4c5e8c23..957e7a6b44d 100644 --- a/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go +++ b/internal/protocoltest/awsrestjson/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/internal/protocoltest/ec2query/internal/endpoints/endpoints.go b/internal/protocoltest/ec2query/internal/endpoints/endpoints.go index ba00970dcd4..fd1298187c6 100644 --- a/internal/protocoltest/ec2query/internal/endpoints/endpoints.go +++ b/internal/protocoltest/ec2query/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go b/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go index f5af828da0c..99e00b4aed7 100644 --- a/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go +++ b/internal/protocoltest/jsonrpc/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go b/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go index 139826f10c5..1b325caf10a 100644 --- a/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go +++ b/internal/protocoltest/jsonrpc10/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/internal/protocoltest/query/internal/endpoints/endpoints.go b/internal/protocoltest/query/internal/endpoints/endpoints.go index d2558bb9db8..a49ff1e248f 100644 --- a/internal/protocoltest/query/internal/endpoints/endpoints.go +++ b/internal/protocoltest/query/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/internal/protocoltest/restxml/internal/endpoints/endpoints.go b/internal/protocoltest/restxml/internal/endpoints/endpoints.go index ad690ca3146..46d9ed631bc 100644 --- a/internal/protocoltest/restxml/internal/endpoints/endpoints.go +++ b/internal/protocoltest/restxml/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go b/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go index 3787ceba6ff..10a0a12d8d2 100644 --- a/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go +++ b/internal/protocoltest/restxmlwithnamespace/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/accessanalyzer/internal/endpoints/endpoints.go b/service/accessanalyzer/internal/endpoints/endpoints.go index 0823413e816..7ef03239c31 100644 --- a/service/accessanalyzer/internal/endpoints/endpoints.go +++ b/service/accessanalyzer/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -132,7 +147,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/acm/internal/endpoints/endpoints.go b/service/acm/internal/endpoints/endpoints.go index 9387c83f4aa..669a9ee2194 100644 --- a/service/acm/internal/endpoints/endpoints.go +++ b/service/acm/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -132,7 +147,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/acmpca/internal/endpoints/endpoints.go b/service/acmpca/internal/endpoints/endpoints.go index a7ca5825b58..dcc43ac15f8 100644 --- a/service/acmpca/internal/endpoints/endpoints.go +++ b/service/acmpca/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -127,7 +142,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -137,7 +152,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/alexaforbusiness/internal/endpoints/endpoints.go b/service/alexaforbusiness/internal/endpoints/endpoints.go index d0cf22ed7a1..9cacd85168b 100644 --- a/service/alexaforbusiness/internal/endpoints/endpoints.go +++ b/service/alexaforbusiness/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-east-1": endpoints.Endpoint{}, @@ -58,7 +73,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/amp/internal/endpoints/endpoints.go b/service/amp/internal/endpoints/endpoints.go index 00f0e27564b..390ecb590a3 100644 --- a/service/amp/internal/endpoints/endpoints.go +++ b/service/amp/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/amplify/internal/endpoints/endpoints.go b/service/amplify/internal/endpoints/endpoints.go index 00cc12074e6..57a27174b2f 100644 --- a/service/amplify/internal/endpoints/endpoints.go +++ b/service/amplify/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/amplifybackend/internal/endpoints/endpoints.go b/service/amplifybackend/internal/endpoints/endpoints.go index afd572c5663..6a7e2783f15 100644 --- a/service/amplifybackend/internal/endpoints/endpoints.go +++ b/service/amplifybackend/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -69,7 +84,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -79,7 +94,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -89,7 +104,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -99,7 +114,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/apigateway/internal/endpoints/endpoints.go b/service/apigateway/internal/endpoints/endpoints.go index c8017b8e303..ec6be94b1b1 100644 --- a/service/apigateway/internal/endpoints/endpoints.go +++ b/service/apigateway/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/apigatewaymanagementapi/internal/endpoints/endpoints.go b/service/apigatewaymanagementapi/internal/endpoints/endpoints.go index 0e229e3096f..d4b72e45edc 100644 --- a/service/apigatewaymanagementapi/internal/endpoints/endpoints.go +++ b/service/apigatewaymanagementapi/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/apigatewayv2/internal/endpoints/endpoints.go b/service/apigatewayv2/internal/endpoints/endpoints.go index 69ef81fad47..25a2bead9db 100644 --- a/service/apigatewayv2/internal/endpoints/endpoints.go +++ b/service/apigatewayv2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/appconfig/internal/endpoints/endpoints.go b/service/appconfig/internal/endpoints/endpoints.go index 720aa3726a1..7610b669504 100644 --- a/service/appconfig/internal/endpoints/endpoints.go +++ b/service/appconfig/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/appflow/internal/endpoints/endpoints.go b/service/appflow/internal/endpoints/endpoints.go index 8c8d741fac5..9746f944518 100644 --- a/service/appflow/internal/endpoints/endpoints.go +++ b/service/appflow/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -72,7 +87,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/appintegrations/internal/endpoints/endpoints.go b/service/appintegrations/internal/endpoints/endpoints.go index 05f78229965..24f7f56a8bc 100644 --- a/service/appintegrations/internal/endpoints/endpoints.go +++ b/service/appintegrations/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/applicationautoscaling/internal/endpoints/endpoints.go b/service/applicationautoscaling/internal/endpoints/endpoints.go index 9c3756f60c9..4e0b190e6c0 100644 --- a/service/applicationautoscaling/internal/endpoints/endpoints.go +++ b/service/applicationautoscaling/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -118,7 +133,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/applicationdiscoveryservice/internal/endpoints/endpoints.go b/service/applicationdiscoveryservice/internal/endpoints/endpoints.go index a13d0c494a6..6da013b04a6 100644 --- a/service/applicationdiscoveryservice/internal/endpoints/endpoints.go +++ b/service/applicationdiscoveryservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/applicationinsights/internal/endpoints/endpoints.go b/service/applicationinsights/internal/endpoints/endpoints.go index 07c1498b324..e42ce06283c 100644 --- a/service/applicationinsights/internal/endpoints/endpoints.go +++ b/service/applicationinsights/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/appmesh/internal/endpoints/endpoints.go b/service/appmesh/internal/endpoints/endpoints.go index ad899fa8008..93ee60c76fb 100644 --- a/service/appmesh/internal/endpoints/endpoints.go +++ b/service/appmesh/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/appstream/internal/endpoints/endpoints.go b/service/appstream/internal/endpoints/endpoints.go index 357a0dc353e..af0172f9102 100644 --- a/service/appstream/internal/endpoints/endpoints.go +++ b/service/appstream/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "appstream", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "appstream", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips": endpoints.Endpoint{ diff --git a/service/appsync/internal/endpoints/endpoints.go b/service/appsync/internal/endpoints/endpoints.go index 9e9ce8c3d15..5096c541776 100644 --- a/service/appsync/internal/endpoints/endpoints.go +++ b/service/appsync/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -110,7 +125,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/athena/internal/endpoints/endpoints.go b/service/athena/internal/endpoints/endpoints.go index 45abf264c6c..e80044ca747 100644 --- a/service/athena/internal/endpoints/endpoints.go +++ b/service/athena/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -125,7 +140,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/auditmanager/internal/endpoints/endpoints.go b/service/auditmanager/internal/endpoints/endpoints.go index 79f23597b8c..f3befce5170 100644 --- a/service/auditmanager/internal/endpoints/endpoints.go +++ b/service/auditmanager/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/autoscaling/internal/endpoints/endpoints.go b/service/autoscaling/internal/endpoints/endpoints.go index 68047d9f10c..f76d1bb2ab7 100644 --- a/service/autoscaling/internal/endpoints/endpoints.go +++ b/service/autoscaling/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -120,7 +135,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/autoscalingplans/internal/endpoints/endpoints.go b/service/autoscalingplans/internal/endpoints/endpoints.go index 628d7740b20..b05ee1f7b08 100644 --- a/service/autoscalingplans/internal/endpoints/endpoints.go +++ b/service/autoscalingplans/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/backup/internal/endpoints/endpoints.go b/service/backup/internal/endpoints/endpoints.go index 56e443f1f17..4538403f314 100644 --- a/service/backup/internal/endpoints/endpoints.go +++ b/service/backup/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/batch/internal/endpoints/endpoints.go b/service/batch/internal/endpoints/endpoints.go index f7957a65d62..ea968c7bda3 100644 --- a/service/batch/internal/endpoints/endpoints.go +++ b/service/batch/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/braket/internal/endpoints/endpoints.go b/service/braket/internal/endpoints/endpoints.go index a7c0bb5de9c..683fc7d3b0e 100644 --- a/service/braket/internal/endpoints/endpoints.go +++ b/service/braket/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/budgets/internal/endpoints/endpoints.go b/service/budgets/internal/endpoints/endpoints.go index fd6fbfd15f6..b703951419d 100644 --- a/service/budgets/internal/endpoints/endpoints.go +++ b/service/budgets/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", Endpoints: endpoints.Endpoints{ @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/chime/internal/endpoints/endpoints.go b/service/chime/internal/endpoints/endpoints.go index 52fe5a5317a..354c011c1f3 100644 --- a/service/chime/internal/endpoints/endpoints.go +++ b/service/chime/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/cloud9/internal/endpoints/endpoints.go b/service/cloud9/internal/endpoints/endpoints.go index aac9e358176..d61bbbc02d8 100644 --- a/service/cloud9/internal/endpoints/endpoints.go +++ b/service/cloud9/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -106,7 +121,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/clouddirectory/internal/endpoints/endpoints.go b/service/clouddirectory/internal/endpoints/endpoints.go index ad6e4c91be4..4baf5b24ad9 100644 --- a/service/clouddirectory/internal/endpoints/endpoints.go +++ b/service/clouddirectory/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-southeast-1": endpoints.Endpoint{}, @@ -66,7 +81,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{}, diff --git a/service/cloudformation/internal/endpoints/endpoints.go b/service/cloudformation/internal/endpoints/endpoints.go index 6b18b98a4ed..219d3c08410 100644 --- a/service/cloudformation/internal/endpoints/endpoints.go +++ b/service/cloudformation/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/cloudfront/internal/endpoints/endpoints.go b/service/cloudfront/internal/endpoints/endpoints.go index 67cd182032d..0a6cf0f0e8d 100644 --- a/service/cloudfront/internal/endpoints/endpoints.go +++ b/service/cloudfront/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", Endpoints: endpoints.Endpoints{ @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/cloudhsm/internal/endpoints/endpoints.go b/service/cloudhsm/internal/endpoints/endpoints.go index 038dd969de1..56b90bf2cab 100644 --- a/service/cloudhsm/internal/endpoints/endpoints.go +++ b/service/cloudhsm/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -67,7 +82,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{}, diff --git a/service/cloudhsmv2/internal/endpoints/endpoints.go b/service/cloudhsmv2/internal/endpoints/endpoints.go index 6db23bee4f5..abc838baf65 100644 --- a/service/cloudhsmv2/internal/endpoints/endpoints.go +++ b/service/cloudhsmv2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "cloudhsm", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -113,7 +128,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "cloudhsm", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/cloudsearch/internal/endpoints/endpoints.go b/service/cloudsearch/internal/endpoints/endpoints.go index 56cb85272f0..db302055ec8 100644 --- a/service/cloudsearch/internal/endpoints/endpoints.go +++ b/service/cloudsearch/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -67,7 +82,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/cloudsearchdomain/internal/endpoints/endpoints.go b/service/cloudsearchdomain/internal/endpoints/endpoints.go index 2598d8e5e2d..9c9c4ac6eb0 100644 --- a/service/cloudsearchdomain/internal/endpoints/endpoints.go +++ b/service/cloudsearchdomain/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/cloudtrail/internal/endpoints/endpoints.go b/service/cloudtrail/internal/endpoints/endpoints.go index 7240acfc4d8..6dae659afe2 100644 --- a/service/cloudtrail/internal/endpoints/endpoints.go +++ b/service/cloudtrail/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -128,7 +143,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -141,7 +156,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/cloudwatch/internal/endpoints/endpoints.go b/service/cloudwatch/internal/endpoints/endpoints.go index 3f8723f385f..71f2a46e039 100644 --- a/service/cloudwatch/internal/endpoints/endpoints.go +++ b/service/cloudwatch/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/cloudwatchevents/internal/endpoints/endpoints.go b/service/cloudwatchevents/internal/endpoints/endpoints.go index ea6d5249cd1..6ae66cfe7d9 100644 --- a/service/cloudwatchevents/internal/endpoints/endpoints.go +++ b/service/cloudwatchevents/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/cloudwatchlogs/internal/endpoints/endpoints.go b/service/cloudwatchlogs/internal/endpoints/endpoints.go index b7ab74c9bd5..e5656cc5352 100644 --- a/service/cloudwatchlogs/internal/endpoints/endpoints.go +++ b/service/cloudwatchlogs/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/codeartifact/internal/endpoints/endpoints.go b/service/codeartifact/internal/endpoints/endpoints.go index ec086e5e777..2b3df152f79 100644 --- a/service/codeartifact/internal/endpoints/endpoints.go +++ b/service/codeartifact/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -67,7 +82,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/codebuild/internal/endpoints/endpoints.go b/service/codebuild/internal/endpoints/endpoints.go index dcfe21bad3a..97c1dab3f07 100644 --- a/service/codebuild/internal/endpoints/endpoints.go +++ b/service/codebuild/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -125,7 +140,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/codecommit/internal/endpoints/endpoints.go b/service/codecommit/internal/endpoints/endpoints.go index 7253f03d991..934fdb3c7f6 100644 --- a/service/codecommit/internal/endpoints/endpoints.go +++ b/service/codecommit/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -106,7 +121,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips": endpoints.Endpoint{ diff --git a/service/codedeploy/internal/endpoints/endpoints.go b/service/codedeploy/internal/endpoints/endpoints.go index 9d1c07f7c29..5a9237a04da 100644 --- a/service/codedeploy/internal/endpoints/endpoints.go +++ b/service/codedeploy/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/codeguruprofiler/internal/endpoints/endpoints.go b/service/codeguruprofiler/internal/endpoints/endpoints.go index 06574031215..ab25ad0fa1a 100644 --- a/service/codeguruprofiler/internal/endpoints/endpoints.go +++ b/service/codeguruprofiler/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/codegurureviewer/internal/endpoints/endpoints.go b/service/codegurureviewer/internal/endpoints/endpoints.go index 91380588976..015d20f2c5b 100644 --- a/service/codegurureviewer/internal/endpoints/endpoints.go +++ b/service/codegurureviewer/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -67,7 +82,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/codepipeline/internal/endpoints/endpoints.go b/service/codepipeline/internal/endpoints/endpoints.go index 9051572b78f..ac052a6cc69 100644 --- a/service/codepipeline/internal/endpoints/endpoints.go +++ b/service/codepipeline/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -125,7 +140,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/codestar/internal/endpoints/endpoints.go b/service/codestar/internal/endpoints/endpoints.go index 4f86c1f6003..6b51a45195c 100644 --- a/service/codestar/internal/endpoints/endpoints.go +++ b/service/codestar/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/codestarconnections/internal/endpoints/endpoints.go b/service/codestarconnections/internal/endpoints/endpoints.go index 224dd9a83ad..f335bab68cc 100644 --- a/service/codestarconnections/internal/endpoints/endpoints.go +++ b/service/codestarconnections/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -73,7 +88,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/codestarnotifications/internal/endpoints/endpoints.go b/service/codestarnotifications/internal/endpoints/endpoints.go index dc44214ad03..d255631222c 100644 --- a/service/codestarnotifications/internal/endpoints/endpoints.go +++ b/service/codestarnotifications/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/cognitoidentity/internal/endpoints/endpoints.go b/service/cognitoidentity/internal/endpoints/endpoints.go index 9834052b336..44d82c07be7 100644 --- a/service/cognitoidentity/internal/endpoints/endpoints.go +++ b/service/cognitoidentity/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -104,7 +119,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -114,7 +129,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -124,7 +139,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/cognitoidentityprovider/internal/endpoints/endpoints.go b/service/cognitoidentityprovider/internal/endpoints/endpoints.go index b6cf6485e8d..6d26e1980d3 100644 --- a/service/cognitoidentityprovider/internal/endpoints/endpoints.go +++ b/service/cognitoidentityprovider/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -127,7 +142,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/cognitosync/internal/endpoints/endpoints.go b/service/cognitosync/internal/endpoints/endpoints.go index c7d64ac7e70..66418eb2a3e 100644 --- a/service/cognitosync/internal/endpoints/endpoints.go +++ b/service/cognitosync/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -98,7 +113,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/comprehend/internal/endpoints/endpoints.go b/service/comprehend/internal/endpoints/endpoints.go index f93035f14a4..f10e610913f 100644 --- a/service/comprehend/internal/endpoints/endpoints.go +++ b/service/comprehend/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -110,7 +125,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -120,7 +135,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/comprehendmedical/internal/endpoints/endpoints.go b/service/comprehendmedical/internal/endpoints/endpoints.go index 7ea5f0de23c..378c4f4c843 100644 --- a/service/comprehendmedical/internal/endpoints/endpoints.go +++ b/service/comprehendmedical/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-southeast-2": endpoints.Endpoint{}, @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -112,7 +127,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/computeoptimizer/internal/endpoints/endpoints.go b/service/computeoptimizer/internal/endpoints/endpoints.go index c867a051e17..0277364574e 100644 --- a/service/computeoptimizer/internal/endpoints/endpoints.go +++ b/service/computeoptimizer/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/configservice/internal/endpoints/endpoints.go b/service/configservice/internal/endpoints/endpoints.go index 146164f7ecf..c4e1b3f1c3e 100644 --- a/service/configservice/internal/endpoints/endpoints.go +++ b/service/configservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/connect/internal/endpoints/endpoints.go b/service/connect/internal/endpoints/endpoints.go index 73568173048..b026856ebb5 100644 --- a/service/connect/internal/endpoints/endpoints.go +++ b/service/connect/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{}, diff --git a/service/connectcontactlens/internal/endpoints/endpoints.go b/service/connectcontactlens/internal/endpoints/endpoints.go index 289c86840b7..84f2c8f9cf8 100644 --- a/service/connectcontactlens/internal/endpoints/endpoints.go +++ b/service/connectcontactlens/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -63,7 +78,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -73,7 +88,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/connectparticipant/internal/endpoints/endpoints.go b/service/connectparticipant/internal/endpoints/endpoints.go index b4b54fb4a6d..ed9a038e8e3 100644 --- a/service/connectparticipant/internal/endpoints/endpoints.go +++ b/service/connectparticipant/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/costandusagereportservice/internal/endpoints/endpoints.go b/service/costandusagereportservice/internal/endpoints/endpoints.go index 150a24c8bb6..e4e9fb51af7 100644 --- a/service/costandusagereportservice/internal/endpoints/endpoints.go +++ b/service/costandusagereportservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-east-1": endpoints.Endpoint{}, @@ -58,7 +73,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-northwest-1": endpoints.Endpoint{}, @@ -71,7 +86,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/costexplorer/internal/endpoints/endpoints.go b/service/costexplorer/internal/endpoints/endpoints.go index 61f05969f0b..4d6bb582d1f 100644 --- a/service/costexplorer/internal/endpoints/endpoints.go +++ b/service/costexplorer/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", Endpoints: endpoints.Endpoints{ @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/customerprofiles/internal/endpoints/endpoints.go b/service/customerprofiles/internal/endpoints/endpoints.go index 7b6a31fcd50..cf1cb364644 100644 --- a/service/customerprofiles/internal/endpoints/endpoints.go +++ b/service/customerprofiles/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/databasemigrationservice/internal/endpoints/endpoints.go b/service/databasemigrationservice/internal/endpoints/endpoints.go index ddc56a31ca6..6dd5ff8cb37 100644 --- a/service/databasemigrationservice/internal/endpoints/endpoints.go +++ b/service/databasemigrationservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -98,7 +113,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "dms-fips": endpoints.Endpoint{ @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "dms-fips": endpoints.Endpoint{ @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "dms-fips": endpoints.Endpoint{ diff --git a/service/databrew/internal/endpoints/endpoints.go b/service/databrew/internal/endpoints/endpoints.go index c062d4aaa4c..c5e04d5b426 100644 --- a/service/databrew/internal/endpoints/endpoints.go +++ b/service/databrew/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/dataexchange/internal/endpoints/endpoints.go b/service/dataexchange/internal/endpoints/endpoints.go index a8ab553c414..d8bf505936a 100644 --- a/service/dataexchange/internal/endpoints/endpoints.go +++ b/service/dataexchange/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -98,7 +113,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/datapipeline/internal/endpoints/endpoints.go b/service/datapipeline/internal/endpoints/endpoints.go index d1a7f7c982a..e6494bd00a8 100644 --- a/service/datapipeline/internal/endpoints/endpoints.go +++ b/service/datapipeline/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -62,7 +77,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -72,7 +87,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/datasync/internal/endpoints/endpoints.go b/service/datasync/internal/endpoints/endpoints.go index 46e40524ceb..bb16024d794 100644 --- a/service/datasync/internal/endpoints/endpoints.go +++ b/service/datasync/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -127,7 +142,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -137,7 +152,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/dax/internal/endpoints/endpoints.go b/service/dax/internal/endpoints/endpoints.go index ca64e42bc5f..9e39bc9fdad 100644 --- a/service/dax/internal/endpoints/endpoints.go +++ b/service/dax/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-northwest-1": endpoints.Endpoint{}, @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/detective/internal/endpoints/endpoints.go b/service/detective/internal/endpoints/endpoints.go index b2bb9182540..1545e535aa8 100644 --- a/service/detective/internal/endpoints/endpoints.go +++ b/service/detective/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -121,7 +136,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/devicefarm/internal/endpoints/endpoints.go b/service/devicefarm/internal/endpoints/endpoints.go index 13793292190..40073ae13fe 100644 --- a/service/devicefarm/internal/endpoints/endpoints.go +++ b/service/devicefarm/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-west-2": endpoints.Endpoint{}, @@ -58,7 +73,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/devopsguru/internal/endpoints/endpoints.go b/service/devopsguru/internal/endpoints/endpoints.go index 500875933b5..f2e191cb49c 100644 --- a/service/devopsguru/internal/endpoints/endpoints.go +++ b/service/devopsguru/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/directconnect/internal/endpoints/endpoints.go b/service/directconnect/internal/endpoints/endpoints.go index c469b113845..23242ed01cf 100644 --- a/service/directconnect/internal/endpoints/endpoints.go +++ b/service/directconnect/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/directoryservice/internal/endpoints/endpoints.go b/service/directoryservice/internal/endpoints/endpoints.go index 908f02331c4..75038511820 100644 --- a/service/directoryservice/internal/endpoints/endpoints.go +++ b/service/directoryservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -121,7 +136,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -134,7 +149,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -144,7 +159,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/dlm/internal/endpoints/endpoints.go b/service/dlm/internal/endpoints/endpoints.go index 99f9b174222..e0f137b2abd 100644 --- a/service/dlm/internal/endpoints/endpoints.go +++ b/service/dlm/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/docdb/internal/endpoints/endpoints.go b/service/docdb/internal/endpoints/endpoints.go index e97066aa0fe..5644a75810e 100644 --- a/service/docdb/internal/endpoints/endpoints.go +++ b/service/docdb/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -148,7 +163,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "rds.us-gov-east-1": endpoints.Endpoint{ diff --git a/service/dynamodb/internal/endpoints/endpoints.go b/service/dynamodb/internal/endpoints/endpoints.go index db2336db503..4775744b70c 100644 --- a/service/dynamodb/internal/endpoints/endpoints.go +++ b/service/dynamodb/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -144,7 +159,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -157,7 +172,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/dynamodbstreams/internal/endpoints/endpoints.go b/service/dynamodbstreams/internal/endpoints/endpoints.go index 93b7518f0cb..bacb575b8e3 100644 --- a/service/dynamodbstreams/internal/endpoints/endpoints.go +++ b/service/dynamodbstreams/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "dynamodb", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "dynamodb", }, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -134,7 +149,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "dynamodb", }, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -152,7 +167,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "dynamodb", }, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -168,7 +183,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "dynamodb", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/ebs/internal/endpoints/endpoints.go b/service/ebs/internal/endpoints/endpoints.go index 2d10e2d582a..927f2add75a 100644 --- a/service/ebs/internal/endpoints/endpoints.go +++ b/service/ebs/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -132,7 +147,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/ec2/internal/endpoints/endpoints.go b/service/ec2/internal/endpoints/endpoints.go index cddb534e9fe..4d3891c6f16 100644 --- a/service/ec2/internal/endpoints/endpoints.go +++ b/service/ec2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -148,7 +163,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/ec2instanceconnect/internal/endpoints/endpoints.go b/service/ec2instanceconnect/internal/endpoints/endpoints.go index fb8fe2d0b05..7f0f654966e 100644 --- a/service/ec2instanceconnect/internal/endpoints/endpoints.go +++ b/service/ec2instanceconnect/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/ecr/internal/endpoints/endpoints.go b/service/ecr/internal/endpoints/endpoints.go index 2628e1f9bcc..2cdc06963b8 100644 --- a/service/ecr/internal/endpoints/endpoints.go +++ b/service/ecr/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{ @@ -231,7 +246,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{ @@ -255,7 +270,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -273,7 +288,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{ @@ -291,7 +306,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-dkr-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/ecrpublic/internal/endpoints/endpoints.go b/service/ecrpublic/internal/endpoints/endpoints.go index 52908d77fd1..495e21fbb1e 100644 --- a/service/ecrpublic/internal/endpoints/endpoints.go +++ b/service/ecrpublic/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/ecs/internal/endpoints/endpoints.go b/service/ecs/internal/endpoints/endpoints.go index c72f6439e31..41cfa9db7ed 100644 --- a/service/ecs/internal/endpoints/endpoints.go +++ b/service/ecs/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/efs/internal/endpoints/endpoints.go b/service/efs/internal/endpoints/endpoints.go index 4974b63d65e..14686231323 100644 --- a/service/efs/internal/endpoints/endpoints.go +++ b/service/efs/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -204,7 +219,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -230,7 +245,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -240,7 +255,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -250,7 +265,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/eks/internal/endpoints/endpoints.go b/service/eks/internal/endpoints/endpoints.go index a6843197e48..6ba0ee37d9f 100644 --- a/service/eks/internal/endpoints/endpoints.go +++ b/service/eks/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/elasticache/internal/endpoints/endpoints.go b/service/elasticache/internal/endpoints/endpoints.go index fdd5eefeb36..c6f6ac58c29 100644 --- a/service/elasticache/internal/endpoints/endpoints.go +++ b/service/elasticache/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -98,7 +113,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -124,7 +139,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips": endpoints.Endpoint{ diff --git a/service/elasticbeanstalk/internal/endpoints/endpoints.go b/service/elasticbeanstalk/internal/endpoints/endpoints.go index a932a1e5160..1cba36fc02b 100644 --- a/service/elasticbeanstalk/internal/endpoints/endpoints.go +++ b/service/elasticbeanstalk/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/elasticinference/internal/endpoints/endpoints.go b/service/elasticinference/internal/endpoints/endpoints.go index ea6636a47e1..7eb758057ed 100644 --- a/service/elasticinference/internal/endpoints/endpoints.go +++ b/service/elasticinference/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{ @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/elasticloadbalancing/internal/endpoints/endpoints.go b/service/elasticloadbalancing/internal/endpoints/endpoints.go index fd31c715233..8d48240d18d 100644 --- a/service/elasticloadbalancing/internal/endpoints/endpoints.go +++ b/service/elasticloadbalancing/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{ @@ -146,7 +161,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/elasticloadbalancingv2/internal/endpoints/endpoints.go b/service/elasticloadbalancingv2/internal/endpoints/endpoints.go index c1708aa4211..75b3938cd28 100644 --- a/service/elasticloadbalancingv2/internal/endpoints/endpoints.go +++ b/service/elasticloadbalancingv2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{ @@ -146,7 +161,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/elasticsearchservice/internal/endpoints/endpoints.go b/service/elasticsearchservice/internal/endpoints/endpoints.go index 3dc0d18c11e..7899165ffd8 100644 --- a/service/elasticsearchservice/internal/endpoints/endpoints.go +++ b/service/elasticsearchservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -98,7 +113,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -124,7 +139,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips": endpoints.Endpoint{ diff --git a/service/elastictranscoder/internal/endpoints/endpoints.go b/service/elastictranscoder/internal/endpoints/endpoints.go index a2287fc9a03..f3f8500a3d8 100644 --- a/service/elastictranscoder/internal/endpoints/endpoints.go +++ b/service/elastictranscoder/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/emr/internal/endpoints/endpoints.go b/service/emr/internal/endpoints/endpoints.go index 2032071d644..81141593b53 100644 --- a/service/emr/internal/endpoints/endpoints.go +++ b/service/emr/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -137,7 +152,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -150,7 +165,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/emrcontainers/internal/endpoints/endpoints.go b/service/emrcontainers/internal/endpoints/endpoints.go index a6a330de4ab..7fcc744fdd4 100644 --- a/service/emrcontainers/internal/endpoints/endpoints.go +++ b/service/emrcontainers/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/eventbridge/internal/endpoints/endpoints.go b/service/eventbridge/internal/endpoints/endpoints.go index 510d2652261..aa3949eb443 100644 --- a/service/eventbridge/internal/endpoints/endpoints.go +++ b/service/eventbridge/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/firehose/internal/endpoints/endpoints.go b/service/firehose/internal/endpoints/endpoints.go index 101cd5bd45e..54d67917f09 100644 --- a/service/firehose/internal/endpoints/endpoints.go +++ b/service/firehose/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/fis/internal/endpoints/endpoints.go b/service/fis/internal/endpoints/endpoints.go index 5d9e0610375..65127706ea1 100644 --- a/service/fis/internal/endpoints/endpoints.go +++ b/service/fis/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/fms/internal/endpoints/endpoints.go b/service/fms/internal/endpoints/endpoints.go index 7c3c9f68b1e..15230a5d756 100644 --- a/service/fms/internal/endpoints/endpoints.go +++ b/service/fms/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -191,7 +206,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -201,7 +216,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -211,7 +226,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -221,7 +236,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/forecast/internal/endpoints/endpoints.go b/service/forecast/internal/endpoints/endpoints.go index bbf4b00ad97..93fe94a5c2e 100644 --- a/service/forecast/internal/endpoints/endpoints.go +++ b/service/forecast/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -67,7 +82,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/forecastquery/internal/endpoints/endpoints.go b/service/forecastquery/internal/endpoints/endpoints.go index d7d7ba08a3d..537f74b2ec0 100644 --- a/service/forecastquery/internal/endpoints/endpoints.go +++ b/service/forecastquery/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -67,7 +82,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/frauddetector/internal/endpoints/endpoints.go b/service/frauddetector/internal/endpoints/endpoints.go index 0f81e42c607..f8269aae0af 100644 --- a/service/frauddetector/internal/endpoints/endpoints.go +++ b/service/frauddetector/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/fsx/internal/endpoints/endpoints.go b/service/fsx/internal/endpoints/endpoints.go index 47e775a0288..f65d7846aa4 100644 --- a/service/fsx/internal/endpoints/endpoints.go +++ b/service/fsx/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -121,7 +136,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -141,7 +156,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-prod-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/gamelift/internal/endpoints/endpoints.go b/service/gamelift/internal/endpoints/endpoints.go index f1acfa05ba6..119284ceef7 100644 --- a/service/gamelift/internal/endpoints/endpoints.go +++ b/service/gamelift/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -71,7 +86,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -104,7 +119,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/glacier/internal/endpoints/endpoints.go b/service/glacier/internal/endpoints/endpoints.go index 22a9b4b6595..464ba7b2a8a 100644 --- a/service/glacier/internal/endpoints/endpoints.go +++ b/service/glacier/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -137,7 +152,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -150,7 +165,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/globalaccelerator/internal/endpoints/endpoints.go b/service/globalaccelerator/internal/endpoints/endpoints.go index 9cb3ea37c21..af477d74ca9 100644 --- a/service/globalaccelerator/internal/endpoints/endpoints.go +++ b/service/globalaccelerator/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/glue/internal/endpoints/endpoints.go b/service/glue/internal/endpoints/endpoints.go index c2d6c73d358..8087602acbf 100644 --- a/service/glue/internal/endpoints/endpoints.go +++ b/service/glue/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/greengrass/internal/endpoints/endpoints.go b/service/greengrass/internal/endpoints/endpoints.go index 27db1c18d14..e8f20ad2f75 100644 --- a/service/greengrass/internal/endpoints/endpoints.go +++ b/service/greengrass/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "dataplane-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/greengrassv2/internal/endpoints/endpoints.go b/service/greengrassv2/internal/endpoints/endpoints.go index ad49982e0ed..15b34cb3e73 100644 --- a/service/greengrassv2/internal/endpoints/endpoints.go +++ b/service/greengrassv2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "dataplane-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/groundstation/internal/endpoints/endpoints.go b/service/groundstation/internal/endpoints/endpoints.go index e8fc6b6141b..635a93d56d3 100644 --- a/service/groundstation/internal/endpoints/endpoints.go +++ b/service/groundstation/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -106,7 +121,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/guardduty/internal/endpoints/endpoints.go b/service/guardduty/internal/endpoints/endpoints.go index cd0857852bb..e6dccdade4d 100644 --- a/service/guardduty/internal/endpoints/endpoints.go +++ b/service/guardduty/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -125,7 +140,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/health/internal/endpoints/endpoints.go b/service/health/internal/endpoints/endpoints.go index 07bd5050ae1..7a6f880a2b9 100644 --- a/service/health/internal/endpoints/endpoints.go +++ b/service/health/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-east-2": endpoints.Endpoint{ @@ -63,7 +78,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/healthlake/internal/endpoints/endpoints.go b/service/healthlake/internal/endpoints/endpoints.go index 0aa79ebbe60..b71767b9b8e 100644 --- a/service/healthlake/internal/endpoints/endpoints.go +++ b/service/healthlake/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-east-1": endpoints.Endpoint{}, @@ -58,7 +73,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/honeycode/internal/endpoints/endpoints.go b/service/honeycode/internal/endpoints/endpoints.go index a331d3283ef..3301bdd0ea0 100644 --- a/service/honeycode/internal/endpoints/endpoints.go +++ b/service/honeycode/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-west-2": endpoints.Endpoint{}, @@ -58,7 +73,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iam/internal/endpoints/endpoints.go b/service/iam/internal/endpoints/endpoints.go index 5bc0e637086..feacfef9e17 100644 --- a/service/iam/internal/endpoints/endpoints.go +++ b/service/iam/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", Endpoints: endpoints.Endpoints{ @@ -89,7 +104,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: false, PartitionEndpoint: "aws-iso-global", Endpoints: endpoints.Endpoints{ @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: false, PartitionEndpoint: "aws-iso-b-global", Endpoints: endpoints.Endpoints{ @@ -127,7 +142,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: false, PartitionEndpoint: "aws-us-gov-global", Endpoints: endpoints.Endpoints{ diff --git a/service/identitystore/internal/endpoints/endpoints.go b/service/identitystore/internal/endpoints/endpoints.go index b659a95447d..9a5366f36de 100644 --- a/service/identitystore/internal/endpoints/endpoints.go +++ b/service/identitystore/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/imagebuilder/internal/endpoints/endpoints.go b/service/imagebuilder/internal/endpoints/endpoints.go index 02c45d3fdde..8f748643cf0 100644 --- a/service/imagebuilder/internal/endpoints/endpoints.go +++ b/service/imagebuilder/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/inspector/internal/endpoints/endpoints.go b/service/inspector/internal/endpoints/endpoints.go index f9f4a4eed1a..9dcbe617859 100644 --- a/service/inspector/internal/endpoints/endpoints.go +++ b/service/inspector/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -113,7 +128,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -123,7 +138,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/iot/internal/endpoints/endpoints.go b/service/iot/internal/endpoints/endpoints.go index f9ee3bec710..e3e7a8fdb6b 100644 --- a/service/iot/internal/endpoints/endpoints.go +++ b/service/iot/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "execute-api", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "execute-api", }, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -118,7 +133,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "execute-api", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/iot1clickdevicesservice/internal/endpoints/endpoints.go b/service/iot1clickdevicesservice/internal/endpoints/endpoints.go index e4e3053c4b8..978b9b083d4 100644 --- a/service/iot1clickdevicesservice/internal/endpoints/endpoints.go +++ b/service/iot1clickdevicesservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iot1clickprojects/internal/endpoints/endpoints.go b/service/iot1clickprojects/internal/endpoints/endpoints.go index e4a9d2284cb..dc31a8d8f53 100644 --- a/service/iot1clickprojects/internal/endpoints/endpoints.go +++ b/service/iot1clickprojects/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotanalytics/internal/endpoints/endpoints.go b/service/iotanalytics/internal/endpoints/endpoints.go index 8fcdf08c762..66b3ce80052 100644 --- a/service/iotanalytics/internal/endpoints/endpoints.go +++ b/service/iotanalytics/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotdataplane/internal/endpoints/endpoints.go b/service/iotdataplane/internal/endpoints/endpoints.go index ff74bdbdd97..fc5aed39f9b 100644 --- a/service/iotdataplane/internal/endpoints/endpoints.go +++ b/service/iotdataplane/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "iotdata", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "iotdata", }, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -118,7 +133,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "iotdata", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/iotdeviceadvisor/internal/endpoints/endpoints.go b/service/iotdeviceadvisor/internal/endpoints/endpoints.go index f3048399d7b..1dba70617a3 100644 --- a/service/iotdeviceadvisor/internal/endpoints/endpoints.go +++ b/service/iotdeviceadvisor/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotevents/internal/endpoints/endpoints.go b/service/iotevents/internal/endpoints/endpoints.go index 0d11b38326e..e88731d6714 100644 --- a/service/iotevents/internal/endpoints/endpoints.go +++ b/service/iotevents/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -67,7 +82,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/ioteventsdata/internal/endpoints/endpoints.go b/service/ioteventsdata/internal/endpoints/endpoints.go index 6ae278643f4..ad53cf92baa 100644 --- a/service/ioteventsdata/internal/endpoints/endpoints.go +++ b/service/ioteventsdata/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotfleethub/internal/endpoints/endpoints.go b/service/iotfleethub/internal/endpoints/endpoints.go index 31348a044d1..26ea45900f1 100644 --- a/service/iotfleethub/internal/endpoints/endpoints.go +++ b/service/iotfleethub/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-east-1": endpoints.Endpoint{}, @@ -58,7 +73,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotjobsdataplane/internal/endpoints/endpoints.go b/service/iotjobsdataplane/internal/endpoints/endpoints.go index 947cde6c749..24a2db37bae 100644 --- a/service/iotjobsdataplane/internal/endpoints/endpoints.go +++ b/service/iotjobsdataplane/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotsecuretunneling/internal/endpoints/endpoints.go b/service/iotsecuretunneling/internal/endpoints/endpoints.go index 612dcab1cab..212fe083de8 100644 --- a/service/iotsecuretunneling/internal/endpoints/endpoints.go +++ b/service/iotsecuretunneling/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotsitewise/internal/endpoints/endpoints.go b/service/iotsitewise/internal/endpoints/endpoints.go index 74ac7c4f4cb..458bede3154 100644 --- a/service/iotsitewise/internal/endpoints/endpoints.go +++ b/service/iotsitewise/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotthingsgraph/internal/endpoints/endpoints.go b/service/iotthingsgraph/internal/endpoints/endpoints.go index 781191c6679..3a3132cc83f 100644 --- a/service/iotthingsgraph/internal/endpoints/endpoints.go +++ b/service/iotthingsgraph/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "iotthingsgraph", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -66,7 +81,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/iotwireless/internal/endpoints/endpoints.go b/service/iotwireless/internal/endpoints/endpoints.go index a59c7c092cf..715993c60e6 100644 --- a/service/iotwireless/internal/endpoints/endpoints.go +++ b/service/iotwireless/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/ivs/internal/endpoints/endpoints.go b/service/ivs/internal/endpoints/endpoints.go index e806410f246..58e02022c33 100644 --- a/service/ivs/internal/endpoints/endpoints.go +++ b/service/ivs/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/kafka/internal/endpoints/endpoints.go b/service/kafka/internal/endpoints/endpoints.go index d42ad6cc72a..10228a91db0 100644 --- a/service/kafka/internal/endpoints/endpoints.go +++ b/service/kafka/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -110,7 +125,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/kendra/internal/endpoints/endpoints.go b/service/kendra/internal/endpoints/endpoints.go index 0bd58311c62..baf3bceb07b 100644 --- a/service/kendra/internal/endpoints/endpoints.go +++ b/service/kendra/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/kinesis/internal/endpoints/endpoints.go b/service/kinesis/internal/endpoints/endpoints.go index 5b9341ffda1..6184560ad33 100644 --- a/service/kinesis/internal/endpoints/endpoints.go +++ b/service/kinesis/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/kinesisanalytics/internal/endpoints/endpoints.go b/service/kinesisanalytics/internal/endpoints/endpoints.go index 852f0742d89..170b8c03d1d 100644 --- a/service/kinesisanalytics/internal/endpoints/endpoints.go +++ b/service/kinesisanalytics/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -110,7 +125,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/kinesisanalyticsv2/internal/endpoints/endpoints.go b/service/kinesisanalyticsv2/internal/endpoints/endpoints.go index fff614843e1..c6ebdb2a6c4 100644 --- a/service/kinesisanalyticsv2/internal/endpoints/endpoints.go +++ b/service/kinesisanalyticsv2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -110,7 +125,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/kinesisvideo/internal/endpoints/endpoints.go b/service/kinesisvideo/internal/endpoints/endpoints.go index ef464876385..9df52df279b 100644 --- a/service/kinesisvideo/internal/endpoints/endpoints.go +++ b/service/kinesisvideo/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -72,7 +87,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go b/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go index ac61b5ba950..9eb7eeae9dc 100644 --- a/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go +++ b/service/kinesisvideoarchivedmedia/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -72,7 +87,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/kinesisvideomedia/internal/endpoints/endpoints.go b/service/kinesisvideomedia/internal/endpoints/endpoints.go index 92210345baf..6dbbc9b7793 100644 --- a/service/kinesisvideomedia/internal/endpoints/endpoints.go +++ b/service/kinesisvideomedia/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -72,7 +87,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/kinesisvideosignaling/internal/endpoints/endpoints.go b/service/kinesisvideosignaling/internal/endpoints/endpoints.go index 8034e8ed9ce..1ae7f41b3c3 100644 --- a/service/kinesisvideosignaling/internal/endpoints/endpoints.go +++ b/service/kinesisvideosignaling/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -72,7 +87,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/kms/internal/endpoints/endpoints.go b/service/kms/internal/endpoints/endpoints.go index a79eb1bdfbc..b1d1af3ae9f 100644 --- a/service/kms/internal/endpoints/endpoints.go +++ b/service/kms/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ProdFips": endpoints.Endpoint{ @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ProdFips": endpoints.Endpoint{ @@ -130,7 +145,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ProdFips": endpoints.Endpoint{ diff --git a/service/lakeformation/internal/endpoints/endpoints.go b/service/lakeformation/internal/endpoints/endpoints.go index 09dfce0daa1..4e6caac539e 100644 --- a/service/lakeformation/internal/endpoints/endpoints.go +++ b/service/lakeformation/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -113,7 +128,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -123,7 +138,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -133,7 +148,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/lambda/internal/endpoints/endpoints.go b/service/lambda/internal/endpoints/endpoints.go index 44fa16ad67b..96f259791f3 100644 --- a/service/lambda/internal/endpoints/endpoints.go +++ b/service/lambda/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/lexmodelbuildingservice/internal/endpoints/endpoints.go b/service/lexmodelbuildingservice/internal/endpoints/endpoints.go index fdf8c737ac7..2082eaa0c6e 100644 --- a/service/lexmodelbuildingservice/internal/endpoints/endpoints.go +++ b/service/lexmodelbuildingservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "lex", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -113,7 +128,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "lex", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{}, diff --git a/service/lexmodelsv2/internal/endpoints/endpoints.go b/service/lexmodelsv2/internal/endpoints/endpoints.go index bbf1532ed2a..b36c0b4dfe3 100644 --- a/service/lexmodelsv2/internal/endpoints/endpoints.go +++ b/service/lexmodelsv2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/lexruntimeservice/internal/endpoints/endpoints.go b/service/lexruntimeservice/internal/endpoints/endpoints.go index 30bf9926429..15a55ffffdf 100644 --- a/service/lexruntimeservice/internal/endpoints/endpoints.go +++ b/service/lexruntimeservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "lex", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -113,7 +128,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "lex", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{}, diff --git a/service/lexruntimev2/internal/endpoints/endpoints.go b/service/lexruntimev2/internal/endpoints/endpoints.go index 7a9d4afdb5e..6377d85becd 100644 --- a/service/lexruntimev2/internal/endpoints/endpoints.go +++ b/service/lexruntimev2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/licensemanager/internal/endpoints/endpoints.go b/service/licensemanager/internal/endpoints/endpoints.go index 64084575ecf..895b71d2009 100644 --- a/service/licensemanager/internal/endpoints/endpoints.go +++ b/service/licensemanager/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -125,7 +140,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -138,7 +153,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/lightsail/internal/endpoints/endpoints.go b/service/lightsail/internal/endpoints/endpoints.go index 22e2f4a67f8..010c5e44540 100644 --- a/service/lightsail/internal/endpoints/endpoints.go +++ b/service/lightsail/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/lookoutvision/internal/endpoints/endpoints.go b/service/lookoutvision/internal/endpoints/endpoints.go index 20f075ae198..f3df5b518df 100644 --- a/service/lookoutvision/internal/endpoints/endpoints.go +++ b/service/lookoutvision/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/machinelearning/internal/endpoints/endpoints.go b/service/machinelearning/internal/endpoints/endpoints.go index 21b6940120c..7dfc51e9d2d 100644 --- a/service/machinelearning/internal/endpoints/endpoints.go +++ b/service/machinelearning/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "eu-west-1": endpoints.Endpoint{}, @@ -59,7 +74,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -69,7 +84,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -79,7 +94,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -89,7 +104,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/macie/internal/endpoints/endpoints.go b/service/macie/internal/endpoints/endpoints.go index 1b8bb519d88..89d8390f0b2 100644 --- a/service/macie/internal/endpoints/endpoints.go +++ b/service/macie/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-east-1": endpoints.Endpoint{ @@ -71,7 +86,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/macie2/internal/endpoints/endpoints.go b/service/macie2/internal/endpoints/endpoints.go index 2d5991ece64..553553e3edd 100644 --- a/service/macie2/internal/endpoints/endpoints.go +++ b/service/macie2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -121,7 +136,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/managedblockchain/internal/endpoints/endpoints.go b/service/managedblockchain/internal/endpoints/endpoints.go index e7d05d6ce91..9216f883677 100644 --- a/service/managedblockchain/internal/endpoints/endpoints.go +++ b/service/managedblockchain/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -63,7 +78,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -73,7 +88,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/marketplacecatalog/internal/endpoints/endpoints.go b/service/marketplacecatalog/internal/endpoints/endpoints.go index 3c20c3094cd..8d51a4eaee9 100644 --- a/service/marketplacecatalog/internal/endpoints/endpoints.go +++ b/service/marketplacecatalog/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go b/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go index 4864db98c66..8fffb4814dd 100644 --- a/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go +++ b/service/marketplacecommerceanalytics/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-east-1": endpoints.Endpoint{}, @@ -58,7 +73,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/marketplaceentitlementservice/internal/endpoints/endpoints.go b/service/marketplaceentitlementservice/internal/endpoints/endpoints.go index a6b81afa727..007da1b6d0d 100644 --- a/service/marketplaceentitlementservice/internal/endpoints/endpoints.go +++ b/service/marketplaceentitlementservice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "aws-marketplace", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-east-1": endpoints.Endpoint{}, @@ -61,7 +76,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -71,7 +86,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/marketplacemetering/internal/endpoints/endpoints.go b/service/marketplacemetering/internal/endpoints/endpoints.go index fec27700cae..5df4103fe5b 100644 --- a/service/marketplacemetering/internal/endpoints/endpoints.go +++ b/service/marketplacemetering/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "aws-marketplace", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -114,7 +129,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "aws-marketplace", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/mediaconnect/internal/endpoints/endpoints.go b/service/mediaconnect/internal/endpoints/endpoints.go index 9db2ade4f01..296ecb97daa 100644 --- a/service/mediaconnect/internal/endpoints/endpoints.go +++ b/service/mediaconnect/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -73,7 +88,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mediaconvert/internal/endpoints/endpoints.go b/service/mediaconvert/internal/endpoints/endpoints.go index e99d3b70462..18e7a53eb87 100644 --- a/service/mediaconvert/internal/endpoints/endpoints.go +++ b/service/mediaconvert/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-northwest-1": endpoints.Endpoint{ @@ -121,7 +136,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -141,7 +156,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{ diff --git a/service/medialive/internal/endpoints/endpoints.go b/service/medialive/internal/endpoints/endpoints.go index ec95fa241ed..a0ac5f8dd3d 100644 --- a/service/medialive/internal/endpoints/endpoints.go +++ b/service/medialive/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -89,7 +104,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -99,7 +114,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -112,7 +127,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mediapackage/internal/endpoints/endpoints.go b/service/mediapackage/internal/endpoints/endpoints.go index 2d5b51baff4..ca323280777 100644 --- a/service/mediapackage/internal/endpoints/endpoints.go +++ b/service/mediapackage/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -71,7 +86,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -104,7 +119,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mediapackagevod/internal/endpoints/endpoints.go b/service/mediapackagevod/internal/endpoints/endpoints.go index 2a437535318..4bb004f5300 100644 --- a/service/mediapackagevod/internal/endpoints/endpoints.go +++ b/service/mediapackagevod/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mediastore/internal/endpoints/endpoints.go b/service/mediastore/internal/endpoints/endpoints.go index cd69249d646..f4fb203ee37 100644 --- a/service/mediastore/internal/endpoints/endpoints.go +++ b/service/mediastore/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -66,7 +81,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mediastoredata/internal/endpoints/endpoints.go b/service/mediastoredata/internal/endpoints/endpoints.go index d1916d78985..83b5502f3bf 100644 --- a/service/mediastoredata/internal/endpoints/endpoints.go +++ b/service/mediastoredata/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -66,7 +81,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mediatailor/internal/endpoints/endpoints.go b/service/mediatailor/internal/endpoints/endpoints.go index c6508acbce1..e6c6fe689b1 100644 --- a/service/mediatailor/internal/endpoints/endpoints.go +++ b/service/mediatailor/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/migrationhub/internal/endpoints/endpoints.go b/service/migrationhub/internal/endpoints/endpoints.go index 5e7fac584fe..d2534d4783f 100644 --- a/service/migrationhub/internal/endpoints/endpoints.go +++ b/service/migrationhub/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/migrationhubconfig/internal/endpoints/endpoints.go b/service/migrationhubconfig/internal/endpoints/endpoints.go index dd75a4975a2..9bcc85bf5bb 100644 --- a/service/migrationhubconfig/internal/endpoints/endpoints.go +++ b/service/migrationhubconfig/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mobile/internal/endpoints/endpoints.go b/service/mobile/internal/endpoints/endpoints.go index 2941f803e98..5fbf4b81c0a 100644 --- a/service/mobile/internal/endpoints/endpoints.go +++ b/service/mobile/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mq/internal/endpoints/endpoints.go b/service/mq/internal/endpoints/endpoints.go index 383fb3bb437..1469acb1be6 100644 --- a/service/mq/internal/endpoints/endpoints.go +++ b/service/mq/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -110,7 +125,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -120,7 +135,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -130,7 +145,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mturk/internal/endpoints/endpoints.go b/service/mturk/internal/endpoints/endpoints.go index b513bd06a4f..4b84852bbac 100644 --- a/service/mturk/internal/endpoints/endpoints.go +++ b/service/mturk/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "sandbox": endpoints.Endpoint{ @@ -61,7 +76,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -71,7 +86,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/mwaa/internal/endpoints/endpoints.go b/service/mwaa/internal/endpoints/endpoints.go index 66a040873d4..efa4b598a31 100644 --- a/service/mwaa/internal/endpoints/endpoints.go +++ b/service/mwaa/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -66,7 +81,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/neptune/internal/endpoints/endpoints.go b/service/neptune/internal/endpoints/endpoints.go index cc1e767ccf5..251990fe9c6 100644 --- a/service/neptune/internal/endpoints/endpoints.go +++ b/service/neptune/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -148,7 +163,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "rds.us-gov-east-1": endpoints.Endpoint{ diff --git a/service/networkfirewall/internal/endpoints/endpoints.go b/service/networkfirewall/internal/endpoints/endpoints.go index 2902a120530..8dd0a8c4b57 100644 --- a/service/networkfirewall/internal/endpoints/endpoints.go +++ b/service/networkfirewall/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/networkmanager/internal/endpoints/endpoints.go b/service/networkmanager/internal/endpoints/endpoints.go index ba415390fca..8adc41a8e6e 100644 --- a/service/networkmanager/internal/endpoints/endpoints.go +++ b/service/networkmanager/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/opsworks/internal/endpoints/endpoints.go b/service/opsworks/internal/endpoints/endpoints.go index 9ccd95d9d70..e691e2787c6 100644 --- a/service/opsworks/internal/endpoints/endpoints.go +++ b/service/opsworks/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -72,7 +87,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/opsworkscm/internal/endpoints/endpoints.go b/service/opsworkscm/internal/endpoints/endpoints.go index 9031f5d9f7f..1b4a51b68db 100644 --- a/service/opsworkscm/internal/endpoints/endpoints.go +++ b/service/opsworkscm/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -66,7 +81,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/organizations/internal/endpoints/endpoints.go b/service/organizations/internal/endpoints/endpoints.go index 5de4097fd86..67d95f95858 100644 --- a/service/organizations/internal/endpoints/endpoints.go +++ b/service/organizations/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", Endpoints: endpoints.Endpoints{ @@ -89,7 +104,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -99,7 +114,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -109,7 +124,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: false, PartitionEndpoint: "aws-us-gov-global", Endpoints: endpoints.Endpoints{ diff --git a/service/outposts/internal/endpoints/endpoints.go b/service/outposts/internal/endpoints/endpoints.go index 4e7943a62cb..ad2b8ea5753 100644 --- a/service/outposts/internal/endpoints/endpoints.go +++ b/service/outposts/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -130,7 +145,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -140,7 +155,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/personalize/internal/endpoints/endpoints.go b/service/personalize/internal/endpoints/endpoints.go index 74d928d4111..bc2b6e841f2 100644 --- a/service/personalize/internal/endpoints/endpoints.go +++ b/service/personalize/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/personalizeevents/internal/endpoints/endpoints.go b/service/personalizeevents/internal/endpoints/endpoints.go index e2e4d458ee2..08b014f3c73 100644 --- a/service/personalizeevents/internal/endpoints/endpoints.go +++ b/service/personalizeevents/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/personalizeruntime/internal/endpoints/endpoints.go b/service/personalizeruntime/internal/endpoints/endpoints.go index 77dcb5f191b..9dac71df149 100644 --- a/service/personalizeruntime/internal/endpoints/endpoints.go +++ b/service/personalizeruntime/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/pi/internal/endpoints/endpoints.go b/service/pi/internal/endpoints/endpoints.go index 577ce0db507..6b671d8728e 100644 --- a/service/pi/internal/endpoints/endpoints.go +++ b/service/pi/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/pinpoint/internal/endpoints/endpoints.go b/service/pinpoint/internal/endpoints/endpoints.go index b1f80eabbe0..5cd8578160a 100644 --- a/service/pinpoint/internal/endpoints/endpoints.go +++ b/service/pinpoint/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "mobiletargeting", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -103,7 +118,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -113,7 +128,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "mobiletargeting", }, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/pinpointemail/internal/endpoints/endpoints.go b/service/pinpointemail/internal/endpoints/endpoints.go index 9ff28c61fa8..0d847ce864a 100644 --- a/service/pinpointemail/internal/endpoints/endpoints.go +++ b/service/pinpointemail/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-south-1": endpoints.Endpoint{}, @@ -63,7 +78,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -73,7 +88,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/pinpointsmsvoice/internal/endpoints/endpoints.go b/service/pinpointsmsvoice/internal/endpoints/endpoints.go index db9724aee9b..4e4a5a166a2 100644 --- a/service/pinpointsmsvoice/internal/endpoints/endpoints.go +++ b/service/pinpointsmsvoice/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/polly/internal/endpoints/endpoints.go b/service/polly/internal/endpoints/endpoints.go index db6e446ec3a..59605f2e7bb 100644 --- a/service/polly/internal/endpoints/endpoints.go +++ b/service/polly/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -99,7 +114,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-northwest-1": endpoints.Endpoint{}, @@ -112,7 +127,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -132,7 +147,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/pricing/internal/endpoints/endpoints.go b/service/pricing/internal/endpoints/endpoints.go index bfbed92f3d3..67a5c42f18c 100644 --- a/service/pricing/internal/endpoints/endpoints.go +++ b/service/pricing/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -48,7 +63,7 @@ var defaultPartitions = endpoints.Partitions{ Service: "pricing", }, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-south-1": endpoints.Endpoint{}, @@ -62,7 +77,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -72,7 +87,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -82,7 +97,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/qldb/internal/endpoints/endpoints.go b/service/qldb/internal/endpoints/endpoints.go index 1263a584455..cb8b0626515 100644 --- a/service/qldb/internal/endpoints/endpoints.go +++ b/service/qldb/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -66,7 +81,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/qldbsession/internal/endpoints/endpoints.go b/service/qldbsession/internal/endpoints/endpoints.go index d99715c60d0..2bcc0e17553 100644 --- a/service/qldbsession/internal/endpoints/endpoints.go +++ b/service/qldbsession/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -66,7 +81,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -76,7 +91,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -86,7 +101,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -96,7 +111,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/quicksight/internal/endpoints/endpoints.go b/service/quicksight/internal/endpoints/endpoints.go index d01a504d62d..3f60648b2e3 100644 --- a/service/quicksight/internal/endpoints/endpoints.go +++ b/service/quicksight/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/ram/internal/endpoints/endpoints.go b/service/ram/internal/endpoints/endpoints.go index 1a8ad3db43a..4361ab1c790 100644 --- a/service/ram/internal/endpoints/endpoints.go +++ b/service/ram/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -121,7 +136,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -141,7 +156,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/rds/internal/endpoints/endpoints.go b/service/rds/internal/endpoints/endpoints.go index 1bcafc1d415..25be3541905 100644 --- a/service/rds/internal/endpoints/endpoints.go +++ b/service/rds/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -148,7 +163,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "rds.us-gov-east-1": endpoints.Endpoint{ diff --git a/service/rdsdata/internal/endpoints/endpoints.go b/service/rdsdata/internal/endpoints/endpoints.go index dd693a07528..a0b7798e066 100644 --- a/service/rdsdata/internal/endpoints/endpoints.go +++ b/service/rdsdata/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/redshift/internal/endpoints/endpoints.go b/service/redshift/internal/endpoints/endpoints.go index b73c854419f..f719d24d4bd 100644 --- a/service/redshift/internal/endpoints/endpoints.go +++ b/service/redshift/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -148,7 +163,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/redshiftdata/internal/endpoints/endpoints.go b/service/redshiftdata/internal/endpoints/endpoints.go index 5b81a155386..17c3d010231 100644 --- a/service/redshiftdata/internal/endpoints/endpoints.go +++ b/service/redshiftdata/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/rekognition/internal/endpoints/endpoints.go b/service/rekognition/internal/endpoints/endpoints.go index ebe016307b8..6eb3373675c 100644 --- a/service/rekognition/internal/endpoints/endpoints.go +++ b/service/rekognition/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -110,7 +125,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -120,7 +135,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -130,7 +145,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "rekognition-fips.us-gov-west-1": endpoints.Endpoint{ diff --git a/service/resourcegroups/internal/endpoints/endpoints.go b/service/resourcegroups/internal/endpoints/endpoints.go index c9e3b9a9d6f..00b99bab288 100644 --- a/service/resourcegroups/internal/endpoints/endpoints.go +++ b/service/resourcegroups/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go b/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go index 290e1932807..d3b341eb036 100644 --- a/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go +++ b/service/resourcegroupstaggingapi/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -92,7 +107,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -112,7 +127,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/robomaker/internal/endpoints/endpoints.go b/service/robomaker/internal/endpoints/endpoints.go index 175124c8928..75994981c0e 100644 --- a/service/robomaker/internal/endpoints/endpoints.go +++ b/service/robomaker/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/route53/internal/endpoints/endpoints.go b/service/route53/internal/endpoints/endpoints.go index 50e19d73f63..9c82fc9a158 100644 --- a/service/route53/internal/endpoints/endpoints.go +++ b/service/route53/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: false, PartitionEndpoint: "aws-cn-global", Endpoints: endpoints.Endpoints{ @@ -89,7 +104,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: false, PartitionEndpoint: "aws-iso-global", Endpoints: endpoints.Endpoints{ @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: false, PartitionEndpoint: "aws-iso-b-global", Endpoints: endpoints.Endpoints{ @@ -127,7 +142,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: false, PartitionEndpoint: "aws-us-gov-global", Endpoints: endpoints.Endpoints{ diff --git a/service/route53domains/internal/endpoints/endpoints.go b/service/route53domains/internal/endpoints/endpoints.go index 55cddf9c1d5..3b1cf0a397e 100644 --- a/service/route53domains/internal/endpoints/endpoints.go +++ b/service/route53domains/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-east-1": endpoints.Endpoint{}, @@ -58,7 +73,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -68,7 +83,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/route53resolver/internal/endpoints/endpoints.go b/service/route53resolver/internal/endpoints/endpoints.go index 42670bc8f78..5cdd3730197 100644 --- a/service/route53resolver/internal/endpoints/endpoints.go +++ b/service/route53resolver/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -77,7 +92,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -87,7 +102,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/s3/internal/endpoints/endpoints.go b/service/s3/internal/endpoints/endpoints.go index db8ba9fba24..59020ef8702 100644 --- a/service/s3/internal/endpoints/endpoints.go +++ b/service/s3/internal/endpoints/endpoints.go @@ -3,9 +3,11 @@ package endpoints import ( + "fmt" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/endpoints" "regexp" + "strings" ) // Options is the endpoint resolver configuration options @@ -37,6 +39,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +62,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -116,7 +133,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -130,7 +147,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -146,7 +163,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -159,7 +176,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ @@ -179,3 +196,52 @@ var defaultPartitions = endpoints.Partitions{ }, }, } + +// GetDNSSuffix returns the dnsSuffix URL component for the given partition id +func GetDNSSuffix(id string) (string, error) { + switch { + case strings.EqualFold(id, "aws"): + return "amazonaws.com", nil + + case strings.EqualFold(id, "aws-cn"): + return "amazonaws.com.cn", nil + + case strings.EqualFold(id, "aws-iso"): + return "c2s.ic.gov", nil + + case strings.EqualFold(id, "aws-iso-b"): + return "sc2s.sgov.gov", nil + + case strings.EqualFold(id, "aws-us-gov"): + return "amazonaws.com", nil + + default: + return "", fmt.Errorf("unknown partition") + + } +} + +// GetDNSSuffixFromRegion returns the dnsSuffix URL component for the given +// partition id +func GetDNSSuffixFromRegion(region string) (string, error) { + switch { + case partitionRegexp.Aws.MatchString(region): + return "amazonaws.com", nil + + case partitionRegexp.AwsCn.MatchString(region): + return "amazonaws.com.cn", nil + + case partitionRegexp.AwsIso.MatchString(region): + return "c2s.ic.gov", nil + + case partitionRegexp.AwsIsoB.MatchString(region): + return "sc2s.sgov.gov", nil + + case partitionRegexp.AwsUsGov.MatchString(region): + return "amazonaws.com", nil + + default: + return "", fmt.Errorf("unknown region partition") + + } +} diff --git a/service/s3control/internal/endpoints/endpoints.go b/service/s3control/internal/endpoints/endpoints.go index bcded34c4f1..da3226a374a 100644 --- a/service/s3control/internal/endpoints/endpoints.go +++ b/service/s3control/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{ @@ -211,7 +226,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{ @@ -237,7 +252,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -247,7 +262,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -257,7 +272,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/s3control/internal/endpoints/s3/endpoints.go b/service/s3control/internal/endpoints/s3/endpoints.go index db8ba9fba24..46150492cb1 100644 --- a/service/s3control/internal/endpoints/s3/endpoints.go +++ b/service/s3control/internal/endpoints/s3/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -130,7 +145,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -146,7 +161,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -159,7 +174,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/s3outposts/internal/endpoints/endpoints.go b/service/s3outposts/internal/endpoints/endpoints.go index e51e4815b6c..42d9859a2af 100644 --- a/service/s3outposts/internal/endpoints/endpoints.go +++ b/service/s3outposts/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/sagemaker/internal/endpoints/endpoints.go b/service/sagemaker/internal/endpoints/endpoints.go index a6d8b4dbe1c..0322494588d 100644 --- a/service/sagemaker/internal/endpoints/endpoints.go +++ b/service/sagemaker/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -128,7 +143,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -138,7 +153,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{}, diff --git a/service/sagemakera2iruntime/internal/endpoints/endpoints.go b/service/sagemakera2iruntime/internal/endpoints/endpoints.go index d507c043ce0..f36a95b6257 100644 --- a/service/sagemakera2iruntime/internal/endpoints/endpoints.go +++ b/service/sagemakera2iruntime/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/sagemakeredge/internal/endpoints/endpoints.go b/service/sagemakeredge/internal/endpoints/endpoints.go index f96d0ea22f7..9820e2ad5c3 100644 --- a/service/sagemakeredge/internal/endpoints/endpoints.go +++ b/service/sagemakeredge/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go b/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go index a0826cf2472..1939942c2fd 100644 --- a/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go +++ b/service/sagemakerfeaturestoreruntime/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/sagemakerruntime/internal/endpoints/endpoints.go b/service/sagemakerruntime/internal/endpoints/endpoints.go index d5d99ceb8e8..0d88783842b 100644 --- a/service/sagemakerruntime/internal/endpoints/endpoints.go +++ b/service/sagemakerruntime/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -128,7 +143,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -138,7 +153,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{}, diff --git a/service/savingsplans/internal/endpoints/endpoints.go b/service/savingsplans/internal/endpoints/endpoints.go index a1682ec4e93..540f6cc5e96 100644 --- a/service/savingsplans/internal/endpoints/endpoints.go +++ b/service/savingsplans/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -64,7 +79,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/schemas/internal/endpoints/endpoints.go b/service/schemas/internal/endpoints/endpoints.go index 8704bd33343..5766470fb0b 100644 --- a/service/schemas/internal/endpoints/endpoints.go +++ b/service/schemas/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -74,7 +89,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -84,7 +99,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -104,7 +119,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/secretsmanager/internal/endpoints/endpoints.go b/service/secretsmanager/internal/endpoints/endpoints.go index 09b0ffae6db..135bc8194ab 100644 --- a/service/secretsmanager/internal/endpoints/endpoints.go +++ b/service/secretsmanager/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -139,7 +154,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/securityhub/internal/endpoints/endpoints.go b/service/securityhub/internal/endpoints/endpoints.go index c558c8aecce..d52fe974a75 100644 --- a/service/securityhub/internal/endpoints/endpoints.go +++ b/service/securityhub/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -125,7 +140,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/serverlessapplicationrepository/internal/endpoints/endpoints.go b/service/serverlessapplicationrepository/internal/endpoints/endpoints.go index c3face15166..9d202f7fb1d 100644 --- a/service/serverlessapplicationrepository/internal/endpoints/endpoints.go +++ b/service/serverlessapplicationrepository/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{ @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{ @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -139,7 +154,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -149,7 +164,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/servicecatalog/internal/endpoints/endpoints.go b/service/servicecatalog/internal/endpoints/endpoints.go index 265e22f7735..4ca17b48c4a 100644 --- a/service/servicecatalog/internal/endpoints/endpoints.go +++ b/service/servicecatalog/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -121,7 +136,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/servicecatalogappregistry/internal/endpoints/endpoints.go b/service/servicecatalogappregistry/internal/endpoints/endpoints.go index ef5a190ba8d..3546b75d9b0 100644 --- a/service/servicecatalogappregistry/internal/endpoints/endpoints.go +++ b/service/servicecatalogappregistry/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/servicediscovery/internal/endpoints/endpoints.go b/service/servicediscovery/internal/endpoints/endpoints.go index 48c67e5c710..b08232968f0 100644 --- a/service/servicediscovery/internal/endpoints/endpoints.go +++ b/service/servicediscovery/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/servicequotas/internal/endpoints/endpoints.go b/service/servicequotas/internal/endpoints/endpoints.go index 61a08da7f62..2dfbcbff0af 100644 --- a/service/servicequotas/internal/endpoints/endpoints.go +++ b/service/servicequotas/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -78,7 +93,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -88,7 +103,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -98,7 +113,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/ses/internal/endpoints/endpoints.go b/service/ses/internal/endpoints/endpoints.go index 84d618ca019..e280612c5f1 100644 --- a/service/ses/internal/endpoints/endpoints.go +++ b/service/ses/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-south-1": endpoints.Endpoint{}, @@ -63,7 +78,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -73,7 +88,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/sesv2/internal/endpoints/endpoints.go b/service/sesv2/internal/endpoints/endpoints.go index cc6c42695e1..39f2c478657 100644 --- a/service/sesv2/internal/endpoints/endpoints.go +++ b/service/sesv2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-south-1": endpoints.Endpoint{}, @@ -63,7 +78,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -73,7 +88,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -93,7 +108,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/sfn/internal/endpoints/endpoints.go b/service/sfn/internal/endpoints/endpoints.go index 78255ec1a54..590b1dd05f6 100644 --- a/service/sfn/internal/endpoints/endpoints.go +++ b/service/sfn/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/shield/internal/endpoints/endpoints.go b/service/shield/internal/endpoints/endpoints.go index 0aa53dd7314..a3a57043001 100644 --- a/service/shield/internal/endpoints/endpoints.go +++ b/service/shield/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/signer/internal/endpoints/endpoints.go b/service/signer/internal/endpoints/endpoints.go index 64fc2212c1b..dc152d985ea 100644 --- a/service/signer/internal/endpoints/endpoints.go +++ b/service/signer/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/sms/internal/endpoints/endpoints.go b/service/sms/internal/endpoints/endpoints.go index 0a8ded77652..b3ac36db355 100644 --- a/service/sms/internal/endpoints/endpoints.go +++ b/service/sms/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -115,7 +130,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -125,7 +140,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/snowball/internal/endpoints/endpoints.go b/service/snowball/internal/endpoints/endpoints.go index 72c5d0567d9..366f890c651 100644 --- a/service/snowball/internal/endpoints/endpoints.go +++ b/service/snowball/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -173,7 +188,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -199,7 +214,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -212,7 +227,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -225,7 +240,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/sns/internal/endpoints/endpoints.go b/service/sns/internal/endpoints/endpoints.go index f1d85f5d87a..926bd4d3086 100644 --- a/service/sns/internal/endpoints/endpoints.go +++ b/service/sns/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -144,7 +159,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/sqs/internal/endpoints/endpoints.go b/service/sqs/internal/endpoints/endpoints.go index 040ef3d6f62..cc1fab22471 100644 --- a/service/sqs/internal/endpoints/endpoints.go +++ b/service/sqs/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{ @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -144,7 +159,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/ssm/internal/endpoints/endpoints.go b/service/ssm/internal/endpoints/endpoints.go index d3d22d2463b..24c48ade116 100644 --- a/service/ssm/internal/endpoints/endpoints.go +++ b/service/ssm/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -148,7 +163,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/sso/internal/endpoints/endpoints.go b/service/sso/internal/endpoints/endpoints.go index 697414b888c..398f8bc96aa 100644 --- a/service/sso/internal/endpoints/endpoints.go +++ b/service/sso/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-southeast-1": endpoints.Endpoint{ @@ -111,7 +126,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -121,7 +136,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -131,7 +146,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -141,7 +156,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/ssoadmin/internal/endpoints/endpoints.go b/service/ssoadmin/internal/endpoints/endpoints.go index c8c7580da81..e067a94dd6b 100644 --- a/service/ssoadmin/internal/endpoints/endpoints.go +++ b/service/ssoadmin/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/ssooidc/internal/endpoints/endpoints.go b/service/ssooidc/internal/endpoints/endpoints.go index 4ca7cc77a79..c9307a6178c 100644 --- a/service/ssooidc/internal/endpoints/endpoints.go +++ b/service/ssooidc/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{ @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -145,7 +160,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -155,7 +170,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -165,7 +180,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/storagegateway/internal/endpoints/endpoints.go b/service/storagegateway/internal/endpoints/endpoints.go index 9ae5b9e57ab..82b0bfe9096 100644 --- a/service/storagegateway/internal/endpoints/endpoints.go +++ b/service/storagegateway/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -83,7 +98,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -97,7 +112,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips": endpoints.Endpoint{ diff --git a/service/sts/internal/endpoints/endpoints.go b/service/sts/internal/endpoints/endpoints.go index 6ecbfa06a43..e99aab6a62c 100644 --- a/service/sts/internal/endpoints/endpoints.go +++ b/service/sts/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -108,7 +123,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -148,7 +163,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{}, diff --git a/service/support/internal/endpoints/endpoints.go b/service/support/internal/endpoints/endpoints.go index f81de8286da..abf6d4c1969 100644 --- a/service/support/internal/endpoints/endpoints.go +++ b/service/support/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "aws-global": endpoints.Endpoint{ @@ -63,7 +78,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "aws-cn-global": endpoints.Endpoint{ @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "aws-iso-global": endpoints.Endpoint{ @@ -99,7 +114,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "aws-iso-b-global": endpoints.Endpoint{ @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "aws-us-gov-global": endpoints.Endpoint{ diff --git a/service/swf/internal/endpoints/endpoints.go b/service/swf/internal/endpoints/endpoints.go index 993a18088c1..10c79532e45 100644 --- a/service/swf/internal/endpoints/endpoints.go +++ b/service/swf/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -129,7 +144,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-isob-east-1": endpoints.Endpoint{}, @@ -142,7 +157,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-east-1": endpoints.Endpoint{ diff --git a/service/synthetics/internal/endpoints/endpoints.go b/service/synthetics/internal/endpoints/endpoints.go index 0757b4b6399..d8d44fbeb5c 100644 --- a/service/synthetics/internal/endpoints/endpoints.go +++ b/service/synthetics/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/textract/internal/endpoints/endpoints.go b/service/textract/internal/endpoints/endpoints.go index 3e4dfcc5474..753bd7bed0a 100644 --- a/service/textract/internal/endpoints/endpoints.go +++ b/service/textract/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/timestreamquery/internal/endpoints/endpoints.go b/service/timestreamquery/internal/endpoints/endpoints.go index 7e46b400b93..84df6bea531 100644 --- a/service/timestreamquery/internal/endpoints/endpoints.go +++ b/service/timestreamquery/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/timestreamwrite/internal/endpoints/endpoints.go b/service/timestreamwrite/internal/endpoints/endpoints.go index f867fef75ca..baf7927a44f 100644 --- a/service/timestreamwrite/internal/endpoints/endpoints.go +++ b/service/timestreamwrite/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/transcribe/internal/endpoints/endpoints.go b/service/transcribe/internal/endpoints/endpoints.go index c36d48765b0..69edd845334 100644 --- a/service/transcribe/internal/endpoints/endpoints.go +++ b/service/transcribe/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -98,7 +113,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{ @@ -122,7 +137,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -135,7 +150,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -145,7 +160,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/transfer/internal/endpoints/endpoints.go b/service/transfer/internal/endpoints/endpoints.go index aeb7c7aee70..ea240f63ad0 100644 --- a/service/transfer/internal/endpoints/endpoints.go +++ b/service/transfer/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -106,7 +121,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/translate/internal/endpoints/endpoints.go b/service/translate/internal/endpoints/endpoints.go index 10cc4aaf5c8..c034489b92e 100644 --- a/service/translate/internal/endpoints/endpoints.go +++ b/service/translate/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-east-1": endpoints.Endpoint{}, @@ -91,7 +106,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -101,7 +116,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -114,7 +129,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -124,7 +139,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-gov-west-1": endpoints.Endpoint{}, diff --git a/service/waf/internal/endpoints/endpoints.go b/service/waf/internal/endpoints/endpoints.go index 239e7f4adb8..1f15710743e 100644 --- a/service/waf/internal/endpoints/endpoints.go +++ b/service/waf/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: false, PartitionEndpoint: "aws-global", Endpoints: endpoints.Endpoints{ @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -100,7 +115,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/wafregional/internal/endpoints/endpoints.go b/service/wafregional/internal/endpoints/endpoints.go index 7ee1217826a..c111d0c3298 100644 --- a/service/wafregional/internal/endpoints/endpoints.go +++ b/service/wafregional/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{ @@ -297,7 +312,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -307,7 +322,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -317,7 +332,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -327,7 +342,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{ diff --git a/service/wafv2/internal/endpoints/endpoints.go b/service/wafv2/internal/endpoints/endpoints.go index 9793b043acf..8a0648efbbb 100644 --- a/service/wafv2/internal/endpoints/endpoints.go +++ b/service/wafv2/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/wellarchitected/internal/endpoints/endpoints.go b/service/wellarchitected/internal/endpoints/endpoints.go index fb0e13ab1af..4412ee761f4 100644 --- a/service/wellarchitected/internal/endpoints/endpoints.go +++ b/service/wellarchitected/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/workdocs/internal/endpoints/endpoints.go b/service/workdocs/internal/endpoints/endpoints.go index bed51a0f7e9..2630d84fa60 100644 --- a/service/workdocs/internal/endpoints/endpoints.go +++ b/service/workdocs/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -95,7 +110,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -105,7 +120,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/worklink/internal/endpoints/endpoints.go b/service/worklink/internal/endpoints/endpoints.go index 7b632bdfeac..0ed2cd6f0fa 100644 --- a/service/worklink/internal/endpoints/endpoints.go +++ b/service/worklink/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/workmail/internal/endpoints/endpoints.go b/service/workmail/internal/endpoints/endpoints.go index e7feeb2b631..88dc477f0c3 100644 --- a/service/workmail/internal/endpoints/endpoints.go +++ b/service/workmail/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "eu-west-1": endpoints.Endpoint{}, @@ -60,7 +75,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -70,7 +85,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -80,7 +95,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -90,7 +105,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/workmailmessageflow/internal/endpoints/endpoints.go b/service/workmailmessageflow/internal/endpoints/endpoints.go index 051b8147bfa..6b6f5050d4c 100644 --- a/service/workmailmessageflow/internal/endpoints/endpoints.go +++ b/service/workmailmessageflow/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, }, { @@ -55,7 +70,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, }, { @@ -65,7 +80,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -75,7 +90,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -85,7 +100,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, }, } diff --git a/service/workspaces/internal/endpoints/endpoints.go b/service/workspaces/internal/endpoints/endpoints.go index 4483f119f5a..94d0b6fe413 100644 --- a/service/workspaces/internal/endpoints/endpoints.go +++ b/service/workspaces/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "ap-northeast-1": endpoints.Endpoint{}, @@ -81,7 +96,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-northwest-1": endpoints.Endpoint{}, @@ -94,7 +109,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "us-iso-east-1": endpoints.Endpoint{}, @@ -107,7 +122,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -117,7 +132,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-west-1": endpoints.Endpoint{ diff --git a/service/xray/internal/endpoints/endpoints.go b/service/xray/internal/endpoints/endpoints.go index e80aee3cda4..1db09e625fa 100644 --- a/service/xray/internal/endpoints/endpoints.go +++ b/service/xray/internal/endpoints/endpoints.go @@ -37,6 +37,21 @@ func New() *Resolver { } } +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + var defaultPartitions = endpoints.Partitions{ { ID: "aws", @@ -45,7 +60,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "af-south-1": endpoints.Endpoint{}, @@ -102,7 +117,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "cn-north-1": endpoints.Endpoint{}, @@ -116,7 +131,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, }, { @@ -126,7 +141,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, }, { @@ -136,7 +151,7 @@ var defaultPartitions = endpoints.Partitions{ Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, - RegionRegex: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), + RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ "fips-us-gov-east-1": endpoints.Endpoint{