aws-partitions 1.240.0 → 1.241.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/lib/aws-partitions/endpoint_provider.rb +45 -51
- data/partitions.json +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5f8e66f45c0d93782623021e6fb8f7885f9379c
|
4
|
+
data.tar.gz: f0b8682e9cf5b29bbe0a8b83937f7ed24e9f99e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5c2926f091003e975fb3dc93d0b668f8bc1158360b8dbd9110affa728937551d21dc76ca8b709790e0ee2dc76b4bbd16da5bf35e0ad07b108abe82a1ef70a30
|
7
|
+
data.tar.gz: 578c94838153d2e2862d06a762413e527eb2831a28815b20842f2d364a8c9039c4089b6c78f5968fd8b4826692bf65ccd230754fad89d7ea38b61b0f34a0b617
|
@@ -2,11 +2,9 @@ module Aws
|
|
2
2
|
module Partitions
|
3
3
|
# @api private
|
4
4
|
class EndpointProvider
|
5
|
-
|
6
|
-
#
|
7
|
-
|
8
|
-
# following regions
|
9
|
-
STS_LEGACY_REGIONS = %w(
|
5
|
+
# When sts_regional_endpoint is set to `legacy`, the endpoint
|
6
|
+
# pattern stays global for the following regions:
|
7
|
+
STS_LEGACY_REGIONS = %w[
|
10
8
|
ap-northeast-1
|
11
9
|
ap-south-1
|
12
10
|
ap-southeast-1
|
@@ -23,13 +21,13 @@ module Aws
|
|
23
21
|
us-east-2
|
24
22
|
us-west-1
|
25
23
|
us-west-2
|
26
|
-
|
24
|
+
].freeze
|
27
25
|
|
28
26
|
# Can be removed once S3 endpoint is updated
|
29
27
|
S3_IAD_REGIONAL = {
|
30
|
-
|
31
|
-
|
32
|
-
}
|
28
|
+
'hostname' => 's3.us-east-1.amazonaws.com',
|
29
|
+
'signatureVersions' => %w[s3 s3v4]
|
30
|
+
}.freeze
|
33
31
|
|
34
32
|
# Intentionally marked private. The format of the endpoint rules
|
35
33
|
# is an implementation detail.
|
@@ -38,26 +36,26 @@ module Aws
|
|
38
36
|
@rules = rules
|
39
37
|
end
|
40
38
|
|
41
|
-
# @param [String] region
|
42
|
-
# @param [String] service The endpoint prefix for the service, e.g.
|
43
|
-
# cloudwatch.
|
44
|
-
# @param [String] sts_regional_endpoints [STS only] Whether to use
|
45
|
-
# legacy regions) or `regional` mode for
|
46
|
-
#
|
39
|
+
# @param [String] region The region for the client.
|
40
|
+
# @param [String] service The endpoint prefix for the service, e.g.
|
41
|
+
# "monitoring" for cloudwatch.
|
42
|
+
# @param [String] sts_regional_endpoints [STS only] Whether to use
|
43
|
+
# `legacy` (global endpoint for legacy regions) or `regional` mode for
|
44
|
+
# using regional endpoint for supported regions except 'aws-global'
|
47
45
|
# @api private Use the static class methods instead.
|
48
46
|
def resolve(region, service, sts_regional_endpoints)
|
49
|
-
|
47
|
+
'https://' + endpoint_for(region, service, sts_regional_endpoints)
|
50
48
|
end
|
51
49
|
|
52
50
|
# @api private Use the static class methods instead.
|
53
51
|
def signing_region(region, service)
|
54
|
-
get_partition(region)
|
55
|
-
fetch(
|
56
|
-
fetch(service, {})
|
57
|
-
fetch(
|
58
|
-
fetch(region, {})
|
59
|
-
fetch(
|
60
|
-
fetch(
|
52
|
+
get_partition(region)
|
53
|
+
.fetch('services', {})
|
54
|
+
.fetch(service, {})
|
55
|
+
.fetch('endpoints', {})
|
56
|
+
.fetch(region, {})
|
57
|
+
.fetch('credentialScope', {})
|
58
|
+
.fetch('region', region)
|
61
59
|
end
|
62
60
|
|
63
61
|
# @api private Use the static class methods instead.
|
@@ -71,45 +69,45 @@ module Aws
|
|
71
69
|
def endpoint_for(region, service, sts_regional_endpoints)
|
72
70
|
partition = get_partition(region)
|
73
71
|
endpoint = default_endpoint(partition, service, region)
|
74
|
-
service_cfg = partition.fetch(
|
72
|
+
service_cfg = partition.fetch('services', {}).fetch(service, {})
|
75
73
|
|
76
74
|
# Check for service-level default endpoint.
|
77
|
-
endpoint = service_cfg.fetch(
|
75
|
+
endpoint = service_cfg.fetch('defaults', {}).fetch('hostname', endpoint)
|
78
76
|
|
79
77
|
# Check for sts legacy behavior
|
80
78
|
sts_legacy = service == 'sts' &&
|
81
|
-
|
82
|
-
|
79
|
+
sts_regional_endpoints == 'legacy' &&
|
80
|
+
STS_LEGACY_REGIONS.include?(region)
|
83
81
|
|
84
82
|
# Check for global endpoint.
|
85
|
-
if sts_legacy || service_cfg[
|
86
|
-
region = service_cfg.fetch(
|
83
|
+
if sts_legacy || service_cfg['isRegionalized'] == false
|
84
|
+
region = service_cfg.fetch('partitionEndpoint', region)
|
87
85
|
end
|
88
86
|
|
89
87
|
# Can be removed once S3 endpoint is updated
|
90
|
-
if (service == 's3') && (region ==
|
91
|
-
service_cfg[
|
88
|
+
if (service == 's3') && (region == 'us-east-1')
|
89
|
+
service_cfg['endpoints'][region] = S3_IAD_REGIONAL
|
92
90
|
end
|
93
91
|
|
94
92
|
# Check for service/region level endpoint.
|
95
|
-
endpoint = service_cfg.fetch(
|
96
|
-
|
93
|
+
endpoint = service_cfg.fetch('endpoints', {})
|
94
|
+
.fetch(region, {}).fetch('hostname', endpoint)
|
97
95
|
|
98
96
|
endpoint
|
99
97
|
end
|
100
98
|
|
101
99
|
def default_endpoint(partition, service, region)
|
102
|
-
hostname_template = partition[
|
103
|
-
hostname_template
|
104
|
-
sub('{region}', region)
|
105
|
-
sub('{service}', service)
|
106
|
-
sub('{dnsSuffix}', partition[
|
100
|
+
hostname_template = partition['defaults']['hostname']
|
101
|
+
hostname_template
|
102
|
+
.sub('{region}', region)
|
103
|
+
.sub('{service}', service)
|
104
|
+
.sub('{dnsSuffix}', partition['dnsSuffix'])
|
107
105
|
end
|
108
106
|
|
109
107
|
def get_partition(region)
|
110
108
|
partition_containing_region(region) ||
|
111
|
-
|
112
|
-
|
109
|
+
partition_matching_region(region) ||
|
110
|
+
default_partition
|
113
111
|
end
|
114
112
|
|
115
113
|
def partition_containing_region(region)
|
@@ -120,23 +118,20 @@ module Aws
|
|
120
118
|
|
121
119
|
def partition_matching_region(region)
|
122
120
|
@rules['partitions'].find do |p|
|
123
|
-
region.match(p[
|
124
|
-
|
121
|
+
region.match(p['regionRegex']) ||
|
122
|
+
p['services'].values.find do |svc|
|
123
|
+
svc['endpoints'].key?(region) if svc.key? 'endpoints'
|
124
|
+
end
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
128
|
def default_partition
|
129
|
-
@rules['partitions'].find { |p| p[
|
130
|
-
|
129
|
+
@rules['partitions'].find { |p| p['partition'] == 'aws' } ||
|
130
|
+
@rules['partitions'].first
|
131
131
|
end
|
132
132
|
|
133
133
|
class << self
|
134
|
-
|
135
|
-
def resolve(
|
136
|
-
region,
|
137
|
-
service,
|
138
|
-
sts_regional_endpoints = 'legacy'
|
139
|
-
)
|
134
|
+
def resolve(region, service, sts_regional_endpoints = 'legacy')
|
140
135
|
default_provider.resolve(region, service, sts_regional_endpoints)
|
141
136
|
end
|
142
137
|
|
@@ -153,7 +148,6 @@ module Aws
|
|
153
148
|
def default_provider
|
154
149
|
@default_provider ||= EndpointProvider.new(Partitions.defaults)
|
155
150
|
end
|
156
|
-
|
157
151
|
end
|
158
152
|
end
|
159
153
|
end
|
data/partitions.json
CHANGED
@@ -2651,6 +2651,10 @@
|
|
2651
2651
|
"qldb" : {
|
2652
2652
|
"endpoints" : {
|
2653
2653
|
"ap-northeast-1" : { },
|
2654
|
+
"ap-northeast-2" : { },
|
2655
|
+
"ap-southeast-1" : { },
|
2656
|
+
"ap-southeast-2" : { },
|
2657
|
+
"eu-central-1" : { },
|
2654
2658
|
"eu-west-1" : { },
|
2655
2659
|
"us-east-1" : { },
|
2656
2660
|
"us-east-2" : { },
|
@@ -3326,6 +3330,10 @@
|
|
3326
3330
|
"session.qldb" : {
|
3327
3331
|
"endpoints" : {
|
3328
3332
|
"ap-northeast-1" : { },
|
3333
|
+
"ap-northeast-2" : { },
|
3334
|
+
"ap-southeast-1" : { },
|
3335
|
+
"ap-southeast-2" : { },
|
3336
|
+
"eu-central-1" : { },
|
3329
3337
|
"eu-west-1" : { },
|
3330
3338
|
"us-east-1" : { },
|
3331
3339
|
"us-east-2" : { },
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-partitions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.241.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides interfaces to enumerate AWS partitions, regions, and services.
|
14
14
|
email:
|