awspec 0.82.3 → 0.83.0

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
2
  SHA1:
3
- metadata.gz: 51d07fb005a53885d56ce715120e6dc1bd3dc11a
4
- data.tar.gz: 5055bf986407ca826b518a51cf41ceb12d9f90bb
3
+ metadata.gz: 35e0d4f4b803b52d799f8f40579fa88eda612267
4
+ data.tar.gz: 8329066b3d6b470ce05746c33774900b4c1f196d
5
5
  SHA512:
6
- metadata.gz: e57f7a1c5009f3909034d332f845d46c6039e5dba5b8cc6c9fade7e5c761efa9185ddd3be61cc274692da053841b2aa561e622de935cc743ee5f94b759983c51
7
- data.tar.gz: 8a5ff8aa85678320fffc58facb58ce569c70ce553bb53bf3078ea4eb3741a81f71ad7fc33e3b7fa1c4e193bf8fecad7c4364de7cfc62cde244de3ba307c82270
6
+ metadata.gz: b1b2f9061e86bb879597803daf5e8dd784c3eda525a3eaec6a928392bbeeb1066f27fc5ee6e074057f3030ead4292de5e481719f141e71e396245ae9f272692a
7
+ data.tar.gz: 163f822f89c775a756f12889a30117a1ead75244e2eca930f9a1df4da69c52e8abdb232700f0d5930d074af3c300b49bebd6e89a249c866b3f60d8be9fda2a89
@@ -22,4 +22,10 @@ describe alb('my-alb') do
22
22
  end
23
23
  ```
24
24
 
25
+ ### have_subnet
25
26
 
27
+ ```ruby
28
+ describe alb('my-alb') do
29
+ it { should have_subnet('subnet-1234a567') }
30
+ end
31
+ ```
@@ -0,0 +1,9 @@
1
+ # exist
2
+
3
+ ```ruby
4
+ describe alb_listener('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener/app/my-alb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2') do
5
+ it { should exist }
6
+ its(:port) { should eq 80 }
7
+ its(:protocol) { should eq 'HTTP' }
8
+ end
9
+ ```
@@ -2,6 +2,7 @@
2
2
 
3
3
  [acm](#acm)
4
4
  | [alb](#alb)
5
+ | [alb_listener](#alb_listener)
5
6
  | [ami](#ami)
6
7
  | [autoscaling_group](#autoscaling_group)
7
8
  | [cloudfront_distribution](#cloudfront_distribution)
@@ -100,8 +101,22 @@ end
100
101
  ```
101
102
 
102
103
 
104
+ ### have_subnet
105
+
106
+ ```ruby
107
+ describe alb('my-alb') do
108
+ it { should have_subnet('subnet-1234a567') }
109
+ end
110
+ ```
103
111
 
104
112
  ### its(:load_balancer_arn), its(:dns_name), its(:canonical_hosted_zone_id), its(:created_time), its(:load_balancer_name), its(:scheme), its(:vpc_id), its(:type), its(:security_groups), its(:ip_address_type)
113
+ ## <a name="alb_listener">alb_listener</a>
114
+
115
+ AlbListener resource type.
116
+
117
+ ### exist
118
+
119
+ ### its(:listener_arn), its(:load_balancer_arn), its(:port), its(:protocol), its(:certificates), its(:ssl_policy)
105
120
  ## <a name="ami">ami</a>
106
121
 
107
122
  AMI resource type.
