awspec 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/awspec/generator/spec/route53_hosted_zone.rb +1 -3
- data/lib/awspec/helper/finder.rb +3 -0
- data/lib/awspec/helper/finder/auto_scaling.rb +12 -0
- data/lib/awspec/helper/type.rb +1 -1
- data/lib/awspec/type/auto_scaling_group.rb +33 -0
- data/lib/awspec/type/rds.rb +1 -1
- data/lib/awspec/type/s3.rb +1 -1
- data/lib/awspec/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4badad2ffc1abf6481ed46f2ac14cfb292978238
|
4
|
+
data.tar.gz: b82dab5329c8d08599abf7efd72b646ffbf84721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0419fec2f42ff8b00b798822192e29e5356f3b548b06a7dbc010bbdf11415e2dd729f9f8ab59adcf4d0ab4c57e0e86df031adb896b3fb8693aaff6e30ab85b5e
|
7
|
+
data.tar.gz: b817f8252edb4532db87a6f8ad6a5db0de5743b8f52bbae2ce2b42c7fe89d51216540f480e89ffa2bfdaf142cad9b959e6e37ed2249767b870df51194ef1b661
|
data/README.md
CHANGED
@@ -83,10 +83,11 @@ $ awspec generate ec2 vpc-ab123cde >> spec/ec2_spec.rb
|
|
83
83
|
- [X] S3 (`s3`)
|
84
84
|
- Route53
|
85
85
|
- [X] Route53 Hosted Zone (`route53_hosted_zone`)
|
86
|
+
- AutoScaling
|
87
|
+
- [ ] Auto Scaling Group (`auto_scaling_group`)
|
86
88
|
|
87
89
|
### Next..
|
88
90
|
|
89
|
-
- [ ] AutoScaling
|
90
91
|
- ...
|
91
92
|
|
92
93
|
## TODO
|
@@ -28,11 +28,9 @@ EOF
|
|
28
28
|
# ALIAS
|
29
29
|
dns_name = record_set.alias_target.dns_name
|
30
30
|
hosted_zone_id = record_set.alias_target.hosted_zone_id
|
31
|
-
# rubocop:disable all
|
32
31
|
template = <<-'EOF'
|
33
|
-
it { should have_record_set('<%= record_set.name %>').alias('<%= dns_name %>', '<%= hosted_zone_id %>')
|
32
|
+
it { should have_record_set('<%= record_set.name %>').alias('<%= dns_name %>', '<%= hosted_zone_id %>') }
|
34
33
|
EOF
|
35
|
-
# rubocop:enable all
|
36
34
|
return ERB.new(template, nil, '-').result(binding)
|
37
35
|
end
|
38
36
|
end
|
data/lib/awspec/helper/finder.rb
CHANGED
@@ -5,6 +5,7 @@ require 'awspec/helper/finder/security_group'
|
|
5
5
|
require 'awspec/helper/finder/rds'
|
6
6
|
require 'awspec/helper/finder/route53'
|
7
7
|
require 'awspec/helper/finder/s3'
|
8
|
+
require 'awspec/helper/finder/auto_scaling'
|
8
9
|
|
9
10
|
module Awspec::Helper
|
10
11
|
module Finder
|
@@ -15,6 +16,7 @@ module Awspec::Helper
|
|
15
16
|
include Awspec::Helper::Finder::Rds
|
16
17
|
include Awspec::Helper::Finder::Route53
|
17
18
|
include Awspec::Helper::Finder::S3
|
19
|
+
include Awspec::Helper::Finder::AutoScaling
|
18
20
|
|
19
21
|
# rubocop:disable all
|
20
22
|
def initialize(id = nil)
|
@@ -22,6 +24,7 @@ module Awspec::Helper
|
|
22
24
|
@rds_client = Aws::RDS::Client.new
|
23
25
|
@route53_client = Aws::Route53::Client.new
|
24
26
|
@s3_client = Aws::S3::Client.new
|
27
|
+
@auto_scaling_client = Aws::AutoScaling::Client.new
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Awspec::Helper
|
2
|
+
module Finder
|
3
|
+
module AutoScaling
|
4
|
+
def find_auto_scaling_group(id)
|
5
|
+
res = @auto_scaling_client.describe_auto_scaling_groups({
|
6
|
+
auto_scaling_group_names: [id]
|
7
|
+
})
|
8
|
+
res[:auto_scaling_groups][0] if res[:auto_scaling_groups].count == 1
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/awspec/helper/type.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Awspec::Type
|
2
|
+
class AutoScalingGroup < Base
|
3
|
+
attr_reader :group
|
4
|
+
|
5
|
+
def initialize(id)
|
6
|
+
super
|
7
|
+
@group = find_auto_scaling_group(id)
|
8
|
+
@id = @group[:auto_scaling_group_arn] if @group
|
9
|
+
end
|
10
|
+
|
11
|
+
def has_elb?(name)
|
12
|
+
@group.load_balancer_names.find do |lb_name|
|
13
|
+
lb_name == name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def has_ec2?(id)
|
18
|
+
ec2 = find_ec2(id)
|
19
|
+
@group.instances.find do |instance|
|
20
|
+
instance.instance_id = ec2.instance_id
|
21
|
+
end if ec2
|
22
|
+
end
|
23
|
+
|
24
|
+
def method_missing(name)
|
25
|
+
describe = name.to_sym
|
26
|
+
if @group.members.include?(describe)
|
27
|
+
@group[describe]
|
28
|
+
else
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/awspec/type/rds.rb
CHANGED
data/lib/awspec/type/s3.rb
CHANGED
data/lib/awspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/awspec/generator/spec/vpc.rb
|
141
141
|
- lib/awspec/helper.rb
|
142
142
|
- lib/awspec/helper/finder.rb
|
143
|
+
- lib/awspec/helper/finder/auto_scaling.rb
|
143
144
|
- lib/awspec/helper/finder/ec2.rb
|
144
145
|
- lib/awspec/helper/finder/rds.rb
|
145
146
|
- lib/awspec/helper/finder/route53.rb
|
@@ -154,6 +155,7 @@ files:
|
|
154
155
|
- lib/awspec/matcher/belong_to_vpc.rb
|
155
156
|
- lib/awspec/matcher/have_record_set.rb
|
156
157
|
- lib/awspec/setup.rb
|
158
|
+
- lib/awspec/type/auto_scaling_group.rb
|
157
159
|
- lib/awspec/type/base.rb
|
158
160
|
- lib/awspec/type/ec2.rb
|
159
161
|
- lib/awspec/type/rds.rb
|