awspec 0.39.0 → 0.40.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/doc/_resource_types/ec2.md +9 -0
- data/doc/resource_types.md +10 -0
- data/lib/awspec/stub/ec2.rb +5 -1
- data/lib/awspec/type/ec2.rb +14 -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: 87b146bacf7bc86a5d3290c9a7d01cef0a73d108
|
4
|
+
data.tar.gz: 0de59c9a0d46e0fe919eda736d9c539f5af26cc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5a70c321ccae810054547e002b28359c58706be4993ea1894e14eecc1f23e6cd03b56c88bb8a80c69d3008fc8a694b674d1fd2434dca5fbe8634e0c38c99f05
|
7
|
+
data.tar.gz: e9d793140ca21b4b894709d756cfe91fd72172b3300ed9f76fca4f9c73ee4d7220e5f7333d61fca82de555da97eb6af2729baec0a7d68d044bce4eb578992212
|
data/doc/_resource_types/ec2.md
CHANGED
@@ -30,6 +30,15 @@ describe ec2('my-ec2-classic') do
|
|
30
30
|
end
|
31
31
|
```
|
32
32
|
|
33
|
+
### have_classiclink_security_group
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
describe ec2('my-ec2-classic') do
|
37
|
+
it { should have_classiclink_security_group('sg-2a3b4cd5') }
|
38
|
+
it { should have_classiclink_security_group('my-vpc-security-group-name') }
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
33
42
|
### have_ebs
|
34
43
|
|
35
44
|
```ruby
|
data/doc/resource_types.md
CHANGED
@@ -262,6 +262,16 @@ end
|
|
262
262
|
```
|
263
263
|
|
264
264
|
|
265
|
+
### have_classiclink_security_group
|
266
|
+
|
267
|
+
```ruby
|
268
|
+
describe ec2('my-ec2-classic') do
|
269
|
+
it { should have_classiclink_security_group('sg-2a3b4cd5') }
|
270
|
+
it { should have_classiclink_security_group('my-vpc-security-group-name') }
|
271
|
+
end
|
272
|
+
```
|
273
|
+
|
274
|
+
|
265
275
|
### have_ebs
|
266
276
|
|
267
277
|
```ruby
|
data/lib/awspec/stub/ec2.rb
CHANGED
@@ -145,7 +145,11 @@ Aws.config[:ec2] = {
|
|
145
145
|
describe_classic_link_instances: {
|
146
146
|
instances: [
|
147
147
|
instance_id: 'my-ec2-classic',
|
148
|
-
vpc_id: 'my-vpc'
|
148
|
+
vpc_id: 'my-vpc',
|
149
|
+
groups: [
|
150
|
+
{ group_name: nil, group_id: 'sg-2a3b4cd5' },
|
151
|
+
{ group_name: 'my-vpc-security-group-name', group_id: nil }
|
152
|
+
]
|
149
153
|
]
|
150
154
|
}
|
151
155
|
}
|
data/lib/awspec/type/ec2.rb
CHANGED
@@ -82,5 +82,19 @@ module Awspec::Type
|
|
82
82
|
ret = ec2_client.describe_classic_link_instances(option)
|
83
83
|
return ret.instances.count == 1 if vpc_id
|
84
84
|
end
|
85
|
+
|
86
|
+
def has_classiclink_security_group?(sg_id)
|
87
|
+
option = {
|
88
|
+
instance_ids: [@id]
|
89
|
+
}
|
90
|
+
classic_link_instances = ec2_client.describe_classic_link_instances(option)
|
91
|
+
return false if classic_link_instances.instances.count == 0
|
92
|
+
instances = classic_link_instances[0]
|
93
|
+
sgs = instances[0].groups
|
94
|
+
ret = sgs.find do |sg|
|
95
|
+
sg.group_id == sg_id || sg.group_name == sg_id
|
96
|
+
end
|
97
|
+
return true if ret
|
98
|
+
end
|
85
99
|
end
|
86
100
|
end
|
data/lib/awspec/version.rb
CHANGED