aws-partitions 1.522.0 → 1.526.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/VERSION +1 -1
- data/lib/aws-partitions/endpoint_provider.rb +124 -44
- data/lib/aws-partitions/service.rb +27 -0
- data/lib/aws-partitions.rb +1 -0
- data/partitions.json +5803 -844
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed4579a130cf928c8a23794721813bc4a1edaa76bbcc44588ce7f3a15c73d2f8
|
|
4
|
+
data.tar.gz: 980cb4698252a745bdbfb0c3fd3524f8ec0cf02505b4e4623a9edc93a7423745
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4442eee350138adf36828ecade8c28f7125fc006f7d633811d58ccbf7bc980b7370f4568986727590bea628b60fb979a82b65bcc6fe32a3bd90eea021d2734a5
|
|
7
|
+
data.tar.gz: 89e612d31eec8b543fb39d3eb98861c0e1fb6e503dec733cd3080a6536fb9c8e209e674873af5d79102cd2d5697865ec0028e56baa450e31ece9e427f3a6723c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
Unreleased Changes
|
|
2
2
|
------------------
|
|
3
3
|
|
|
4
|
+
1.526.0 (2021-11-09)
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
* Feature - Updated the partitions source data the determines the AWS service regions and endpoints.
|
|
8
|
+
|
|
9
|
+
1.525.0 (2021-11-04)
|
|
10
|
+
------------------
|
|
11
|
+
|
|
12
|
+
* Feature - Added support for enumerating regions for `Aws::ChimeSDKMeetings`.
|
|
13
|
+
|
|
14
|
+
* Feature - Support modeled dualstack and fips endpoints in `Aws::Partitions::EndpointProvider`.
|
|
15
|
+
|
|
16
|
+
1.524.0 (2021-11-03)
|
|
17
|
+
------------------
|
|
18
|
+
|
|
19
|
+
* Feature - Updated the partitions source data the determines the AWS service regions and endpoints.
|
|
20
|
+
|
|
21
|
+
1.523.0 (2021-11-02)
|
|
22
|
+
------------------
|
|
23
|
+
|
|
24
|
+
* Feature - Updated the partitions source data the determines the AWS service regions and endpoints.
|
|
25
|
+
|
|
4
26
|
1.522.0 (2021-11-01)
|
|
5
27
|
------------------
|
|
6
28
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.526.0
|
|
@@ -37,15 +37,19 @@ module Aws
|
|
|
37
37
|
# "monitoring" for cloudwatch.
|
|
38
38
|
# @param [String] sts_regional_endpoints [STS only] Whether to use
|
|
39
39
|
# `legacy` (global endpoint for legacy regions) or `regional` mode for
|
|
40
|
-
#
|
|
40
|
+
# using regional endpoint for supported regions except 'aws-global'
|
|
41
|
+
# @param [Hash] variants Endpoint variants such as 'fips' or 'dualstack'
|
|
42
|
+
# @option variants [Boolean] :dualstack When true, resolve a dualstack
|
|
43
|
+
# endpoint.
|
|
44
|
+
# @option variants [Boolean] :fips When true, resolve a FIPS endpoint.
|
|
41
45
|
# @api private Use the static class methods instead.
|
|
42
|
-
def resolve(region, service, sts_regional_endpoints)
|
|
43
|
-
'https://' + endpoint_for(region, service, sts_regional_endpoints)
|
|
46
|
+
def resolve(region, service, sts_regional_endpoints, variants)
|
|
47
|
+
'https://' + endpoint_for(region, service, build_is_global_fn(sts_regional_endpoints), variants)
|
|
44
48
|
end
|
|
45
49
|
|
|
46
50
|
# @api private Use the static class methods instead.
|
|
47
51
|
def signing_region(region, service, sts_regional_endpoints)
|
|
48
|
-
credential_scope(region, service, sts_regional_endpoints)
|
|
52
|
+
credential_scope(region, service, build_is_global_fn(sts_regional_endpoints))
|
|
49
53
|
.fetch('region', region)
|
|
50
54
|
end
|
|
51
55
|
|
|
@@ -54,47 +58,87 @@ module Aws
|
|
|
54
58
|
# don't default to the service name
|
|
55
59
|
# signers should prefer the api metadata's signingName
|
|
56
60
|
# if no service is set in the credentialScope
|
|
57
|
-
credential_scope(region, service, 'regional')
|
|
61
|
+
credential_scope(region, service, build_is_global_fn('regional'))
|
|
58
62
|
.fetch('service', nil)
|
|
59
63
|
end
|
|
60
64
|
|
|
65
|
+
# @param [String] region The region used to fetch the partition.
|
|
66
|
+
# @param [String] service Used only if dualstack is true. Used to find a
|
|
67
|
+
# DNS suffix for a specific service.
|
|
68
|
+
# @param [Hash] variants Endpoint variants such as 'fips' or 'dualstack'
|
|
69
|
+
# @option variants [Boolean] :dualstack When true, resolve a dualstack
|
|
70
|
+
# endpoint.
|
|
71
|
+
# @option variants [Boolean] :fips When true, resolve a FIPS endpoint.
|
|
61
72
|
# @api private Use the static class methods instead.
|
|
62
|
-
def
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
def dns_suffix_for(region, service, variants)
|
|
74
|
+
if configured_variants?(variants)
|
|
75
|
+
resolve_variant(region, service, variants)['dnsSuffix']
|
|
76
|
+
else
|
|
77
|
+
get_partition(region)['dnsSuffix']
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
private
|
|
67
82
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
STS_LEGACY_REGIONS.include?(region)
|
|
83
|
+
def configured_variants?(variants)
|
|
84
|
+
variants.values.any?
|
|
85
|
+
end
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
def fetch_variant(cfg, tags)
|
|
88
|
+
variants = cfg.fetch('variants', [])
|
|
89
|
+
variants.find { |v| tags == Set.new(v['tags']) } || {}
|
|
90
|
+
end
|
|
75
91
|
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
def resolve_variant(region, service, config_variants)
|
|
93
|
+
tags = Set.new(config_variants.select { |_k,v| v == true }.map { |k,_v| k.to_s })
|
|
94
|
+
is_global_fn = build_is_global_fn # ignore legacy STS config for variants
|
|
95
|
+
|
|
96
|
+
partition_cfg = get_partition(region)
|
|
97
|
+
service_cfg = partition_cfg.fetch('services', {})
|
|
98
|
+
.fetch(service, {})
|
|
99
|
+
|
|
100
|
+
endpoints_cfg = service_cfg.fetch('endpoints', {})
|
|
101
|
+
|
|
102
|
+
if is_global_fn.call(service, region, endpoints_cfg, service_cfg)
|
|
78
103
|
region = service_cfg.fetch('partitionEndpoint', region)
|
|
79
104
|
end
|
|
80
105
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
.fetch('credentialScope', {})
|
|
106
|
+
region_cfg = endpoints_cfg.fetch(region, {})
|
|
107
|
+
warn_deprecation(service, region) if region_cfg['deprecated']
|
|
84
108
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
109
|
+
partition_defaults = fetch_variant(partition_cfg.fetch('defaults', {}), tags)
|
|
110
|
+
service_defaults = fetch_variant(service_cfg.fetch('defaults', {}), tags)
|
|
111
|
+
endpoint_cfg = fetch_variant(region_cfg, tags)
|
|
112
|
+
|
|
113
|
+
# merge upwards, preferring values from endpoint > service > partition
|
|
114
|
+
partition_defaults.merge(service_defaults.merge(endpoint_cfg))
|
|
88
115
|
end
|
|
89
116
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
117
|
+
def validate_variant!(config_variants, resolved_variant)
|
|
118
|
+
unless resolved_variant['hostname'] && resolved_variant['dnsSuffix']
|
|
119
|
+
enabled_variants = config_variants.select { |_k, v| v}.map { |k, _v| k.to_s }.join(', ')
|
|
120
|
+
raise ArgumentError,
|
|
121
|
+
"#{enabled_variants} not supported for this region and partition."
|
|
122
|
+
end
|
|
93
123
|
end
|
|
94
124
|
|
|
95
|
-
|
|
125
|
+
def endpoint_for(region, service, is_global_fn, variants)
|
|
126
|
+
if configured_variants?(variants)
|
|
127
|
+
endpoint_with_variants_for(region, service, variants)
|
|
128
|
+
else
|
|
129
|
+
endpoint_no_variants_for(region, service, is_global_fn)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def endpoint_with_variants_for(region, service, variants)
|
|
134
|
+
variant = resolve_variant(region, service, variants)
|
|
135
|
+
validate_variant!(variants, variant)
|
|
136
|
+
variant['hostname'].sub('{region}', region)
|
|
137
|
+
.sub('{service}', service)
|
|
138
|
+
.sub('{dnsSuffix}', variant['dnsSuffix'])
|
|
139
|
+
end
|
|
96
140
|
|
|
97
|
-
def
|
|
141
|
+
def endpoint_no_variants_for(region, service, is_global_fn)
|
|
98
142
|
partition = get_partition(region)
|
|
99
143
|
service_cfg = partition.fetch('services', {}).fetch(service, {})
|
|
100
144
|
|
|
@@ -105,30 +149,66 @@ module Aws
|
|
|
105
149
|
|
|
106
150
|
endpoints = service_cfg.fetch('endpoints', {})
|
|
107
151
|
|
|
108
|
-
# Check for sts legacy behavior
|
|
109
|
-
sts_legacy = service == 'sts' &&
|
|
110
|
-
sts_regional_endpoints == 'legacy' &&
|
|
111
|
-
STS_LEGACY_REGIONS.include?(region)
|
|
112
|
-
|
|
113
|
-
is_global = !endpoints.key?(region) &&
|
|
114
|
-
service_cfg['isRegionalized'] == false
|
|
115
|
-
|
|
116
152
|
# Check for global endpoint.
|
|
117
|
-
if
|
|
153
|
+
if is_global_fn.call(service, region, endpoints, service_cfg)
|
|
118
154
|
region = service_cfg.fetch('partitionEndpoint', region)
|
|
119
155
|
end
|
|
120
156
|
|
|
121
157
|
# Check for service/region level endpoint.
|
|
122
|
-
|
|
158
|
+
region_cfg = endpoints
|
|
123
159
|
.fetch(region, {})
|
|
160
|
+
endpoint = region_cfg
|
|
124
161
|
.fetch('hostname', default_endpoint)
|
|
125
162
|
|
|
163
|
+
warn_deprecation(service, region) if region_cfg['deprecated']
|
|
164
|
+
|
|
126
165
|
# Replace placeholders from the endpoints
|
|
127
166
|
endpoint.sub('{region}', region)
|
|
128
167
|
.sub('{service}', service)
|
|
129
168
|
.sub('{dnsSuffix}', partition['dnsSuffix'])
|
|
130
169
|
end
|
|
131
170
|
|
|
171
|
+
def warn_deprecation(service, region)
|
|
172
|
+
warn("The endpoint for service: #{service}, region: #{region}"\
|
|
173
|
+
' is deprecated.')
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# returns a callable that takes a region
|
|
177
|
+
# and returns true if the service is global
|
|
178
|
+
def build_is_global_fn(sts_regional_endpoints='regional')
|
|
179
|
+
lambda do |service, region, endpoints, service_cfg|
|
|
180
|
+
# Check for sts legacy behavior
|
|
181
|
+
sts_legacy = service == 'sts' &&
|
|
182
|
+
sts_regional_endpoints == 'legacy' &&
|
|
183
|
+
STS_LEGACY_REGIONS.include?(region)
|
|
184
|
+
|
|
185
|
+
is_global = !endpoints.key?(region) &&
|
|
186
|
+
service_cfg['isRegionalized'] == false
|
|
187
|
+
|
|
188
|
+
sts_legacy || is_global
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def credential_scope(region, service, is_global_fn)
|
|
193
|
+
partition = get_partition(region)
|
|
194
|
+
service_cfg = partition.fetch('services', {})
|
|
195
|
+
.fetch(service, {})
|
|
196
|
+
endpoints = service_cfg.fetch('endpoints', {})
|
|
197
|
+
|
|
198
|
+
# Check for global endpoint.
|
|
199
|
+
if is_global_fn.call(service, region, endpoints, service_cfg)
|
|
200
|
+
region = service_cfg.fetch('partitionEndpoint', region)
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
default_credential_scope = service_cfg
|
|
204
|
+
.fetch('defaults', {})
|
|
205
|
+
.fetch('credentialScope', {})
|
|
206
|
+
|
|
207
|
+
endpoints
|
|
208
|
+
.fetch(region, {})
|
|
209
|
+
.fetch('credentialScope', default_credential_scope)
|
|
210
|
+
end
|
|
211
|
+
|
|
132
212
|
def get_partition(region_or_partition)
|
|
133
213
|
partition_containing_region(region_or_partition) ||
|
|
134
214
|
partition_matching_region(region_or_partition) ||
|
|
@@ -144,7 +224,7 @@ module Aws
|
|
|
144
224
|
|
|
145
225
|
def partition_matching_region(region)
|
|
146
226
|
@rules['partitions'].find do |p|
|
|
147
|
-
region.match(p['regionRegex']) ||
|
|
227
|
+
p['regionRegex'] && region.match(p['regionRegex']) ||
|
|
148
228
|
p['services'].values.find do |svc|
|
|
149
229
|
svc['endpoints'].key?(region) if svc.key?('endpoints')
|
|
150
230
|
end
|
|
@@ -161,8 +241,8 @@ module Aws
|
|
|
161
241
|
end
|
|
162
242
|
|
|
163
243
|
class << self
|
|
164
|
-
def resolve(region, service,
|
|
165
|
-
default_provider.resolve(region, service,
|
|
244
|
+
def resolve(region, service, sts_endpoint = 'regional', variants = {})
|
|
245
|
+
default_provider.resolve(region, service, sts_endpoint, variants)
|
|
166
246
|
end
|
|
167
247
|
|
|
168
248
|
def signing_region(region, service, sts_regional_endpoints = 'regional')
|
|
@@ -173,8 +253,8 @@ module Aws
|
|
|
173
253
|
default_provider.signing_service(region, service)
|
|
174
254
|
end
|
|
175
255
|
|
|
176
|
-
def dns_suffix_for(region)
|
|
177
|
-
default_provider.dns_suffix_for(region)
|
|
256
|
+
def dns_suffix_for(region, service = nil, variants = {})
|
|
257
|
+
default_provider.dns_suffix_for(region, service, variants)
|
|
178
258
|
end
|
|
179
259
|
|
|
180
260
|
private
|
|
@@ -16,6 +16,8 @@ module Aws
|
|
|
16
16
|
@name = options[:name]
|
|
17
17
|
@partition_name = options[:partition_name]
|
|
18
18
|
@regions = options[:regions]
|
|
19
|
+
@fips_regions = options[:fips_regions]
|
|
20
|
+
@dualstack_regions = options[:dualstack_regions]
|
|
19
21
|
@regionalized = options[:regionalized]
|
|
20
22
|
@partition_region = options[:partition_region]
|
|
21
23
|
end
|
|
@@ -31,6 +33,14 @@ module Aws
|
|
|
31
33
|
# Regions are scoped to the partition.
|
|
32
34
|
attr_reader :regions
|
|
33
35
|
|
|
36
|
+
# @return [Set<String>] The FIPS compatible regions this service is
|
|
37
|
+
# available in. Regions are scoped to the partition.
|
|
38
|
+
attr_reader :fips_regions
|
|
39
|
+
|
|
40
|
+
# @return [Set<String>] The Dualstack compatible regions this service is
|
|
41
|
+
# available in. Regions are scoped to the partition.
|
|
42
|
+
attr_reader :dualstack_regions
|
|
43
|
+
|
|
34
44
|
# @return [String,nil] The global patition endpoint for this service.
|
|
35
45
|
# May be `nil`.
|
|
36
46
|
attr_reader :partition_region
|
|
@@ -54,6 +64,8 @@ module Aws
|
|
|
54
64
|
name: service_name,
|
|
55
65
|
partition_name: partition['partition'],
|
|
56
66
|
regions: regions(service, partition),
|
|
67
|
+
fips_regions: variant_regions('fips', service, partition),
|
|
68
|
+
dualstack_regions: variant_regions('dualstack', service, partition),
|
|
57
69
|
regionalized: service['isRegionalized'] != false,
|
|
58
70
|
partition_region: partition_region(service)
|
|
59
71
|
)
|
|
@@ -67,6 +79,21 @@ module Aws
|
|
|
67
79
|
names - ["#{partition['partition']}-global"]
|
|
68
80
|
end
|
|
69
81
|
|
|
82
|
+
def variant_regions(variant_name, service, partition)
|
|
83
|
+
svc_endpoints = service.fetch('endpoints', {})
|
|
84
|
+
names = Set.new
|
|
85
|
+
svc_endpoints.each do |key, value|
|
|
86
|
+
variants = value.fetch('variants', [])
|
|
87
|
+
variants.each do |variant|
|
|
88
|
+
tags = variant.fetch('tags', [])
|
|
89
|
+
if tags.include?(variant_name) && partition['regions'].key?(key)
|
|
90
|
+
names << key
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
names - ["#{partition['partition']}-global"]
|
|
95
|
+
end
|
|
96
|
+
|
|
70
97
|
def partition_region(service)
|
|
71
98
|
service['partitionEndpoint']
|
|
72
99
|
end
|
data/lib/aws-partitions.rb
CHANGED
|
@@ -257,6 +257,7 @@ module Aws
|
|
|
257
257
|
'Budgets' => 'budgets',
|
|
258
258
|
'Chime' => 'chime',
|
|
259
259
|
'ChimeSDKIdentity' => 'identity-chime',
|
|
260
|
+
'ChimeSDKMeetings' => 'meetings-chime',
|
|
260
261
|
'ChimeSDKMessaging' => 'messaging-chime',
|
|
261
262
|
'Cloud9' => 'cloud9',
|
|
262
263
|
'CloudControlApi' => 'cloudcontrolapi',
|