amazon-ec2 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ === 0.9.7 2010-03-14
2
+ * Added EC2 describe_subnets support (petitbon)
3
+
1
4
  === 0.9.0 2010-01-19
2
5
  * Added EC2 Spot Instance Request Support (nirvdrum)
3
6
  * Added EC2 describe_spot_price_history (tlossen)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.6
1
+ 0.9.7
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{amazon-ec2}
8
- s.version = "0.9.6"
8
+ s.version = "0.9.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Glenn Rempe"]
12
- s.date = %q{2010-02-25}
12
+ s.date = %q{2010-03-14}
13
13
  s.description = %q{A Ruby library for accessing the Amazon Web Services EC2, ELB, RDS, Cloudwatch, and Autoscaling APIs.}
14
14
  s.email = %q{glenn@rempe.us}
15
15
  s.executables = ["ec2-gem-example.rb", "ec2-gem-profile.rb", "ec2sh", "setup.rb"]
@@ -53,6 +53,7 @@ Gem::Specification.new do |s|
53
53
  "lib/AWS/EC2/snapshots.rb",
54
54
  "lib/AWS/EC2/spot_instance_requests.rb",
55
55
  "lib/AWS/EC2/spot_prices.rb",
56
+ "lib/AWS/EC2/subnets.rb",
56
57
  "lib/AWS/EC2/volumes.rb",
57
58
  "lib/AWS/ELB.rb",
58
59
  "lib/AWS/ELB/load_balancers.rb",
@@ -80,6 +81,7 @@ Gem::Specification.new do |s|
80
81
  "test/test_EC2_snapshots.rb",
81
82
  "test/test_EC2_spot_instance_requests.rb",
82
83
  "test/test_EC2_spot_prices.rb",
84
+ "test/test_EC2_subnets.rb",
83
85
  "test/test_EC2_volumes.rb",
84
86
  "test/test_ELB_load_balancers.rb",
85
87
  "test/test_RDS.rb",
@@ -114,6 +116,7 @@ Gem::Specification.new do |s|
114
116
  "test/test_EC2_snapshots.rb",
115
117
  "test/test_EC2_spot_instance_requests.rb",
116
118
  "test/test_EC2_spot_prices.rb",
119
+ "test/test_EC2_subnets.rb",
117
120
  "test/test_EC2_volumes.rb",
118
121
  "test/test_ELB_load_balancers.rb",
119
122
  "test/test_helper.rb",
