aws_public_ips 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2130ff4b9f59ac6e30c1217be05ae4f3c4f73d17
4
- data.tar.gz: 24669a0a29799a74acb37e501c467a59865081a3
2
+ SHA256:
3
+ metadata.gz: 23f1e5c0c295c8b310348a3de7dc27030b7bcb8a0fa56e3c4d9f561c9f1e075c
4
+ data.tar.gz: 691834d4e4118eb747808edeee5c5cfa2570fb51db09f5c8386552c3a14629bd
5
5
  SHA512:
6
- metadata.gz: e4656877db332ff9b05c6b2eda71cb3266280c063dd64528e1da74d4cc18e3618a57feb057b64da9f5cf60dd6deba4edce78db0d3894e215b6ee0f34e8fe322a
7
- data.tar.gz: 4505daa9cd54e8ca666b9725e25cdd70954155b381de47a4f9cab35393156fc34971371d0430ed6ed5d9b61c6352b54294f957067dbbc5a268841197b433d131
6
+ metadata.gz: ba824f19d840d704f1f4d9722cbe7ec18ad05dd35f6b369fd442e3a6f8697f8ebb123262a8d832d598f14015c7531c1ab7ab0c0f7b0ec426e79423f30d71e929
7
+ data.tar.gz: b9f5e41bf14cc2a254f26237fbd670f87a662e823406dddb564b11cd102d8877753eaa830a3e8b75aab84b156888e2c7a0de2add3f24ca06c5297bd3dc8b6090
@@ -8,6 +8,7 @@ module AwsPublicIps
8
8
  module Apigateway
9
9
  def self.run
10
10
  client = ::Aws::APIGateway::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
11
12
 
12
13
  # TODO(arkadiy) https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-private-integration.html
13
14
 
@@ -8,6 +8,7 @@ module AwsPublicIps
8
8
  module Cloudfront
9
9
  def self.run
10
10
  client = ::Aws::CloudFront::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
11
12
 
12
13
  # Cloudfront distrubtions are always public, they don't have a concept of VPC
13
14
  # No "coming up" problem here like with RDS/Redshift
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'aws-sdk-ec2'
4
+ require 'aws_public_ips/utils'
4
5
 
5
6
  module AwsPublicIps
6
7
  module Checks
7
8
  module Ec2
8
9
  def self.run
9
10
  client = ::Aws::EC2::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
10
12
 
11
13
  # Iterate over all EC2 instances. This will include those from EC2, ECS, EKS, Fargate, Batch,
12
14
  # Beanstalk, and NAT Instances
@@ -8,6 +8,7 @@ module AwsPublicIps
8
8
  module Elasticsearch
9
9
  def self.run
10
10
  client = ::Aws::ElasticsearchService::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
11
12
 
12
13
  # ElasticSearch instances can be launched into classic into VPCs. Classic instances are public and have a
13
14
  # `domain_status.endpoint` hostname, and VPC instances have a `domain_status.endpoints['vpc']` hostname.
@@ -20,6 +21,7 @@ module AwsPublicIps
20
21
  client.describe_elasticsearch_domain(domain_name: domain_name.domain_name).map do |domain|
21
22
  hostname = domain.domain_status.endpoint
22
23
  next unless hostname
