awspec 0.74.0 → 0.74.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/_resource_types/alb.md +25 -1
- data/doc/resource_types.md +27 -1
- data/lib/awspec/generator/doc/type/alb.rb +4 -2
- data/lib/awspec/stub/alb.rb +195 -2
- data/lib/awspec/type/alb.rb +21 -0
- data/lib/awspec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8dddd6e0884770202e7a0a0246768cd7140d6d2
|
4
|
+
data.tar.gz: 42085569cade00490a865f4108acc8d2aeb9eab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c49a4bbf98b442f6e3678a4d3710edd211bddc61ae8679a4a0046fa45cf2bad94f49c7d3320e5770ad6f358958cd01f3b35f97e32cd77b20f2cfcf29ce31889
|
7
|
+
data.tar.gz: 1258f1a69f8d7f5d8a75e4226f35e1301d0d3871a7cf6ef5f8821062affb5ec28b7d28e13eb7889652f777d9224d65604a04fd87bce84d1e64a540b9e65f39dc
|
data/doc/_resource_types/alb.md
CHANGED
@@ -1 +1,25 @@
|
|
1
|
-
|
1
|
+
### exist
|
2
|
+
|
3
|
+
```ruby
|
4
|
+
describe alb('my-alb') do
|
5
|
+
it { should exist }
|
6
|
+
end
|
7
|
+
```
|
8
|
+
|
9
|
+
### be_active, be_provisioning, be_failed
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
describe alb('my-alb') do
|
13
|
+
it { should be_active }
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
### have_security_group
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
describe alb('my-alb') do
|
21
|
+
it { should have_security_group('sg-1a2b3cd4') }
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
|
data/doc/resource_types.md
CHANGED
@@ -73,7 +73,33 @@ ALB resource type.
|
|
73
73
|
|
74
74
|
### exist
|
75
75
|
|
76
|
-
|
76
|
+
```ruby
|
77
|
+
describe alb('my-alb') do
|
78
|
+
it { should exist }
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
|
83
|
+
### be_active, be_provisioning, be_failed
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
describe alb('my-alb') do
|
87
|
+
it { should be_active }
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
91
|
+
|
92
|
+
### have_security_group
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
describe alb('my-alb') do
|
96
|
+
it { should have_security_group('sg-1a2b3cd4') }
|
97
|
+
end
|
98
|
+
```
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
### 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)
|
77
103
|
## <a name="ami">ami</a>
|
78
104
|
|
79
105
|
AMI resource type.
|
@@ -7,8 +7,10 @@ module Awspec::Generator
|
|
7
7
|
@type_name = 'ALB'
|
8
8
|
@type = Awspec::Type::Alb.new('my-alb')
|
9
9
|
@ret = @type.resource_via_client
|
10
|
-
@matchers = [
|
11
|
-
|
10
|
+
@matchers = [
|
11
|
+
Awspec::Type::Alb::STATES.map { |state| 'be_' + state }.join(', ')
|
12
|
+
]
|
13
|
+
@ignore_matchers = Awspec::Type::Alb::STATES.map { |state| 'be_' + state }
|
12
14
|
@describes = []
|
13
15
|
end
|
14
16
|
end
|
data/lib/awspec/stub/alb.rb
CHANGED
@@ -3,8 +3,201 @@ Aws.config[:elasticloadbalancingv2] = {
|
|
3
3
|
describe_load_balancers: {
|
4
4
|
load_balancers: [
|
5
5
|
{
|
6
|
-
|
7
|
-
|
6
|
+
load_balancer_arn:
|
7
|
+
'arn:aws:elasticloadbalancing:ap-northeast-1:1234567890:loadbalancer/app/my-elb/1aa1bb1cc1ddee11',
|
8
|
+
dns_name:
|
9
|
+
'internal-my-elb-1551266724.ap-northeast-1.elb.amazonaws.com',
|
10
|
+
canonical_hosted_zone_id: 'A12BCDEDCBA34BC',
|
11
|
+
created_time: Time.new(2017, 4, 4, 9, 00, 00, '+00:00'),
|
12
|
+
load_balancer_name: 'my-elb',
|
13
|
+
scheme: 'internal',
|
14
|
+
vpc_id: 'vpc-ab123cde',
|
15
|
+
state:
|
16
|
+
{
|
17
|
+
code: 'active',
|
18
|
+
reason: nil
|
19
|
+
},
|
20
|
+
type: 'application',
|
21
|
+
availability_zones:
|
22
|
+
[
|
23
|
+
{
|
24
|
+
zone_name: 'ap-northeast-1a',
|
25
|
+
subnet_id: 'subnet-1234a567'
|
26
|
+
},
|
27
|
+
{
|
28
|
+
zone_name: 'ap-northeast-1c',
|
29
|
+
subnet_id: 'subnet-abcd7890'
|
30
|
+
}
|
31
|
+
],
|
32
|
+
security_groups: ['sg-1a2b3cd4'],
|
33
|
+
ip_address_type: 'ipv4'
|
34
|
+
}
|
35
|
+
],
|
36
|
+
next_marker: nil
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
Aws.config[:ec2] = {
|
42
|
+
stub_responses: {
|
43
|
+
describe_security_groups: {
|
44
|
+
security_groups: [
|
45
|
+
{
|
46
|
+
vpc_id: 'vpc-ab123cde',
|
47
|
+
owner_id: '112233445566',
|
48
|
+
group_id: 'sg-1a2b3cd4',
|
49
|
+
group_name: 'my-security-group-name',
|
50
|
+
tags: [
|
51
|
+
{
|
52
|
+
key: 'env',
|
53
|
+
value: 'dev'
|
54
|
+
}
|
55
|
+
],
|
56
|
+
ip_permissions: [
|
57
|
+
{
|
58
|
+
from_port: 80,
|
59
|
+
to_port: 80,
|
60
|
+
ip_protocol: 'tcp',
|
61
|
+
ip_ranges: [
|
62
|
+
{
|
63
|
+
cidr_ip: '123.456.789.012/32'
|
64
|
+
},
|
65
|
+
{
|
66
|
+
cidr_ip: '456.789.123.456/32'
|
67
|
+
}
|
68
|
+
],
|
69
|
+
user_id_group_pairs: []
|
70
|
+
},
|
71
|
+
{
|
72
|
+
from_port: 22,
|
73
|
+
to_port: 22,
|
74
|
+
ip_protocol: 'tcp',
|
75
|
+
ip_ranges: [],
|
76
|
+
user_id_group_pairs: [
|
77
|
+
{
|
78
|
+
group_id: 'sg-5a6b7cd8',
|
79
|
+
group_name: 'group-name-sg'
|
80
|
+
}
|
81
|
+
]
|
82
|
+
},
|
83
|
+
{
|
84
|
+
from_port: 60_000,
|
85
|
+
to_port: 60_000,
|
86
|
+
ip_protocol: 'tcp',
|
87
|
+
ip_ranges: [
|
88
|
+
{
|
89
|
+
cidr_ip: '100.456.789.012/32'
|
90
|
+
}
|
91
|
+
],
|
92
|
+
user_id_group_pairs: []
|
93
|
+
},
|
94
|
+
{
|
95
|
+
from_port: 70_000,
|
96
|
+
to_port: 70_000,
|
97
|
+
ip_protocol: 'tcp',
|
98
|
+
ip_ranges: [
|
99
|
+
{
|
100
|
+
cidr_ip: '100.456.789.012/32'
|
101
|
+
}
|
102
|
+
],
|
103
|
+
user_id_group_pairs: []
|
104
|
+
},
|
105
|
+
{
|
106
|
+
from_port: 70_000,
|
107
|
+
to_port: 70_000,
|
108
|
+
ip_protocol: 'tcp',
|
109
|
+
ip_ranges: [
|
110
|
+
{
|
111
|
+
cidr_ip: '101.456.789.012/32'
|
112
|
+
}
|
113
|
+
],
|
114
|
+
user_id_group_pairs: []
|
115
|
+
},
|
116
|
+
{
|
117
|
+
from_port: 50_000,
|
118
|
+
to_port: 50_009,
|
119
|
+
ip_protocol: 'tcp',
|
120
|
+
ip_ranges: [
|
121
|
+
{
|
122
|
+
cidr_ip: '123.456.789.012/32'
|
123
|
+
}
|
124
|
+
],
|
125
|
+
user_id_group_pairs: []
|
126
|
+
},
|
127
|
+
{
|
128
|
+
from_port: nil,
|
129
|
+
to_port: nil,
|
130
|
+
ip_protocol: '-1',
|
131
|
+
ip_ranges: [],
|
132
|
+
user_id_group_pairs: [
|
133
|
+
{
|
134
|
+
user_id: '1234567890',
|
135
|
+
group_name: nil,
|
136
|
+
group_id: 'sg-3a4b5cd6',
|
137
|
+
vpc_id: nil,
|
138
|
+
vpc_peering_connection_id: nil,
|
139
|
+
peering_status: nil
|
140
|
+
}
|
141
|
+
]
|
142
|
+
}
|
143
|
+
],
|
144
|
+
ip_permissions_egress: [
|
145
|
+
{
|
146
|
+
from_port: 50_000,
|
147
|
+
to_port: 50_000,
|
148
|
+
ip_protocol: 'tcp',
|
149
|
+
ip_ranges: [
|
150
|
+
{
|
151
|
+
cidr_ip: '100.456.789.012/32'
|
152
|
+
}
|
153
|
+
]
|
154
|
+
},
|
155
|
+
{
|
156
|
+
from_port: 8080,
|
157
|
+
to_port: 8080,
|
158
|
+
ip_protocol: 'tcp',
|
159
|
+
ip_ranges: [],
|
160
|
+
user_id_group_pairs: [
|
161
|
+
{
|
162
|
+
user_id: '5678901234',
|
163
|
+
group_name: 'group-in-other-aws-account-with-vpc-peering',
|
164
|
+
group_id: 'sg-9a8b7c6d',
|
165
|
+
vpc_id: 'vpc-5b6a7c8f',
|
166
|
+
vpc_peering_connection_id: 'pcx-f9e8d7c6',
|
167
|
+
peering_status: 'active'
|
168
|
+
}
|
169
|
+
]
|
170
|
+
}
|
171
|
+
]
|
172
|
+
}
|
173
|
+
]
|
174
|
+
},
|
175
|
+
describe_subnets: {
|
176
|
+
subnets: [
|
177
|
+
{
|
178
|
+
state: 'available',
|
179
|
+
vpc_id: 'vpc-ab123cde',
|
180
|
+
subnet_id: 'subnet-1234a567',
|
181
|
+
cidr_block: '10.0.1.0/24',
|
182
|
+
tags: [
|
183
|
+
{
|
184
|
+
key: 'Name',
|
185
|
+
value: 'my-subnet'
|
186
|
+
}
|
187
|
+
]
|
188
|
+
}
|
189
|
+
]
|
190
|
+
},
|
191
|
+
describe_vpcs: {
|
192
|
+
vpcs: [
|
193
|
+
{
|
194
|
+
vpc_id: 'vpc-ab123cde',
|
195
|
+
tags: [
|
196
|
+
{
|
197
|
+
key: 'Name',
|
198
|
+
value: 'my-vpc'
|
199
|
+
}
|
200
|
+
]
|
8
201
|
}
|
9
202
|
]
|
10
203
|
}
|
data/lib/awspec/type/alb.rb
CHANGED
@@ -7,5 +7,26 @@ module Awspec::Type
|
|
7
7
|
def id
|
8
8
|
@id = resource_via_client.load_balancer_name if resource_via_client
|
9
9
|
end
|
10
|
+
|
11
|
+
STATES = %w(
|
12
|
+
active provisioning failed
|
13
|
+
)
|
14
|
+
|
15
|
+
STATES.each do |state|
|
16
|
+
define_method state + '?' do
|
17
|
+
resource_via_client.state.code == state
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def has_security_group?(sg_id)
|
22
|
+
sgs = resource_via_client.security_groups
|
23
|
+
ret = sgs.find do |sg|
|
24
|
+
sg == sg_id
|
25
|
+
end
|
26
|
+
return true if ret
|
27
|
+
sg2 = find_security_group(sg_id)
|
28
|
+
return true if sg2.tag_name == sg_id || sg2.group_name == sg_id
|
29
|
+
false
|
30
|
+
end
|
10
31
|
end
|
11
32
|
end
|
data/lib/awspec/version.rb
CHANGED