amazon-ec2 0.4.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/ChangeLog +7 -4
  2. data/README.rdoc +12 -12
  3. data/README_dev.rdoc +6 -0
  4. data/Rakefile +2 -1
  5. data/VERSION +1 -1
  6. data/amazon-ec2.gemspec +25 -18
  7. data/bin/ec2-gem-example.rb +3 -3
  8. data/bin/ec2-gem-profile.rb +2 -2
  9. data/bin/ec2sh +4 -4
  10. data/bin/setup.rb +4 -2
  11. data/lib/{EC2.rb → AWS.rb} +33 -67
  12. data/lib/AWS/EC2.rb +67 -0
  13. data/lib/AWS/EC2/availability_zones.rb +43 -0
  14. data/lib/AWS/EC2/console.rb +46 -0
  15. data/lib/AWS/EC2/elastic_ips.rb +154 -0
  16. data/lib/AWS/EC2/image_attributes.rb +168 -0
  17. data/lib/AWS/EC2/images.rb +136 -0
  18. data/lib/AWS/EC2/instances.rb +218 -0
  19. data/lib/AWS/EC2/keypairs.rb +96 -0
  20. data/lib/AWS/EC2/products.rb +45 -0
  21. data/lib/AWS/EC2/security_groups.rb +234 -0
  22. data/lib/AWS/EC2/snapshots.rb +96 -0
  23. data/lib/AWS/EC2/volumes.rb +172 -0
  24. data/lib/AWS/ELB.rb +67 -0
  25. data/lib/AWS/ELB/load_balancers.rb +198 -0
  26. data/lib/{EC2 → AWS}/exceptions.rb +21 -2
  27. data/lib/{EC2 → AWS}/responses.rb +4 -5
  28. data/perftools/ec2prof-results.txt +4 -4
  29. data/perftools/ec2prof.symbols +4 -4
  30. data/test/test_EC2.rb +14 -14
  31. data/test/test_EC2_availability_zones.rb +2 -2
  32. data/test/test_EC2_console.rb +5 -5
  33. data/test/test_EC2_elastic_ips.rb +13 -13
  34. data/test/test_EC2_image_attributes.rb +35 -35
  35. data/test/test_EC2_images.rb +7 -7
  36. data/test/test_EC2_instances.rb +35 -35
  37. data/test/test_EC2_keypairs.rb +10 -10
  38. data/test/test_EC2_products.rb +7 -7
  39. data/test/test_EC2_responses.rb +2 -2
  40. data/test/test_EC2_s3_xmlsimple.rb +2 -2
  41. data/test/test_EC2_security_groups.rb +13 -13
  42. data/test/test_EC2_snapshots.rb +2 -2
  43. data/test/test_EC2_volumes.rb +2 -2
  44. data/test/test_ELB_load_balancers.rb +239 -0
  45. data/test/test_helper.rb +1 -1
  46. metadata +24 -17
  47. data/lib/EC2/availability_zones.rb +0 -41
  48. data/lib/EC2/console.rb +0 -44
  49. data/lib/EC2/elastic_ips.rb +0 -153
  50. data/lib/EC2/image_attributes.rb +0 -166
  51. data/lib/EC2/images.rb +0 -134
  52. data/lib/EC2/instances.rb +0 -216
  53. data/lib/EC2/keypairs.rb +0 -94
  54. data/lib/EC2/products.rb +0 -43
  55. data/lib/EC2/security_groups.rb +0 -232
  56. data/lib/EC2/snapshots.rb +0 -94
  57. data/lib/EC2/volumes.rb +0 -170
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "EC2 availability zones" do
14
14
 
15
- setup do
16
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
17
 
18
18
  @describe_availability_zones_response_body = <<-RESPONSE
19
19
  <DescribeAvailabilityZonesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01/">
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "The EC2 console " do
14
14
 
15
- setup do
16
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
17
 
18
18
  @get_console_output_response_body = <<-RESPONSE
19
19
  <GetConsoleOutputResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
@@ -45,9 +45,9 @@ context "The EC2 console " do
45
45
 
46
46
 
47
47
  specify "method get_console_output should raise an exception when called without nil/empty string arguments" do