24
+
23
25
  {
24
26
  id: domain.domain_status.domain_id,
25
27
  hostname: hostname,
@@ -8,12 +8,14 @@ module AwsPublicIps
8
8
  module Elb
9
9
  def self.run
10
10
  client = ::Aws::ElasticLoadBalancing::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
11
12
 
12
13
  # EC2-Classic load balancers are only returned by the 'elasticloadbalancing' API, and
13
14
  # EC2-VPC ALBs/NLBs are only returned by the 'elasticloadbalancingv2' API
14
15
  client.describe_load_balancers.flat_map do |response|
15
16
  response.load_balancer_descriptions.flat_map do |load_balancer|
16
17
  next [] unless load_balancer.scheme == 'internet-facing'
18
+
17
19
  # EC2-Classic load balancers get IPv6 DNS records created but they are not returned by the API
18
20
  hostnames = [load_balancer.dns_name, "ipv6.#{load_balancer.dns_name}"]
19
21
  {
@@ -8,6 +8,7 @@ module AwsPublicIps
8
8
  module Elbv2
9
9
  def self.run
10
10
  client = ::Aws::ElasticLoadBalancingV2::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
11
12
 
12
13
  # EC2-Classic load balancers are only returned by the 'elasticloadbalancing' API, and
13
14
  # EC2-VPC ALBs/NLBs are only returned by the 'elasticloadbalancingv2' API
@@ -18,6 +19,7 @@ module AwsPublicIps
18
19
  client.describe_load_balancers.flat_map do |response|
19
20
  response.load_balancers.flat_map do |load_balancer|
20
21
  next [] unless load_balancer.scheme == 'internet-facing'
22
+
21
23
  {
22
24
  id: load_balancer.canonical_hosted_zone_id,
23
25
  hostname: load_balancer.dns_name,
@@ -8,6 +8,7 @@ module AwsPublicIps
8
8
  module Lightsail
9
9
  def self.run
10
10
  client = ::Aws::Lightsail::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
11
12
 
12
13
  # Lightsail instances are always exposed directly, and can also be put behind a load balancer
13
14
 
@@ -8,6 +8,7 @@ module AwsPublicIps
8
8
  module Rds
9
9
  def self.run
10
10
  client = ::Aws::RDS::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
11
12
 
12
13
  # RDS instances can be launched into VPCs or into Classic mode.
13
14
  # In classic mode they are always public.
@@ -8,6 +8,7 @@ module AwsPublicIps
8
8
  module Redshift
9
9
  def self.run
10
10
  client = ::Aws::Redshift::Client.new
11
+ return [] unless ::AwsPublicIps::Utils.has_service?(client)
11
12
 
12
13
  # Redshift clusters can be launched into VPCs or into Classic mode.
13
14
  # In classic mode they are always public.
@@ -61,6 +61,7 @@ module AwsPublicIps
61
61
  services.map(&:downcase!).uniq!
62
62
  invalid_services = services - all_services
63
63
  raise ::ArgumentError, "Invalid service(s): #{invalid_services.join(',')}" unless invalid_services.empty?
64
+
64
65
  options[:services] = services
65
66
  end
66
67
 
@@ -69,6 +70,7 @@ module AwsPublicIps
69
70
  unless all_formats.include?(fmt)
70
71
  raise ::ArgumentError, "Invalid format '#{fmt}'. Valid formats are: #{all_formats.join(',')}"
71
72
  end
73
+
72
74
  options[:format] = fmt
73
75
  end
74
76
 
@@ -22,6 +22,7 @@ module AwsPublicIps
22
22
  def format_verbose
23
23
  @results.flat_map do |service, hashes|
24
24
  next [] if hashes.empty?
25
+
25
26
  ["## #{service}"] + hashes.flat_map do |hash|
26
27
  [hash[:id], hash[:hostname]].compact.map do |line|
27
28
  "# #{line}"
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'resolv'
4
+ require 'aws-partitions'
4
5
 
5
6
  module AwsPublicIps
6
7
  module Utils
@@ -19,5 +20,15 @@ module AwsPublicIps
19
20
  resource.address.to_s.downcase
20
21
  end
21
22
  end
23
+
24
+ def self.has_service?(client)
25
+ region_partition = ::Aws::Partitions.partitions.find do |partition|
26
+ partition.regions.map(&:name).include?(client.config.region)
27
+ end
28
+ service_name = client.class.to_s.split('::')[-2]
29
+
30
+ aws_service = region_partition.services.find { |service| service.name == service_name }
31
+ !aws_service.regionalized? || aws_service.regions.include?(client.config.region)
32
+ end
22
33
  end
23
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AwsPublicIps
4
- VERSION = '1.0.5'.freeze
4
+ VERSION = '1.0.6'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_public_ips
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkadiy Tetelman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-26 00:00:00.000000000 Z
11
+ date: 2018-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-apigateway
@@ -16,126 +16,126 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.10.0
19
+ version: 1.21.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.10.0
26
+ version: 1.21.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aws-sdk-cloudfront
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.0
33
+ version: 1.10.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.0
40
+ version: 1.10.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: aws-sdk-ec2
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.33.0
47
+ version: 1.54.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.33.0
54
+ version: 1.54.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: aws-sdk-elasticloadbalancing
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2.0
61
+ version: 1.7.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.2.0
68
+ version: 1.7.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aws-sdk-elasticloadbalancingv2
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.8.0
75
+ version: 1.16.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.8.0
82
+ version: 1.16.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: aws-sdk-elasticsearchservice
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.5.0
89
+ version: 1.14.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.5.0
96
+ version: 1.14.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: aws-sdk-lightsail
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.4.0
103
+ version: 1.10.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.4.0
110
+ version: 1.10.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: aws-sdk-rds
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.18.0
117
+ version: 1.35.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.18.0
124
+ version: 1.35.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: aws-sdk-redshift
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.2.0
131
+ version: 1.13.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.2.0
138
+ version: 1.13.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: bundler-audit
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -156,56 +156,56 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.8.12
159
+ version: 0.8.22
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.8.12
166
+ version: 0.8.22
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 3.7.0
173
+ version: 3.8.0
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 3.7.0
180
+ version: 3.8.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rubocop
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 0.56.0
187
+ version: 0.60.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 0.56.0
194
+ version: 0.60.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: webmock
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 3.4.1
201
+ version: 3.4.2
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 3.4.1
208
+ version: 3.4.2
209
209
  description: A library/cli to fetch all public IP addresses associated with an AWS
210
210
  account
211
211
  email:
@@ -245,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
245
245
  requirements:
246
246
  - - ">="
247
247
  - !ruby/object:Gem::Version
248
- version: 2.1.0
248
+ version: 2.2.0
249
249
  required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  requirements:
251
251
  - - ">="
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  version: '0'
254
254
  requirements: []
255
255
  rubyforge_project:
256
- rubygems_version: 2.6.14
256
+ rubygems_version: 2.7.7
257
257
  signing_key:
258
258
  specification_version: 4
259
259
  summary: A library/cli to fetch all public IP addresses associated with an AWS account