awspec 0.4.1 → 0.5.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: 0aceb416d92d43a4e663f5ce3013c8ac09da82e7
4
- data.tar.gz: 8f922eaad68c274aab3619c66db708be73e3e751
3
+ metadata.gz: 72f32e82baf76c33ca5593fa4e208835fb156855
4
+ data.tar.gz: 1d874fc92873428cb5bd3ea4669088c035f061c6
5
5
  SHA512:
6
- metadata.gz: 018073b48b54e5d9e5211938b6073121e62069feb03bd0fd6e0c3823f0cf643c9793c7bd1538705834badb2e302d4a9bce6f7922f10828f14080a98b0bb59b5e
7
- data.tar.gz: 481becdd71747950e2d09f136f1ad15fa3c05f1d4dac229c87ef15ee6baca3e291f4a57370aec3d02fb42b2a0ad045f7d8d777dcee5e7cefe29d178bdb5b86a3
6
+ metadata.gz: 20cb4c38567ea51ad2b752d63be0b177d6a1c08cf8eb12fd68d76f5f314fead66f2f87c80673fe4969a35bea15e5b364f0991a93ca576a6ce5e3acd297ed0b23
7
+ data.tar.gz: 5ac15fe44483c9d1dfdd2516beaba709a3b46446b9e2167a85f25db6f3308bf999fe630a6f948c0f5c2985e793d9d9aa43676f8c5206ec905ef6a8e80eee1f3e
data/README.md CHANGED
@@ -87,10 +87,10 @@ $ awspec generate ec2 vpc-ab123cde >> spec/ec2_spec.rb
87
87
  - [x] Auto Scaling Group (`auto_scaling_group`)
88
88
  - [x] Subnet (`subnet`)
89
89
  - [x] RouteTable (`route_table`)
90
+ - [x] EBS Volume
90
91
 
91
92
  ### Next..
92
93
 
93
- - [ ] EBS Volume
94
94
  - [ ] IAM
95
95
  - ...
96
96
 
@@ -4,7 +4,7 @@ module Awspec
4
4
  types = %w(
5
5
  base ec2 rds rds_db_parameter_group security_group
6
6
  vpc s3 route53_hosted_zone auto_scaling_group subnet
7
- route_table
7
+ route_table ebs
8
8
  )
9
9
 
10
10
  types.each { |type| require "awspec/type/#{type}" }
@@ -0,0 +1,37 @@
1
+ module Awspec::Type
2
+ class Ebs < Base
3
+ attr_reader :volume
4
+
5
+ def initialize(id)
6
+ super
7
+ @volume = find_ebs(id)
8
+ @id = @volume[:volume_id] if @volume
9
+ end
10
+
11
+ states = %w(
12
+ creating available in-use deleting deleted error
13
+ )
14
+
15
+ states.each do |state|
16
+ define_method state.tr('-', '_') + '?' do
17
+ @volume[:state] == state
18
+ end
19
+ end
20
+
21
+ def method_missing(name)
22
+ describe = name.to_sym
23
+ if @volume.members.include?(describe)
24
+ @volume[describe]
25
+ else
26
+ super
27
+ end
28
+ end
29
+
30
+ def attached_to?(instance_id)
31
+ instance = find_ec2(instance_id)
32
+ return false unless instance
33
+ return false unless @volume[:attachments]
34
+ @volume[:attachments][0][:instance_id] == instance[:instance_id] && @volume[:attachments][0][:state] == 'attached'
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
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.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
@@ -172,6 +172,7 @@ files:
172
172
  - lib/awspec/setup.rb
173
173
  - lib/awspec/type/auto_scaling_group.rb
174
174
  - lib/awspec/type/base.rb
175
+ - lib/awspec/type/ebs.rb
175
176
  - lib/awspec/type/ec2.rb
176
177
  - lib/awspec/type/rds.rb
177
178
  - lib/awspec/type/rds_db_parameter_group.rb