@@ -0,0 +1,20 @@
1
+ module AWS
2
+ module EC2
3
+ class Base < AWS::Base
4
+
5
+ # The DescribeSubnets operation returns information about subnets available for use by the user
6
+ # making the request. Selected subnets may be specified or the list may be left empty if information for
7
+ # all registered subnets is required.
8
+ #
9
+ # @option options [Array] :subnet_id ([])
10
+ #
11
+ def describe_subnets( options = {} )
12
+ options = { :subnet_id => [] }.merge(options)
13
+ params = pathlist("SubnetId", options[:subnet_id] )
14
+ return response_generator(:action => "DescribeSubnets", :params => params)
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,65 @@
1
+ #--
2
+ # Amazon Web Services EC2 Query API Ruby library
3
+ #
4
+ # Ruby Gem Name:: amazon-ec2
5
+ # Author:: Glenn Rempe (mailto:glenn@rempe.us)
6
+ # Copyright:: Copyright (c) 2007-2010 Glenn Rempe
7
+ # License:: Distributes under the same terms as Ruby
8
+ # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
+ #++
10
+
11
+ require File.dirname(__FILE__) + '/test_helper.rb'
12
+
13
+ context "The EC2 subnets " do
14
+
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
+
18
+ @describe_subnets_response_body = <<-RESPONSE
19
+ <DescribeSubnetsResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
20
+ <subnetSet>
21
+ <item>
22
+ <state>available</state>
23
+ <availableIpAddressCount>251</availableIpAddressCount>
24
+ <subnetId>subnet-000000e0</subnetId>
25
+ <cidrBlock>10.225.251.0/24</cidrBlock>
26
+ <vpcId>vpc-b00000db</vpcId>
27
+ <availabilityZone>us-east-1a</availabilityZone>
28
+ </item>
29
+ <item>
30
+ <state>available</state>
31
+ <availableIpAddressCount>251</availableIpAddressCount>
32
+ <subnetId>subnet-11111!e1</subnetId>
33
+ <cidrBlock>10.225.251.0/24</cidrBlock>
34
+ <vpcId>vpc-b00000db</vpcId>
35
+ <availabilityZone>us-east-1a</availabilityZone>
36
+ </item>
37
+ </subnetSet>
38
+ </DescribeSubnetsResponse>
39
+ RESPONSE
40
+
41
+ end
42
+
43
+
44
+ specify "should be able to be described with no params and return a subnetSet" do
45
+ @ec2.stubs(:make_request).with('DescribeSubnets', {}).
46
+ returns stub(:body => @describe_subnets_response_body, :is_a? => true)
47
+ @ec2.describe_subnets.subnetSet.item.length.should.equal 2
48
+ end
49
+
50
+
51
+ specify "should be able to be described with describe_subnet" do
52
+ @ec2.stubs(:make_request).with('DescribeSubnets', {"SubnetId.1"=>"subnet-000000e0"}).
53
+ returns stub(:body => @describe_subnets_response_body, :is_a? => true)
54
+ @ec2.describe_subnets( :subnet_id => "subnet-000000e0" ).should.be.an.instance_of Hash
55
+ response = @ec2.describe_subnets( :subnet_id => "subnet-000000e0" )
56
+ response.subnetSet.item[0].state.should.equal "available"
57
+ response.subnetSet.item[0].availableIpAddressCount.should.equal "251"
58
+ response.subnetSet.item[0].subnetId.should.equal "subnet-000000e0"
59
+ response.subnetSet.item[0].cidrBlock.should.equal "10.225.251.0/24"
60
+ response.subnetSet.item[0].vpcId.should.equal "vpc-b00000db"
61
+ response.subnetSet.item[0].availabilityZone.should.equal "us-east-1a"
62
+ end
63
+
64
+ end
65
+
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 6
9
- version: 0.9.6
8
+ - 7
9
+ version: 0.9.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Glenn Rempe
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-02-25 00:00:00 -08:00
17
+ date: 2010-03-14 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -135,6 +135,7 @@ files:
135
135
  - lib/AWS/EC2/snapshots.rb
136
136
  - lib/AWS/EC2/spot_instance_requests.rb
137
137
  - lib/AWS/EC2/spot_prices.rb
138
+ - lib/AWS/EC2/subnets.rb
138
139
  - lib/AWS/EC2/volumes.rb
139
140
  - lib/AWS/ELB.rb
140
141
  - lib/AWS/ELB/load_balancers.rb
@@ -162,6 +163,7 @@ files:
162
163
  - test/test_EC2_snapshots.rb
163
164
  - test/test_EC2_spot_instance_requests.rb
164
165
  - test/test_EC2_spot_prices.rb
166
+ - test/test_EC2_subnets.rb
165
167
  - test/test_EC2_volumes.rb
166
168
  - test/test_ELB_load_balancers.rb
167
169
  - test/test_RDS.rb
@@ -223,6 +225,7 @@ test_files:
223
225
  - test/test_EC2_snapshots.rb
224
226
  - test/test_EC2_spot_instance_requests.rb
225
227
  - test/test_EC2_spot_prices.rb
228
+ - test/test_EC2_subnets.rb
226
229
  - test/test_EC2_volumes.rb
227
230
  - test/test_ELB_load_balancers.rb
228
231
  - test/test_helper.rb