48
- lambda { @ec2.get_console_output() }.should.raise(EC2::ArgumentError)
49
- lambda { @ec2.get_console_output(:instance_id => nil) }.should.raise(EC2::ArgumentError)
50
- lambda { @ec2.get_console_output(:instance_id => "") }.should.raise(EC2::ArgumentError)
48
+ lambda { @ec2.get_console_output() }.should.raise(AWS::ArgumentError)
49
+ lambda { @ec2.get_console_output(:instance_id => nil) }.should.raise(AWS::ArgumentError)
50
+ lambda { @ec2.get_console_output(:instance_id => "") }.should.raise(AWS::ArgumentError)
51
51
  end
52
52
 
53
53
 
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "EC2 elastic IP addresses " do
14
14
 
15
- setup do
16
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
17
 
18
18
  @allocate_address_body = <<-RESPONSE
19
19
  <AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
@@ -68,10 +68,10 @@ context "EC2 elastic IP addresses " do
68
68
  # @ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}).
69
69
  # returns stub(:body => @create_keypair_response_body, :is_a? => true)
70
70
  #
71
- # lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(EC2::ArgumentError)
72
- # lambda { @ec2.create_keypair() }.should.raise(EC2::ArgumentError)
73
- # lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(EC2::ArgumentError)
74
- # lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(EC2::ArgumentError)
71
+ # lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError)
72
+ # lambda { @ec2.create_keypair() }.should.raise(AWS::ArgumentError)
73
+ # lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError)
74
+ # lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError)
75
75
  #end
76
76
 
77
77
 
@@ -113,10 +113,10 @@ context "EC2 elastic IP addresses " do
113
113
  @ec2.stubs(:make_request).with('AssociateAddress', {"InstanceId" => "i-2ea64347", "PublicIp"=>"67.202.55.255"}).
114
114
  returns stub(:body => @associate_address_response_body, :is_a? => true)
115
115
 
116
- lambda { @ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" ) }.should.not.raise(EC2::ArgumentError)
117
- lambda { @ec2.associate_address() }.should.raise(EC2::ArgumentError)
118
- lambda { @ec2.associate_address( :instance_id => nil ) }.should.raise(EC2::ArgumentError)
119
- lambda { @ec2.associate_address( :public_ip => "" ) }.should.raise(EC2::ArgumentError)
116
+ lambda { @ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" ) }.should.not.raise(AWS::ArgumentError)
117
+ lambda { @ec2.associate_address() }.should.raise(AWS::ArgumentError)
118
+ lambda { @ec2.associate_address( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
119
+ lambda { @ec2.associate_address( :public_ip => "" ) }.should.raise(AWS::ArgumentError)
120
120
  end
121
121
 
122
122
 
@@ -135,9 +135,9 @@ context "EC2 elastic IP addresses " do
135
135
  @ec2.stubs(:make_request).with('DisassociateAddress', {'PublicIp' => '67.202.55.255'}).
136
136
  returns stub(:body => @disassociate_address_response_body, :is_a? => true)
137
137
 
138
- lambda { @ec2.disassociate_address( :public_ip => "67.202.55.255" ) }.should.not.raise(EC2::ArgumentError)
139
- lambda { @ec2.disassociate_address() }.should.raise(EC2::ArgumentError)
140
- lambda { @ec2.disassociate_address( :public_ip => "" ) }.should.raise(EC2::ArgumentError)
138
+ lambda { @ec2.disassociate_address( :public_ip => "67.202.55.255" ) }.should.not.raise(AWS::ArgumentError)
139
+ lambda { @ec2.disassociate_address() }.should.raise(AWS::ArgumentError)
140
+ lambda { @ec2.disassociate_address( :public_ip => "" ) }.should.raise(AWS::ArgumentError)
141
141
  end
142
142
 
143
143
 
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "EC2 image_attributes " do
14
14
 
15
- setup do
16
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
17
 
18
18
  @modify_image_attribute_response_body = <<-RESPONSE
19
19
  <ModifyImageAttributeResponse xm-lns="http://ec2.amazonaws.com/doc/2007-03-01">
@@ -130,33 +130,33 @@ context "EC2 image_attributes " do
130
130
 
131
131
  specify "should raise an exception when modify_image_attribute is called with incorrect arguments" do
132
132
  # method args can't be nil or empty
133
- lambda { @ec2.modify_image_attribute() }.should.raise(EC2::ArgumentError)
134
- lambda { @ec2.modify_image_attribute(:image_id=>"") }.should.raise(EC2::ArgumentError)
133
+ lambda { @ec2.modify_image_attribute() }.should.raise(AWS::ArgumentError)
134
+ lambda { @ec2.modify_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
135
135
 
136
136
  # :image_id option must be not be empty or nil
137
- lambda { @ec2.modify_image_attribute(:image_id=>nil, :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(EC2::ArgumentError)
138
- lambda { @ec2.modify_image_attribute(:image_id=>"", :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(EC2::ArgumentError)
137
+ lambda { @ec2.modify_image_attribute(:image_id=>nil, :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
138
+ lambda { @ec2.modify_image_attribute(:image_id=>"", :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
139
139
 
140
140
  # :attribute currently has two options which are 'launchPermission' and 'productCodes, it should fail with any other value, nil, or empty
141
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil, :operation_type=>"add", :group=>["all"]) }.should.raise(EC2::ArgumentError)
142
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"", :operation_type=>"add", :group=>["all"]) }.should.raise(EC2::ArgumentError)
143
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo", :operation_type=>"add", :group=>["all"]) }.should.raise(EC2::ArgumentError)
141
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil, :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
142
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
143
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
144
144
 
145
145
  # :attribute => 'launchPermission' option should fail if neither :group nor :user_id are also provided
146
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add") }.should.raise(EC2::ArgumentError)
147
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => nil) }.should.raise(EC2::ArgumentError)
148
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => "") }.should.raise(EC2::ArgumentError)
149
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => nil) }.should.raise(EC2::ArgumentError)
150
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => "") }.should.raise(EC2::ArgumentError)
146
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add") }.should.raise(AWS::ArgumentError)
147
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => nil) }.should.raise(AWS::ArgumentError)
148
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => "") }.should.raise(AWS::ArgumentError)
149
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => nil) }.should.raise(AWS::ArgumentError)
150
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => "") }.should.raise(AWS::ArgumentError)
151
151
 
