aws-partitions 1.243.0 → 1.244.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78c64e4a8361153d70aba7c807306ca5a8adfbeb
4
- data.tar.gz: d914b52e5144bb15f073a33f72de3bf5af326a3b
3
+ metadata.gz: 3329cfe888500abccafcedd66eb6a19d8be6502c
4
+ data.tar.gz: a3b11b595ea771afc86cd7b8b185afbe85820ea4
5
5
  SHA512:
6
- metadata.gz: a5704f45440c9ceba1c1947f766195bd940f7d2f766bc52e4582c19b5181adb5225e09afdb7cfa4cca5d2eb55595883717b14d5972fc7a12e8378791e992703b
7
- data.tar.gz: 19ec34d4aeba0f04f7ccaec63f3ffcd60242de03f4cebcb7f955198ec4cceb333fbb706cbd321a31a344e7fcb3858aa2c496e0339d6f500e103b49494978b895
6
+ metadata.gz: 75baf0133da15731b9a359fab6b1714ca0a07280e05a8d00240fab868fedbd3ef83f4a00813e26155be53df078ee34e58825e72b53ea894d9ed55be71a0f615a
7
+ data.tar.gz: a2a8cbfae88ceb39f345394c80cef432fe85adda98c6ac751aa053b3e55df89e316a751534c96ebf36c69a74c84e0acaa628d932355a9303d1b1a51ffea6bb19
@@ -236,7 +236,7 @@ module Aws
236
236
  'ApplicationInsights' => 'applicationinsights',
237
237
  'Athena' => 'athena',
238
238
  'AutoScaling' => 'autoscaling',
239
- 'AutoScalingPlans' => 'autoscaling',
239
+ 'AutoScalingPlans' => 'autoscaling-plans',
240
240
  'Backup' => 'backup',
241
241
  'Batch' => 'batch',
242
242
  'Budgets' => 'budgets',
@@ -60,19 +60,19 @@ module Aws
60
60
 
61
61
  # @api private Use the static class methods instead.
62
62
  def dns_suffix_for(region)
63
- partition = get_partition(region)
64
- partition['dnsSuffix']
63
+ get_partition(region)['dnsSuffix']
65
64
  end
66
65
 
67
66
  private
68
67
 
69
68
  def endpoint_for(region, service, sts_regional_endpoints)
70
69
  partition = get_partition(region)
71
- endpoint = default_endpoint(partition, service, region)
72
70
  service_cfg = partition.fetch('services', {}).fetch(service, {})
73
71
 
74
- # Check for service-level default endpoint.
75
- endpoint = service_cfg.fetch('defaults', {}).fetch('hostname', endpoint)
72
+ # Find the default endpoint
73
+ endpoint = service_cfg
74
+ .fetch('defaults', {})
75
+ .fetch('hostname', partition['defaults']['hostname'])
76
76
 
77
77
  # Check for sts legacy behavior
78
78
  sts_legacy = service == 'sts' &&
@@ -90,18 +90,14 @@ module Aws
90
90
  end
91
91
 
92
92
  # Check for service/region level endpoint.
93
- endpoint = service_cfg.fetch('endpoints', {})
94
- .fetch(region, {}).fetch('hostname', endpoint)
95
-
96
- endpoint
97
- end
98
-
99
- def default_endpoint(partition, service, region)
100
- hostname_template = partition['defaults']['hostname']
101
- hostname_template
102
- .sub('{region}', region)
103
- .sub('{service}', service)
104
- .sub('{dnsSuffix}', partition['dnsSuffix'])
93
+ endpoint = service_cfg
94
+ .fetch('endpoints', {})
95
+ .fetch(region, {}).fetch('hostname', endpoint)
96
+
97
+ # Replace placeholders from the endpoints
98
+ endpoint.sub('{region}', region)
99
+ .sub('{service}', service)
100
+ .sub('{dnsSuffix}', partition['dnsSuffix'])
105
101
  end
106
102
 
107
103
  def get_partition(region)
@@ -120,7 +116,7 @@ module Aws
120
116
  @rules['partitions'].find do |p|
121
117
  region.match(p['regionRegex']) ||
122
118
  p['services'].values.find do |svc|
123
- svc['endpoints'].key?(region) if svc.key? 'endpoints'
119
+ svc['endpoints'].key?(region) if svc.key?('endpoints')
124
120
  end
125
121
  end
126
122
  end
@@ -1,7 +1,6 @@
1
1
  module Aws
2
2
  module Partitions
3
3
  class Partition
4
-
5
4
  # @option options [required, String] :name
6
5
  # @option options [required, Hash<String,Region>] :regions
7
6
  # @option options [required, Hash<String,Service>] :services
@@ -23,7 +22,7 @@ module Aws
23
22
  @regions[region_name]
24
23
  else
25
24
  msg = "invalid region name #{region_name.inspect}; valid region "
26
- msg << "names include %s" % [@regions.keys.join(', ')]
25
+ msg << "names include #{@regions.keys.join(', ')}"
27
26
  raise ArgumentError, msg
28
27
  end
29
28
  end
@@ -33,6 +32,12 @@ module Aws
33
32
  @regions.values
34
33
  end
35
34
 
35
+ # @param [String] region_name The name of the region, e.g. "us-east-1".
36
+ # @return [Boolean] true if the region is in the partition.
37
+ def region?(region_name)
38
+ @regions.key?(region_name)
39
+ end
40
+
36
41
  # @param [String] service_name The service module name.
37
42
  # @return [Service]
38
43
  # @raise [ArgumentError] Raises `ArgumentError` for unknown service name.