@@ -2402,7 +2417,7 @@ end
2402
2417
  ```
2403
2418
 
2404
2419
 
2405
- ### its(:customer_gateway_configuration), its(:customer_gateway_id), its(:state), its(:type), its(:vpn_connection_id), its(:vpn_gateway_id), its(:options), its(:routes), its(:tags), its(:vgw_telemetry)
2420
+ ### its(:customer_gateway_configuration), its(:customer_gateway_id), its(:state), its(:type), its(:vpn_connection_id), its(:vpn_gateway_id), its(:options), its(:routes), its(:vgw_telemetry)
2406
2421
  ## <a name="vpn_gateway">vpn_gateway</a>
2407
2422
 
2408
2423
  VpnGateway resource type.
@@ -0,0 +1,18 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class AlbListener < Base
5
+ # rubocop:disable Metrics/LineLength
6
+ def initialize
7
+ super
8
+ @type_name = 'AlbListener'
9
+ @type = Awspec::Type::AlbListener.new('arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener/app/my-alb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2')
10
+ @ret = @type.resource_via_client
11
+ @matchers = []
12
+ @ignore_matchers = []
13
+ @describes = []
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -14,6 +14,13 @@ module Awspec::Helper
14
14
  lb.vpc_id == vpc_id
15
15
  end
16
16
  end
17
+
18
+ def find_alb_listener(arn)
19
+ res = elbv2_client.describe_listeners({ listener_arns: [arn] })
20
+ res.listeners.single_resource(arn)
21
+ rescue
22
+ return nil
23
+ end
17
24
  end
18
25
  end
19
26
  end
@@ -15,7 +15,7 @@ module Awspec
15
15
  network_acl network_interface rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
16
16
  route_table s3_bucket security_group ses_identity subnet vpc cloudfront_distribution
17
17
  elastictranscoder_pipeline waf_web_acl customer_gateway vpn_gateway vpn_connection internet_gateway acm
18
- cloudwatch_logs dynamodb_table eip sqs
18
+ cloudwatch_logs dynamodb_table eip sqs alb_listener
19
19
  )
20
20
 
21
21
  ACCOUNT_ATTRIBUTES = %w(
@@ -1,15 +1,16 @@
1
+ # rubocop:disable Metrics/LineLength
1
2
  Aws.config[:elasticloadbalancingv2] = {
2
3
  stub_responses: {
3
4
  describe_load_balancers: {
4
5
  load_balancers: [
5
6
  {
6
7
  load_balancer_arn:
7
- 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:loadbalancer/app/my-elb/1aa1bb1cc1ddee11',
8
+ 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:loadbalancer/app/my-alb/1aa1bb1cc1ddee11',
8
9
  dns_name:
9
10
  'internal-my-elb-1551266724.ap-northeast-1.elb.amazonaws.com',
10
11
  canonical_hosted_zone_id: 'A12BCDEDCBA34BC',
11
12
  created_time: Time.new(2017, 4, 4, 9, 00, 00, '+00:00'),
12
- load_balancer_name: 'my-elb',
13
+ load_balancer_name: 'my-alb',
13
14
  scheme: 'internal',
14
15
  vpc_id: 'vpc-ab123cde',
15
16
  state:
@@ -34,6 +35,22 @@ Aws.config[:elasticloadbalancingv2] = {
34
35
  }
35
36
  ],
36
37
  next_marker: nil
38
+ },
39
+ describe_listeners: {
40
+ listeners: [
41
+ {
42
+ default_actions: [
43
+ {
44
+ target_group_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:targetgroup/my-targets/73e2d6bc24d8a067',
45
+ type: 'forward'
46
+ }
47
+ ],
48
+ listener_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener/app/my-alb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2',
49
+ load_balancer_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:loadbalancer/app/my-alb/1aa1bb1cc1ddee11',
50
+ port: 80,
51
+ protocol: 'HTTP'
52
+ }
53
+ ]
37
54
  }
38
55
  }
39
56
  }
@@ -0,0 +1,222 @@
1
+ # rubocop:disable Metrics/LineLength
2
+ Aws.config[:elasticloadbalancingv2] = {
3
+ stub_responses: {
4
+ describe_load_balancers: {
5
+ load_balancers: [
6
+ {
7
+ load_balancer_arn:
8
+ 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:loadbalancer/app/my-alb/1aa1bb1cc1ddee11',
9
+ dns_name:
10
+ 'internal-my-elb-1551266724.ap-northeast-1.elb.amazonaws.com',
11
+ canonical_hosted_zone_id: 'A12BCDEDCBA34BC',
12
+ created_time: Time.new(2017, 4, 4, 9, 00, 00, '+00:00'),
13
+ load_balancer_name: 'my-alb',
14
+ scheme: 'internal',
15
+ vpc_id: 'vpc-ab123cde',
16
+ state:
17
+ {
18
+ code: 'active',
19
+ reason: nil
20
+ },
21
+ type: 'application',
22
+ availability_zones:
23
+ [
24
+ {
25
+ zone_name: 'ap-northeast-1a',
26
+ subnet_id: 'subnet-1234a567'
27
+ },
28
+ {
29
+ zone_name: 'ap-northeast-1c',
30
+ subnet_id: 'subnet-abcd7890'
31
+ }
32
+ ],
33
+ security_groups: ['sg-1a2b3cd4'],
34
+ ip_address_type: 'ipv4'
35
+ }
36
+ ],
37
+ next_marker: nil
38
+ },
39
+ describe_listeners: {
40
+ listeners: [
41
+ {
42
+ default_actions: [
43
+ {
44
+ target_group_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:targetgroup/my-targets/73e2d6bc24d8a067',
45
+ type: 'forward'
46
+ }
47
+ ],
48
+ listener_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:listener/app/my-alb/1aa1bb1cc1ddee11/f2f7dc8efc522ab2',
49
+ load_balancer_arn: 'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:loadbalancer/app/my-alb/1aa1bb1cc1ddee11',
50
+ port: 80,
51
+ protocol: 'HTTP'
52
+ }
53
+ ]
54
+ }
55
+ }
56
+ }
57
+
58
+ Aws.config[:ec2] = {
59
+ stub_responses: {
60
+ describe_security_groups: {
61
+ security_groups: [
62
+ {
63
+ vpc_id: 'vpc-ab123cde',
64
+ owner_id: '112233445566',
65
+ group_id: 'sg-1a2b3cd4',
66
+ group_name: 'my-security-group-name',
67
+ tags: [
68
+ {
69
+ key: 'env',
70
+ value: 'dev'
71
+ }
72
+ ],
73
+ ip_permissions: [
74
+ {
75
+ from_port: 80,
76
+ to_port: 80,
77
+ ip_protocol: 'tcp',
78
+ ip_ranges: [
79
+ {
80
+ cidr_ip: '123.456.789.012/32'
81
+ },
82
+ {
83
+ cidr_ip: '456.789.123.456/32'
84
+ }
85
+ ],
86
+ user_id_group_pairs: []
87
+ },
88
+ {
89
+ from_port: 22,
90
+ to_port: 22,
91
+ ip_protocol: 'tcp',
92
+ ip_ranges: [],
93
+ user_id_group_pairs: [
94
+ {
95
+ group_id: 'sg-5a6b7cd8',
96
+ group_name: 'group-name-sg'
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ from_port: 60_000,
102
+ to_port: 60_000,
103
+ ip_protocol: 'tcp',
104
+ ip_ranges: [
105
+ {
106
+ cidr_ip: '100.456.789.012/32'
107
+ }
108
+ ],
109
+ user_id_group_pairs: []
110
+ },
111
+ {
112
+ from_port: 70_000,
113
+ to_port: 70_000,
114
+ ip_protocol: 'tcp',
115
+ ip_ranges: [
116
+ {
117
+ cidr_ip: '100.456.789.012/32'
118
+ }
119
+ ],
120
+ user_id_group_pairs: []
121
+ },
122
+ {
123
+ from_port: 70_000,
124
+ to_port: 70_000,
125
+ ip_protocol: 'tcp',
126
+ ip_ranges: [
127
+ {
128
+ cidr_ip: '101.456.789.012/32'
129
+ }
130
+ ],
131
+ user_id_group_pairs: []
132
+ },
133
+ {
134
+ from_port: 50_000,
135
+ to_port: 50_009,
136
+ ip_protocol: 'tcp',
137
+ ip_ranges: [
138
+ {
139
+ cidr_ip: '123.456.789.012/32'
140
+ }
141
+ ],
142
+ user_id_group_pairs: []
143
+ },
144
+ {
145
+ from_port: nil,
146
+ to_port: nil,
147
+ ip_protocol: '-1',
148
+ ip_ranges: [],
149
+ user_id_group_pairs: [
150
+ {
151
+ user_id: '1234567890',
152
+ group_name: nil,
153
+ group_id: 'sg-3a4b5cd6',
154
+ vpc_id: nil,
155
+ vpc_peering_connection_id: nil,
156
+ peering_status: nil
157
+ }
158
+ ]
159
+ }
160
+ ],
161
+ ip_permissions_egress: [
162
+ {
163
+ from_port: 50_000,
164
+ to_port: 50_000,
165
+ ip_protocol: 'tcp',
166
+ ip_ranges: [
167
+ {
168
+ cidr_ip: '100.456.789.012/32'
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ from_port: 8080,
174
+ to_port: 8080,
175
+ ip_protocol: 'tcp',
176
+ ip_ranges: [],
177
+ user_id_group_pairs: [
178
+ {
179
+ user_id: '5678901234',
180
+ group_name: 'group-in-other-aws-account-with-vpc-peering',
181
+ group_id: 'sg-9a8b7c6d',
182
+ vpc_id: 'vpc-5b6a7c8f',
183
+ vpc_peering_connection_id: 'pcx-f9e8d7c6',
184
+ peering_status: 'active'
185
+ }
186
+ ]
187
+ }
188
+ ]
189
+ }
190
+ ]
191
+ },
192
+ describe_subnets: {
193
+ subnets: [
194
+ {
195
+ state: 'available',
196
+ vpc_id: 'vpc-ab123cde',
197
+ subnet_id: 'subnet-1234a567',
198
+ cidr_block: '10.0.1.0/24',
199
+ tags: [
200
+ {
201
+ key: 'Name',
202
+ value: 'my-subnet'
203
+ }
204
+ ]
205
+ }
206
+ ]
207
+ },
208
+ describe_vpcs: {
209
+ vpcs: [
210
+ {
211
+ vpc_id: 'vpc-ab123cde',
212
+ tags: [
213
+ {
214
+ key: 'Name',
215
+ value: 'my-vpc'
216
+ }
217
+ ]
218
+ }
219
+ ]
220
+ }
221
+ }
222
+ }
@@ -5,7 +5,7 @@ module Awspec::Type
5
5
  end
6
6
 
7
7
  def id
8
- @id = resource_via_client.certificate_arn if resource_via_client
8
+ @id ||= resource_via_client.certificate_arn if resource_via_client
9
9
  end
10
10
 
11
11
  STATUSES = %w(
@@ -5,7 +5,7 @@ module Awspec::Type
5
5
  end
6
6
 
7
7
  def id
8
- @id = resource_via_client.load_balancer_name if resource_via_client
8
+ @id ||= resource_via_client.load_balancer_name if resource_via_client
9
9
  end
10
10
 
11
11
  STATES = %w(
@@ -28,5 +28,15 @@ module Awspec::Type
28
28
  return true if sgs.include? sg2.group_id
29
29
  false
30
30
  end
31
+
32
+ def has_subnet?(subnet_id)
33
+ azs = resource_via_client.availability_zones
34
+ ret = azs.find do |az|
35
+ az.subnet_id == subnet_id
36
+ end
37
+ return true if ret
38
+ subnet2 = find_subnet(subnet_id)
39
+ subnet2.subnet_id = subnet_id
40
+ end
31
41
  end
32
42
  end
@@ -0,0 +1,11 @@
1
+ module Awspec::Type
2
+ class AlbListener < ResourceBase
3
+ def resource_via_client
4
+ @resource_via_client ||= find_alb_listener(@display_name)
5
+ end
6
+
7
+ def id
8
+ @id ||= resource_via_client.listener_arn if resource_via_client
9
+ end
10
+ end
11
+ end
@@ -5,7 +5,7 @@ module Awspec::Type
5
5
  end
6
6
 
7
7
  def id
8
- @id = resource_via_client.load_balancer_name if resource_via_client
8
+ @id ||= resource_via_client.load_balancer_name if resource_via_client
9
9
  end
10
10
 
11
11
  health_check_options = %w(
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.82.3'
2
+ VERSION = '0.83.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.82.3
4
+ version: 0.83.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-27 00:00:00.000000000 Z
11
+ date: 2017-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -208,6 +208,7 @@ files:
208
208
  - bin/toolbox
209
209
  - doc/_resource_types/acm.md
210
210
  - doc/_resource_types/alb.md
211
+ - doc/_resource_types/alb_listener.md
211
212
  - doc/_resource_types/ami.md
212
213
  - doc/_resource_types/autoscaling_group.md
213
214
  - doc/_resource_types/cloudfront_distribution.md
@@ -277,6 +278,7 @@ files:
277
278
  - lib/awspec/generator/doc/type/account_attribute_base.rb
278
279
  - lib/awspec/generator/doc/type/acm.rb
279
280
  - lib/awspec/generator/doc/type/alb.rb
281
+ - lib/awspec/generator/doc/type/alb_listener.rb
280
282
  - lib/awspec/generator/doc/type/ami.rb
281
283
  - lib/awspec/generator/doc/type/autoscaling_group.rb
282
284
  - lib/awspec/generator/doc/type/base.rb
@@ -432,6 +434,7 @@ files:
432
434
  - lib/awspec/stub/account.rb
433
435
  - lib/awspec/stub/acm.rb
434
436
  - lib/awspec/stub/alb.rb
437
+ - lib/awspec/stub/alb_listener.rb
435
438
  - lib/awspec/stub/ami.rb
436
439
  - lib/awspec/stub/autoscaling_group.rb
437
440
  - lib/awspec/stub/cloudfront_distribution.rb
@@ -490,6 +493,7 @@ files:
490
493
  - lib/awspec/type/account_attribute_base.rb
491
494
  - lib/awspec/type/acm.rb
492
495
  - lib/awspec/type/alb.rb
496
+ - lib/awspec/type/alb_listener.rb
493
497
  - lib/awspec/type/ami.rb
494
498
  - lib/awspec/type/autoscaling_group.rb
495
499
  - lib/awspec/type/base.rb