152
152
  # :attribute => 'productCodes' option should fail if :product_code isn't also provided
153
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>nil) }.should.raise(EC2::ArgumentError)
154
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>"") }.should.raise(EC2::ArgumentError)
153
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>nil) }.should.raise(AWS::ArgumentError)
154
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>"") }.should.raise(AWS::ArgumentError)
155
155
 
156
156
  # :operation_type currently has two options which are 'add' and 'remove', and it should fail with any other, nil or empty
157
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>nil, :group=>["all"]) }.should.raise(EC2::ArgumentError)
158
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"", :group=>["all"]) }.should.raise(EC2::ArgumentError)
159
- lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"foo", :group=>["all"]) }.should.raise(EC2::ArgumentError)
157
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>nil, :group=>["all"]) }.should.raise(AWS::ArgumentError)
158
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"", :group=>["all"]) }.should.raise(AWS::ArgumentError)
159
+ lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"foo", :group=>["all"]) }.should.raise(AWS::ArgumentError)
160
160
  end
161
161
 
162
162
 
@@ -191,22 +191,22 @@ context "EC2 image_attributes " do
191
191
 
192
192
  specify "should raise an exception when describe_image_attribute is called with incorrect arguments" do
193
193
  # method args can't be nil or empty
194
- lambda { @ec2.describe_image_attribute() }.should.raise(EC2::ArgumentError)
195
- lambda { @ec2.describe_image_attribute(:image_id=>"") }.should.raise(EC2::ArgumentError)
194
+ lambda { @ec2.describe_image_attribute() }.should.raise(AWS::ArgumentError)
195
+ lambda { @ec2.describe_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
196
196
 
197
197
  # :image_id option must be not be empty or nil w/ launchPermission
198
- lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(EC2::ArgumentError)
199
- lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(EC2::ArgumentError)
198
+ lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
199
+ lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
200
200
 
201
201
  # :image_id option must be not be empty or nil w/ productCodes
202
- lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"productCodes") }.should.raise(EC2::ArgumentError)
203
- lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"productCodes") }.should.raise(EC2::ArgumentError)
202
+ lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"productCodes") }.should.raise(AWS::ArgumentError)
203
+ lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"productCodes") }.should.raise(AWS::ArgumentError)
204
204
 
205
205
  # :attribute currently has two options which are 'launchPermission' and 'productCodes', it should fail with any other values,
206
206
  # nil, or empty
207
- lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(EC2::ArgumentError)
208
- lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(EC2::ArgumentError)
209
- lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(EC2::ArgumentError)
207
+ lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWS::ArgumentError)
208
+ lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWS::ArgumentError)
209
+ lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWS::ArgumentError)
210
210
  end
211
211
 
212
212
 
@@ -221,17 +221,17 @@ context "EC2 image_attributes " do
221
221
 
222
222
  specify "should raise an exception when reset_image_attribute is called with incorrect arguments" do
223
223
  # method args can't be nil or empty
224
- lambda { @ec2.reset_image_attribute() }.should.raise(EC2::ArgumentError)
225
- lambda { @ec2.reset_image_attribute(:image_id=>"") }.should.raise(EC2::ArgumentError)
224
+ lambda { @ec2.reset_image_attribute() }.should.raise(AWS::ArgumentError)
225
+ lambda { @ec2.reset_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
226
226
 
227
227
  # :image_id option must be not be empty or nil
228
- lambda { @ec2.reset_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(EC2::ArgumentError)
229
- lambda { @ec2.reset_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(EC2::ArgumentError)
228
+ lambda { @ec2.reset_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
229
+ lambda { @ec2.reset_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
230
230
 
231
231
  # :attribute currently has one option which is 'launchPermission', it should fail with any other value, nil, or empty
232
- lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(EC2::ArgumentError)
233
- lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(EC2::ArgumentError)
234
- lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(EC2::ArgumentError)
232
+ lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWS::ArgumentError)
233
+ lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWS::ArgumentError)
234
+ lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWS::ArgumentError)
235
235
  end
236
236
 
237
237
 
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "An EC2 image " do
14
14
 
15
- setup do
16
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
17
 
18
18
  @register_image_response_body = <<-RESPONSE
19
19
  <RegisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
@@ -65,8 +65,8 @@ context "An EC2 image " do
65
65
 
66
66
 
67
67
  specify "method register_image should raise an exception when called without nil/empty string arguments" do
68
- lambda { @ec2.register_image() }.should.raise(EC2::ArgumentError)
69
- lambda { @ec2.register_image(:image_location => "") }.should.raise(EC2::ArgumentError)
68
+ lambda { @ec2.register_image() }.should.raise(AWS::ArgumentError)
69
+ lambda { @ec2.register_image(:image_location => "") }.should.raise(AWS::ArgumentError)
70
70
  end
71
71
 
72
72
 
@@ -188,9 +188,9 @@ context "An EC2 image " do
188
188
 
189
189
 
190
190
  specify "method deregister_image should raise an exception when called without nil/empty string arguments" do
191
- lambda { @ec2.deregister_image() }.should.raise(EC2::ArgumentError)
192
- lambda { @ec2.deregister_image( :image_id => nil ) }.should.raise(EC2::ArgumentError)
193
- lambda { @ec2.deregister_image( :image_id => "" ) }.should.raise(EC2::ArgumentError)
191
+ lambda { @ec2.deregister_image() }.should.raise(AWS::ArgumentError)
192
+ lambda { @ec2.deregister_image( :image_id => nil ) }.should.raise(AWS::ArgumentError)
193
+ lambda { @ec2.deregister_image( :image_id => "" ) }.should.raise(AWS::ArgumentError)
194
194
  end
195
195
 
196
196
 
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "EC2 instances " do
14
14
 
15
- setup do
16
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
17
 
18
18
  @run_instances_response_body = <<-RESPONSE
19
19
  <RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-08-29">
@@ -193,30 +193,30 @@ context "EC2 instances " do
193
193
  @ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "AddressingType" => 'public', 'InstanceType' => 'm1.small').
194
194
  returns stub(:body => @run_instances_response_body, :is_a? => true)
195
195
 
196
- lambda { @ec2.run_instances() }.should.raise(EC2::ArgumentError)
197
- lambda { @ec2.run_instances( :image_id => "" ) }.should.raise(EC2::ArgumentError)
198
-
199
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1 ) }.should.not.raise(EC2::ArgumentError)
200
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 0 ) }.should.raise(EC2::ArgumentError)
201
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => nil ) }.should.raise(EC2::ArgumentError)
202
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "" ) }.should.raise(EC2::ArgumentError)
203
-
204
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 1 ) }.should.not.raise(EC2::ArgumentError)
205
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 0 ) }.should.raise(EC2::ArgumentError)
206
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => nil ) }.should.raise(EC2::ArgumentError)
207
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "" ) }.should.raise(EC2::ArgumentError)
208
-
209
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "public" ) }.should.not.raise(EC2::ArgumentError)
210
- #lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "direct" ) }.should.not.raise(EC2::ArgumentError)
211
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => nil ) }.should.raise(EC2::ArgumentError)
212
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "" ) }.should.raise(EC2::ArgumentError)
213
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "foo" ) }.should.raise(EC2::ArgumentError)
214
-
215
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => true ) }.should.not.raise(EC2::ArgumentError)
216
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => false ) }.should.not.raise(EC2::ArgumentError)
217
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => nil ) }.should.raise(EC2::ArgumentError)
218
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "" ) }.should.raise(EC2::ArgumentError)
219
- lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "foo" ) }.should.raise(EC2::ArgumentError)
196
+ lambda { @ec2.run_instances() }.should.raise(AWS::ArgumentError)
197
+ lambda { @ec2.run_instances( :image_id => "" ) }.should.raise(AWS::ArgumentError)
198
+
199
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1 ) }.should.not.raise(AWS::ArgumentError)
200
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 0 ) }.should.raise(AWS::ArgumentError)
201
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => nil ) }.should.raise(AWS::ArgumentError)
202
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "" ) }.should.raise(AWS::ArgumentError)
203
+
204
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 1 ) }.should.not.raise(AWS::ArgumentError)
205
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 0 ) }.should.raise(AWS::ArgumentError)
206
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => nil ) }.should.raise(AWS::ArgumentError)
207
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "" ) }.should.raise(AWS::ArgumentError)
208
+
209
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "public" ) }.should.not.raise(AWS::ArgumentError)
210
+ #lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "direct" ) }.should.not.raise(AWS::ArgumentError)
211
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => nil ) }.should.raise(AWS::ArgumentError)
212
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "" ) }.should.raise(AWS::ArgumentError)
213
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "foo" ) }.should.raise(AWS::ArgumentError)
214
+
215
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => true ) }.should.not.raise(AWS::ArgumentError)
216
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => false ) }.should.not.raise(AWS::ArgumentError)
217
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => nil ) }.should.raise(AWS::ArgumentError)
218
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "" ) }.should.raise(AWS::ArgumentError)
219
+ lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "foo" ) }.should.raise(AWS::ArgumentError)
220
220
  end
221
221
 
222
222
 
@@ -243,15 +243,15 @@ context "EC2 instances " do
243
243
  returns stub(:body => @run_instances_response_body, :is_a? => true)
244
244
  @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :group_id => [], :user_data => "foo", :base64_encoded => false ).should.be.an.instance_of Hash
245
245
  end
246
-
246
+
247
247
  specify "should get no user data for when options has no user_data key" do
248
248
  @ec2.extract_user_data({}).should == nil
249
249
  end
250
-
250
+
251
251
  specify "should get plain string user data when options has user_data and no base64 key" do
252
252
  @ec2.extract_user_data({:user_data => "foo\nbar"}).should == "foo\nbar"
253
253
  end
254
-
254
+
255
255
  specify "should strip new lines and base64 encode when options has both user_data and base64" do
256
256
  @ec2.extract_user_data({:user_data => "binary\ndata\nhere\n", :base64_encoded => true}).should == "YmluYXJ5CmRhdGEKaGVyZQo="
257
257
  end
@@ -305,9 +305,9 @@ context "EC2 instances " do
305
305
 
306
306
 
307
307
  specify "method reboot_instances should raise an exception when called without nil/empty string arguments" do
308
- lambda { @ec2.reboot_instances() }.should.raise(EC2::ArgumentError)
309
- lambda { @ec2.reboot_instances( :instance_id => nil ) }.should.raise(EC2::ArgumentError)
310
- lambda { @ec2.reboot_instances( :instance_id => "" ) }.should.raise(EC2::ArgumentError)
308
+ lambda { @ec2.reboot_instances() }.should.raise(AWS::ArgumentError)
309
+ lambda { @ec2.reboot_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
310
+ lambda { @ec2.reboot_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
311
311
  end
312
312
 
313
313
 
@@ -319,9 +319,9 @@ context "EC2 instances " do
319
319
 
320
320
 
321
321
  specify "method terminate_instances should raise an exception when called without nil/empty string arguments" do
322
- lambda { @ec2.terminate_instances() }.should.raise(EC2::ArgumentError)
323
- lambda { @ec2.terminate_instances( :instance_id => nil ) }.should.raise(EC2::ArgumentError)
324
- lambda { @ec2.terminate_instances( :instance_id => "" ) }.should.raise(EC2::ArgumentError)
322
+ lambda { @ec2.terminate_instances() }.should.raise(AWS::ArgumentError)
323
+ lambda { @ec2.terminate_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
324
+ lambda { @ec2.terminate_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
325
325
  end
326
326
 
327
327
 
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "EC2 keypairs " do
14
14
 
15
- setup do
16
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
17
 
18
18
  @create_keypair_response_body = <<-RESPONSE
19
19
  <CreateKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
@@ -83,10 +83,10 @@ context "EC2 keypairs " do
83
83
  @ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}).
84
84
  returns stub(:body => @create_keypair_response_body, :is_a? => true)
85
85
 
86
- lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(EC2::ArgumentError)
87
- lambda { @ec2.create_keypair() }.should.raise(EC2::ArgumentError)
88
- lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(EC2::ArgumentError)
89
- lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(EC2::ArgumentError)
86
+ lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError)
87
+ lambda { @ec2.create_keypair() }.should.raise(AWS::ArgumentError)
88
+ lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError)
89
+ lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError)
90
90
  end