@@ -41,7 +46,7 @@ module Aws
41
46
  @services[service_name]
42
47
  else
43
48
  msg = "invalid service name #{service_name.inspect}; valid service "
44
- msg << "names include %s" % [@services.keys.join(', ')]
49
+ msg << "names include #{@services.keys.join(', ')}"
45
50
  raise ArgumentError, msg
46
51
  end
47
52
  end
@@ -51,14 +56,19 @@ module Aws
51
56
  @services.values
52
57
  end
53
58
 
54
- class << self
59
+ # @param [String] service_name The service module name.
60
+ # @return [Boolean] true if the service is in the partition.
61
+ def service?(service_name)
62
+ @services.key?(service_name)
63
+ end
55
64
 
65
+ class << self
56
66
  # @api private
57
67
  def build(partition)
58
68
  Partition.new(
59
69
  name: partition['partition'],
60
70
  regions: build_regions(partition),
61
- services: build_services(partition),
71
+ services: build_services(partition)
62
72
  )
63
73
  end
64
74
 
@@ -67,28 +77,29 @@ module Aws
67
77
  # @param [Hash] partition
68
78
  # @return [Hash<String,Region>]
69
79
  def build_regions(partition)
70
- partition['regions'].inject({}) do |regions, (region_name, region)|
71
- unless region_name == "#{partition['partition']}-global"
72
- regions[region_name] = Region.build(region_name, region, partition)
73
- end
74
- regions
80
+ partition['regions'].each_with_object({}) do
81
+ |(region_name, region), regions|
82
+ next if region_name == "#{partition['partition']}-global"
83
+
84
+ regions[region_name] = Region.build(
85
+ region_name, region, partition
86
+ )
75
87
  end
76
88
  end
77
89
 
78
90
  # @param [Hash] partition
79
91
  # @return [Hash<String,Service>]
80
92
  def build_services(partition)
81
- Partitions.service_ids.inject({}) do |services, (svc_name, svc_id)|
82
- if partition['services'].key?(svc_id)
83
- svc_data = partition['services'][svc_id]
84
- services[svc_name] = Service.build(svc_name, svc_data, partition)
85
- else
86
- services[svc_name] = Service.build(svc_name, {'endpoints' => {}}, partition)
87
- end
88
- services
93
+ Partitions.service_ids.each_with_object({}) do
94
+ |(service_name, service), services|
95
+ service_data = partition['services'].fetch(
96
+ service, 'endpoints' => {}
97
+ )
98
+ services[service_name] = Service.build(
99
+ service_name, service_data, partition
100
+ )
89
101
  end
90
102
  end
91
-
92
103
  end
93
104
  end
94
105
  end
@@ -322,10 +322,6 @@
322
322
  },
323
323
  "application-autoscaling" : {
324
324
  "defaults" : {
325
- "credentialScope" : {
326
- "service" : "application-autoscaling"
327
- },
328
- "hostname" : "autoscaling.{region}.amazonaws.com",
329
325
  "protocols" : [ "http", "https" ]
330
326
  },
331
327
  "endpoints" : {
@@ -454,10 +450,6 @@
454
450
  },
455
451
  "autoscaling-plans" : {
456
452
  "defaults" : {
457
- "credentialScope" : {
458
- "service" : "autoscaling-plans"
459
- },
460
- "hostname" : "autoscaling.{region}.amazonaws.com",
461
453
  "protocols" : [ "http", "https" ]
462
454
  },
463
455
  "endpoints" : {
@@ -3942,10 +3934,6 @@
3942
3934
  },
3943
3935
  "application-autoscaling" : {
3944
3936
  "defaults" : {
3945
- "credentialScope" : {
3946
- "service" : "application-autoscaling"
3947
- },
3948
- "hostname" : "autoscaling.{region}.amazonaws.com",
3949
3937
  "protocols" : [ "http", "https" ]
3950
3938
  },
3951
3939
  "endpoints" : {
@@ -4447,6 +4435,9 @@
4447
4435
  }
4448
4436
  },
4449
4437
  "application-autoscaling" : {
4438
+ "defaults" : {
4439
+ "protocols" : [ "http", "https" ]
4440
+ },
4450
4441
  "endpoints" : {
4451
4442
  "us-gov-east-1" : { },
4452
4443
  "us-gov-west-1" : { }
@@ -5171,10 +5162,7 @@
5171
5162
  },
5172
5163
  "application-autoscaling" : {
5173
5164
  "defaults" : {
5174
- "credentialScope" : {
5175
- "service" : "application-autoscaling"
5176
- },
5177
- "hostname" : "autoscaling.{region}.amazonaws.com",
5165
+ "hostname" : "autoscaling.us-iso-east-1.c2s.ic.gov",
5178
5166
  "protocols" : [ "http", "https" ]
5179
5167
  },
5180
5168
  "endpoints" : {
@@ -5444,10 +5432,7 @@
5444
5432
  "services" : {
5445
5433
  "application-autoscaling" : {
5446
5434
  "defaults" : {
5447
- "credentialScope" : {
5448
- "service" : "application-autoscaling"
5449
- },
5450
- "hostname" : "autoscaling.{region}.amazonaws.com",
5435
+ "hostname" : "autoscaling.us-isob-east-1.sc2s.sgov.gov",
5451
5436
  "protocols" : [ "http", "https" ]
5452
5437
  },
5453
5438
  "endpoints" : {
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.243.0
4
+ version: 1.244.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-21 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides interfaces to enumerate AWS partitions, regions, and services.
14
14
  email: