From 242bbdb7747d6146ea8cdecc5eab6b48a89e9b7c Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Tue, 18 Jun 2024 14:43:36 -0400 Subject: [PATCH 1/2] add implicit global region to internal partition metadata --- .../awsrulesfn/internal/partition/codegen.go | 11 ++- internal/endpoints/awsrulesfn/partition.go | 11 ++- internal/endpoints/awsrulesfn/partitions.go | 94 ++++++++++++------- 3 files changed, 70 insertions(+), 46 deletions(-) diff --git a/internal/endpoints/awsrulesfn/internal/partition/codegen.go b/internal/endpoints/awsrulesfn/internal/partition/codegen.go index 899bb9418cf..58646f4b362 100644 --- a/internal/endpoints/awsrulesfn/internal/partition/codegen.go +++ b/internal/endpoints/awsrulesfn/internal/partition/codegen.go @@ -53,11 +53,12 @@ var partitions = []Partition { ID: {{ quote $partition.ID }}, RegionRegex: {{ quote $partition.RegionRegex }}, DefaultConfig: PartitionConfig{ - Name: {{ quote $partition.DefaultConfig.Name }}, - DnsSuffix: {{ quote $partition.DefaultConfig.DnsSuffix }}, - DualStackDnsSuffix: {{ quote $partition.DefaultConfig.DualStackDnsSuffix }}, - SupportsFIPS: {{ $partition.DefaultConfig.SupportsFIPS }}, - SupportsDualStack: {{ $partition.DefaultConfig.SupportsDualStack }}, + Name: {{ quote $partition.DefaultConfig.Name }}, + DnsSuffix: {{ quote $partition.DefaultConfig.DnsSuffix }}, + DualStackDnsSuffix: {{ quote $partition.DefaultConfig.DualStackDnsSuffix }}, + SupportsFIPS: {{ $partition.DefaultConfig.SupportsFIPS }}, + SupportsDualStack: {{ $partition.DefaultConfig.SupportsDualStack }}, + ImplicitGlobalRegion: {{ quote $partition.DefaultConfig.ImplicitGlobalRegion }}, }, Regions: map[string]RegionOverrides { {{- range $region, $config := $partition.Regions }} diff --git a/internal/endpoints/awsrulesfn/partition.go b/internal/endpoints/awsrulesfn/partition.go index ba6032758a5..91414afe81c 100644 --- a/internal/endpoints/awsrulesfn/partition.go +++ b/internal/endpoints/awsrulesfn/partition.go @@ -12,11 +12,12 @@ type Partition struct { // PartitionConfig provides the endpoint metadata for an AWS region or partition. type PartitionConfig struct { - Name string `json:"name"` - DnsSuffix string `json:"dnsSuffix"` - DualStackDnsSuffix string `json:"dualStackDnsSuffix"` - SupportsFIPS bool `json:"supportsFIPS"` - SupportsDualStack bool `json:"supportsDualStack"` + Name string `json:"name"` + DnsSuffix string `json:"dnsSuffix"` + DualStackDnsSuffix string `json:"dualStackDnsSuffix"` + SupportsFIPS bool `json:"supportsFIPS"` + SupportsDualStack bool `json:"supportsDualStack"` + ImplicitGlobalRegion string `json:"implicitGlobalRegion"` } type RegionOverrides struct { diff --git a/internal/endpoints/awsrulesfn/partitions.go b/internal/endpoints/awsrulesfn/partitions.go index 849beffd7da..5f0779997de 100644 --- a/internal/endpoints/awsrulesfn/partitions.go +++ b/internal/endpoints/awsrulesfn/partitions.go @@ -13,11 +13,12 @@ var partitions = []Partition{ ID: "aws", RegionRegex: "^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: "aws", - DnsSuffix: "amazonaws.com", - DualStackDnsSuffix: "api.aws", - SupportsFIPS: true, - SupportsDualStack: true, + Name: "aws", + DnsSuffix: "amazonaws.com", + DualStackDnsSuffix: "api.aws", + SupportsFIPS: true, + SupportsDualStack: true, + ImplicitGlobalRegion: "us-east-1", }, Regions: map[string]RegionOverrides{ "af-south-1": { @@ -111,6 +112,13 @@ var partitions = []Partition{ SupportsFIPS: nil, SupportsDualStack: nil, }, + "ca-west-1": { + Name: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, + SupportsFIPS: nil, + SupportsDualStack: nil, + }, "eu-central-1": { Name: nil, DnsSuffix: nil, @@ -229,11 +237,12 @@ var partitions = []Partition{ ID: "aws-cn", RegionRegex: "^cn\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: "aws-cn", - DnsSuffix: "amazonaws.com.cn", - DualStackDnsSuffix: "api.amazonwebservices.com.cn", - SupportsFIPS: true, - SupportsDualStack: true, + Name: "aws-cn", + DnsSuffix: "amazonaws.com.cn", + DualStackDnsSuffix: "api.amazonwebservices.com.cn", + SupportsFIPS: true, + SupportsDualStack: true, + ImplicitGlobalRegion: "cn-northwest-1", }, Regions: map[string]RegionOverrides{ "aws-cn-global": { @@ -263,11 +272,12 @@ var partitions = []Partition{ ID: "aws-us-gov", RegionRegex: "^us\\-gov\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: "aws-us-gov", - DnsSuffix: "amazonaws.com", - DualStackDnsSuffix: "api.aws", - SupportsFIPS: true, - SupportsDualStack: true, + Name: "aws-us-gov", + DnsSuffix: "amazonaws.com", + DualStackDnsSuffix: "api.aws", + SupportsFIPS: true, + SupportsDualStack: true, + ImplicitGlobalRegion: "us-gov-west-1", }, Regions: map[string]RegionOverrides{ "aws-us-gov-global": { @@ -297,11 +307,12 @@ var partitions = []Partition{ ID: "aws-iso", RegionRegex: "^us\\-iso\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: "aws-iso", - DnsSuffix: "c2s.ic.gov", - DualStackDnsSuffix: "c2s.ic.gov", - SupportsFIPS: true, - SupportsDualStack: false, + Name: "aws-iso", + DnsSuffix: "c2s.ic.gov", + DualStackDnsSuffix: "c2s.ic.gov", + SupportsFIPS: true, + SupportsDualStack: false, + ImplicitGlobalRegion: "us-iso-east-1", }, Regions: map[string]RegionOverrides{ "aws-iso-global": { @@ -331,11 +342,12 @@ var partitions = []Partition{ ID: "aws-iso-b", RegionRegex: "^us\\-isob\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: "aws-iso-b", - DnsSuffix: "sc2s.sgov.gov", - DualStackDnsSuffix: "sc2s.sgov.gov", - SupportsFIPS: true, - SupportsDualStack: false, + Name: "aws-iso-b", + DnsSuffix: "sc2s.sgov.gov", + DualStackDnsSuffix: "sc2s.sgov.gov", + SupportsFIPS: true, + SupportsDualStack: false, + ImplicitGlobalRegion: "us-isob-east-1", }, Regions: map[string]RegionOverrides{ "aws-iso-b-global": { @@ -358,23 +370,33 @@ var partitions = []Partition{ ID: "aws-iso-e", RegionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: "aws-iso-e", - DnsSuffix: "cloud.adc-e.uk", - DualStackDnsSuffix: "cloud.adc-e.uk", - SupportsFIPS: true, - SupportsDualStack: false, + Name: "aws-iso-e", + DnsSuffix: "cloud.adc-e.uk", + DualStackDnsSuffix: "cloud.adc-e.uk", + SupportsFIPS: true, + SupportsDualStack: false, + ImplicitGlobalRegion: "eu-isoe-west-1", + }, + Regions: map[string]RegionOverrides{ + "eu-isoe-west-1": { + Name: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, + SupportsFIPS: nil, + SupportsDualStack: nil, + }, }, - Regions: map[string]RegionOverrides{}, }, { ID: "aws-iso-f", RegionRegex: "^us\\-isof\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: "aws-iso-f", - DnsSuffix: "csp.hci.ic.gov", - DualStackDnsSuffix: "csp.hci.ic.gov", - SupportsFIPS: true, - SupportsDualStack: false, + Name: "aws-iso-f", + DnsSuffix: "csp.hci.ic.gov", + DualStackDnsSuffix: "csp.hci.ic.gov", + SupportsFIPS: true, + SupportsDualStack: false, + ImplicitGlobalRegion: "us-isof-south-1", }, Regions: map[string]RegionOverrides{}, }, From 2b92a19f3bcd2770189207cbe51f30b72933b29d Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Tue, 18 Jun 2024 14:47:06 -0400 Subject: [PATCH 2/2] changelog --- .changelog/94ed40ed612c4d18b9acc033473afc08.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changelog/94ed40ed612c4d18b9acc033473afc08.json diff --git a/.changelog/94ed40ed612c4d18b9acc033473afc08.json b/.changelog/94ed40ed612c4d18b9acc033473afc08.json new file mode 100644 index 00000000000..5715171a808 --- /dev/null +++ b/.changelog/94ed40ed612c4d18b9acc033473afc08.json @@ -0,0 +1,8 @@ +{ + "id": "94ed40ed-612c-4d18-b9ac-c033473afc08", + "type": "feature", + "description": "Add implicit global region to internal endpoint resolution metadata.", + "modules": [ + "." + ] +} \ No newline at end of file