91
91
 
92
92
 
@@ -113,10 +113,10 @@ context "EC2 keypairs " do
113
113
  @ec2.stubs(:make_request).with('DeleteKeyPair', {"KeyName"=>"example-key-name"}).
114
114
  returns stub(:body => @delete_keypair_body, :is_a? => true)
115
115
 
116
- lambda { @ec2.delete_keypair( :key_name => "example-key-name" ) }.should.not.raise(EC2::ArgumentError)
117
- lambda { @ec2.delete_keypair() }.should.raise(EC2::ArgumentError)
118
- lambda { @ec2.delete_keypair( :key_name => nil ) }.should.raise(EC2::ArgumentError)
119
- lambda { @ec2.delete_keypair( :key_name => "" ) }.should.raise(EC2::ArgumentError)
116
+ lambda { @ec2.delete_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError)
117
+ lambda { @ec2.delete_keypair() }.should.raise(AWS::ArgumentError)
118
+ lambda { @ec2.delete_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError)
119
+ lambda { @ec2.delete_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError)
120
120
  end
121
121
 
122
122
 
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "An EC2 instance " do
14
14
 
15
- setup do
16
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
15
+ before do
16
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
17
 
18
18
  @confirm_product_instance_response_body = <<-RESPONSE
19
19
  <ConfirmProductInstanceResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
@@ -37,11 +37,11 @@ context "An EC2 instance " do
37
37
 
38
38
 
39
39
  specify "method get_console_output should raise an exception when called without nil/empty string arguments" do
40
- lambda { @ec2.confirm_product_instance() }.should.raise(EC2::ArgumentError)
41
- lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => nil) }.should.raise(EC2::ArgumentError)
42
- lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => "") }.should.raise(EC2::ArgumentError)
43
- lambda { @ec2.confirm_product_instance(:product_code => nil, :instance_id => "i-10a64379") }.should.raise(EC2::ArgumentError)
44
- lambda { @ec2.confirm_product_instance(:product_code => "", :instance_id => "i-10a64379") }.should.raise(EC2::ArgumentError)
40
+ lambda { @ec2.confirm_product_instance() }.should.raise(AWS::ArgumentError)
41
+ lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => nil) }.should.raise(AWS::ArgumentError)
42
+ lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => "") }.should.raise(AWS::ArgumentError)
43
+ lambda { @ec2.confirm_product_instance(:product_code => nil, :instance_id => "i-10a64379") }.should.raise(AWS::ArgumentError)
44
+ lambda { @ec2.confirm_product_instance(:product_code => "", :instance_id => "i-10a64379") }.should.raise(AWS::ArgumentError)
45
45
  end
46
46
 
47
47
 
@@ -13,14 +13,14 @@ require File.dirname(__FILE__) + '/test_helper.rb'
13
13
  context "The Response classes " do
14
14
 
15
15
 
16
- setup do
16
+ before do
17
17
  @http_xml = <<-RESPONSE
18
18
  <RebootInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
19
19
  <return>true</return>
20
20
  </RebootInstancesResponse>
21
21
  RESPONSE
22
22
 
23
- @response = EC2::Response.parse(:xml => @http_xml)
23
+ @response = AWS::Response.parse(:xml => @http_xml)
24
24
  end
25
25
 
26
26
 
@@ -16,8 +16,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
16
16
 
17
17
  context "EC2 aws-s3 compat test" do
18
18
 
19
- setup do
20
- @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
19
+ before do
20
+ @ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
21
21
 
22
22
  @describe_instances_response_body = <<-RESPONSE
23
23
  <DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-08-29">