grempe-amazon-ec2 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +83 -73
- data/README.rdoc +1 -7
- data/Rakefile +0 -1
- data/bin/ec2-gem-example.rb +5 -6
- data/bin/ec2sh +2 -2
- data/bin/setup.rb +5 -5
- data/lib/EC2.rb +2 -2
- data/lib/EC2/availability_zones.rb +4 -5
- data/lib/EC2/console.rb +3 -3
- data/lib/EC2/elastic_ips.rb +2 -2
- data/lib/EC2/exceptions.rb +2 -2
- data/lib/EC2/image_attributes.rb +2 -2
- data/lib/EC2/images.rb +2 -2
- data/lib/EC2/instances.rb +5 -2
- data/lib/EC2/keypairs.rb +2 -2
- data/lib/EC2/products.rb +3 -3
- data/lib/EC2/responses.rb +5 -5
- data/lib/EC2/security_groups.rb +2 -2
- data/lib/EC2/snapshots.rb +10 -11
- data/lib/EC2/volumes.rb +22 -23
- data/test/test_EC2.rb +2 -2
- data/test/test_EC2_availability_zones.rb +3 -3
- data/test/test_EC2_console.rb +3 -3
- data/test/test_EC2_elastic_ips.rb +2 -2
- data/test/test_EC2_image_attributes.rb +3 -3
- data/test/test_EC2_images.rb +2 -2
- data/test/test_EC2_instances.rb +10 -5
- data/test/test_EC2_keypairs.rb +2 -2
- data/test/test_EC2_products.rb +2 -2
- data/test/test_EC2_responses.rb +2 -2
- data/test/test_EC2_security_groups.rb +2 -2
- data/test/test_EC2_snapshots.rb +1 -1
- data/test/test_EC2_volumes.rb +3 -5
- data/test/test_helper.rb +2 -3
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 0.3.1 2008-09-18
|
2
|
+
* Added basic custom kernel id support to run_instances. Thanks to Keith Hudgins for the patch.
|
3
|
+
|
4
|
+
=== 0.3.0 2008-08-24
|
5
|
+
* Changed response object from AmazonEC2::Response to Hash (patch from Yan Pritzker 'skwp') Thanks!
|
6
|
+
* Added support for Elastic Block Storage (patch from Yann Klis 'yannski') Thanks!
|
7
|
+
* Bumped AWS EC2 API version to 2008-05-05
|
8
|
+
* Bumped gem version number
|
9
|
+
* Whitespace cleanup
|
10
|
+
|
1
11
|
=== 0.2.15 2008-08-20
|
2
12
|
* Updated gem install instructions, and dependency specifications in the gemspec.
|
3
13
|
|
@@ -43,10 +53,10 @@
|
|
43
53
|
Now it looks like: require 'xmlsimple' unless defined? XmlSimple
|
44
54
|
|
45
55
|
=== 0.2.3 2007-07-06
|
46
|
-
* Updated gem to work with new official release of AWS API version 2007-03-01 which occurred
|
56
|
+
* Updated gem to work with new official release of AWS API version 2007-03-01 which occurred
|
47
57
|
on July 6, 2007.
|
48
|
-
* Added support for primary new feature which supports Paid AMI's and the product codes
|
49
|
-
associated with them. Modified several methods to support this change, updated the test
|
58
|
+
* Added support for primary new feature which supports Paid AMI's and the product codes
|
59
|
+
associated with them. Modified several methods to support this change, updated the test
|
50
60
|
cases, and added a new method EC2#confirm_product_instance.
|
51
61
|
|
52
62
|
=== 0.2.2 2007-07-03
|
@@ -57,47 +67,47 @@
|
|
57
67
|
|
58
68
|
=== 0.2.0 2007-07-03
|
59
69
|
|
60
|
-
* MAJOR library changes : THESE CHANGES ARE NOT BACKWARD COMPATIBLE!! You will need to update
|
61
|
-
the way in which you make calls, handle responses, and rescue exceptions from this library.
|
62
|
-
If you prefer not to make these changes you can feel free to continue to use the older version
|
70
|
+
* MAJOR library changes : THESE CHANGES ARE NOT BACKWARD COMPATIBLE!! You will need to update
|
71
|
+
the way in which you make calls, handle responses, and rescue exceptions from this library.
|
72
|
+
If you prefer not to make these changes you can feel free to continue to use the older version
|
63
73
|
of the gem. These older versions however will no longer be maintained.
|
64
|
-
|
74
|
+
|
65
75
|
* MAJOR refactoring of how methods calls are made. Now all methods are called with a simple hash
|
66
76
|
of arguments and none of them are positional. This feels much more "Ruby'ish".
|
67
|
-
|
68
|
-
* MAJOR refactoring of how responses are returned to users. No longer do you have to call the
|
69
|
-
.parse method, and no longer are you getting back simple arrays of information. Responses
|
70
|
-
now come in the form of OpenStruct objects that contain all of the data for an object in
|
77
|
+
|
78
|
+
* MAJOR refactoring of how responses are returned to users. No longer do you have to call the
|
79
|
+
.parse method, and no longer are you getting back simple arrays of information. Responses
|
80
|
+
now come in the form of OpenStruct objects that contain all of the data for an object in
|
71
81
|
Enumerable form so you can use iterators (.each, .each_pair, etc). All methods return an EC2::Response object
|
72
82
|
which inherits from OpenStruct. The return data from EC2, which is in XML form, is parsed
|
73
83
|
with XmlSimple and is used to directly construct the return data structure. This allows us
|
74
84
|
to know with some confidence that the data structure returned from AWS will always be consistent
|
75
|
-
with this library's responses. There is also an .xml attribute for each response object that lets you
|
85
|
+
with this library's responses. There is also an .xml attribute for each response object that lets you
|
76
86
|
see the full and complete XML response from AWS if that is useful to you.
|
77
|
-
|
87
|
+
|
78
88
|
* Added an exception framework which will now throw appropriate Ruby exceptions
|
79
89
|
that match those handed to us by Amazon EC2. ArgumentError exceptions will also
|
80
|
-
be thrown if you are making calls we know to be illegal or malformed. You should rescue
|
81
|
-
these exceptions in your application instead of parsing text responses. All exceptions
|
90
|
+
be thrown if you are making calls we know to be illegal or malformed. You should rescue
|
91
|
+
these exceptions in your application instead of parsing text responses. All exceptions
|
82
92
|
descend from EC2::Error. You can see them all in exceptions.rb in the gem install.
|
83
|
-
|
93
|
+
|
84
94
|
* Added a full suite of test/spec unit tests which currently cover 100% of the public methods
|
85
|
-
in this library. We have abot 92% code coverage according to rcov. This has greatly enhanced
|
86
|
-
the reliability of the library as well as our confidence in the code.
|
87
|
-
We used to have 0% test coverage. :-/
|
88
|
-
|
95
|
+
in this library. We have abot 92% code coverage according to rcov. This has greatly enhanced
|
96
|
+
the reliability of the library as well as our confidence in the code.
|
97
|
+
We used to have 0% test coverage. :-/
|
98
|
+
|
89
99
|
* Added an EC2 command shell : 'ec2sh' which can be called from anywhere and gives you
|
90
|
-
an interactive irb session with an EC2 connection pre-made for you as @ec2. You can use this
|
91
|
-
to interactively execute any command on EC2 that this library supports. Try @ec2.methods.sort
|
100
|
+
an interactive irb session with an EC2 connection pre-made for you as @ec2. You can use this
|
101
|
+
to interactively execute any command on EC2 that this library supports. Try @ec2.methods.sort
|
92
102
|
or @ec2.describe_images to test it out. You must first setup two shell environment variables
|
93
103
|
which contain your ACCESS_KEY_ID and SECRET_ACCESS_KEY for this to work. Otherwise an error
|
94
|
-
will be thrown when you try to start it. This is way cool and shamelessly borrowed from
|
104
|
+
will be thrown when you try to start it. This is way cool and shamelessly borrowed from
|
95
105
|
Marcel Molina's fine AWS::S3 library.
|
96
|
-
|
106
|
+
|
97
107
|
* Updated API version in the query API request to 2007-01-19, and added all known method calls
|
98
|
-
in this version of the API to the gem (including reboot, viewing console output, NAT addressing
|
108
|
+
in this version of the API to the gem (including reboot, viewing console output, NAT addressing
|
99
109
|
and more!)
|
100
|
-
|
110
|
+
|
101
111
|
* Removed .parse method as it is no longer needed or wanted.
|
102
112
|
|
103
113
|
* Removed 'verbose' attribute writer and a couple of related debug 'puts' calls in EC2.rb.
|
@@ -119,43 +129,43 @@
|
|
119
129
|
* New Mocha based tests (Mocha test suite must be installed to run tests. 'sudo gem install mocha')
|
120
130
|
* Cleanup of the test directory.
|
121
131
|
* Applied patch from Randy Bias related to CGI escaping error. From his notes:
|
122
|
-
|
123
|
-
I finally figured out what was going on. It was a compound problem. The first being that you can't
|
124
|
-
CGI::encode the UserData early. You have to just Base64 encode it. Unfortunately, when you Base64
|
125
|
-
encode it, it means that some encodings will be padded with extra chars, specifically the '=', but &, ?
|
126
|
-
and = get stripped by EC2.canonial_string. So if a Base64 encoding has trailing ='s for padding,
|
127
|
-
these get stripped and then you sign the UserData Base64 payload sans the padding. But it looks
|
132
|
+
|
133
|
+
I finally figured out what was going on. It was a compound problem. The first being that you can't
|
134
|
+
CGI::encode the UserData early. You have to just Base64 encode it. Unfortunately, when you Base64
|
135
|
+
encode it, it means that some encodings will be padded with extra chars, specifically the '=', but &, ?
|
136
|
+
and = get stripped by EC2.canonial_string. So if a Base64 encoding has trailing ='s for padding,
|
137
|
+
these get stripped and then you sign the UserData Base64 payload sans the padding. But it looks
|
128
138
|
like Amazon's side is doing the right thing and is signing the padding. So, the signatures mis-match.
|
129
|
-
|
130
|
-
I've got the complete patch here and it's about as elegant/clean as I could make it in a short
|
131
|
-
period of time. It's a little tough to strip those equal signs when there are so many in the URI.
|
132
|
-
I think this works pretty well, though. I'm splitting the URI on '&', then for each field ripping
|
139
|
+
|
140
|
+
I've got the complete patch here and it's about as elegant/clean as I could make it in a short
|
141
|
+
period of time. It's a little tough to strip those equal signs when there are so many in the URI.
|
142
|
+
I think this works pretty well, though. I'm splitting the URI on '&', then for each field ripping
|
133
143
|
out all '&' and '?' and only the first '='. Then stitching it back together.
|
134
144
|
|
135
145
|
|
136
146
|
=== 0.0.6 2007-03-02
|
137
147
|
* Patched instances.rb with a bugfix and patch provided by Randy Bias (Thanks Randy!).
|
138
148
|
Only minimally tested so please let me know if this causes any problems for anyone.
|
139
|
-
|
149
|
+
|
140
150
|
From his notes:
|
141
|
-
I wanted to let you know that there appears to be a bug in how user data is passed. In
|
151
|
+
I wanted to let you know that there appears to be a bug in how user data is passed. In
|
142
152
|
instances.rb the line that creates the base64 encoded package of user data is as follows:
|
143
|
-
|
153
|
+
|
144
154
|
userData = CGI::escape(Base64.encode64(in_params[:userData]).strip())
|
145
|
-
|
146
|
-
This may have worked prior, but at least right now the CGI::escape appears to cause a
|
155
|
+
|
156
|
+
This may have worked prior, but at least right now the CGI::escape appears to cause a
|
147
157
|
breakage. More specifically it turns something like this (the actual base64 encoded string):
|
148
158
|
|
149
159
|
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
|
150
160
|
eHh4eHh4eHh4eHh4eHh4eHh4eHgg
|
151
|
-
|
161
|
+
|
152
162
|
Into this:
|
153
|
-
|
154
|
-
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh%
|
163
|
+
|
164
|
+
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh%
|
155
165
|
0AeHh4eHh4eHh4eHh4eHh4eHh4eHgg
|
156
|
-
|
157
|
-
And it looks like EC2 chokes on the %0, which is CGI::escape's way for handling an EOL.
|
158
|
-
Unfortunately, the Base64.encode64 (at least in my 1.8.5 version of Ruby) inserts a
|
166
|
+
|
167
|
+
And it looks like EC2 chokes on the %0, which is CGI::escape's way for handling an EOL.
|
168
|
+
Unfortunately, the Base64.encode64 (at least in my 1.8.5 version of Ruby) inserts a
|
159
169
|
EOL at every 47 chars, no matter what:
|
160
170
|
|
161
171
|
---
|
@@ -165,9 +175,9 @@
|
|
165
175
|
require 'rubygems'
|
166
176
|
require_gem 'amazon-ec2'
|
167
177
|
require 'getoptlong'
|
168
|
-
puts Base64.encode64
|
178
|
+
puts Base64.encode64
|
169
179
|
("012345678901234567890123456789012345678901234567890123456789")
|
170
|
-
|
180
|
+
|
171
181
|
[randyb@master randyb] /tmp/foo.rb
|
172
182
|
MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0
|
173
183
|
NTY3ODkwMTIzNDU2Nzg5
|
@@ -178,28 +188,28 @@
|
|
178
188
|
|
179
189
|
=== 0.0.5 2006-12-21
|
180
190
|
|
181
|
-
* Changes to home page documentation and example files to indicate that you
|
182
|
-
should use 'require_gem' instead of a simple require. Not sure if this
|
183
|
-
is a result of something I am doing in the packaging of the gem that is
|
191
|
+
* Changes to home page documentation and example files to indicate that you
|
192
|
+
should use 'require_gem' instead of a simple require. Not sure if this
|
193
|
+
is a result of something I am doing in the packaging of the gem that is
|
184
194
|
incorrect or if this is right and proper. I will investigate further.
|
185
|
-
* Patched instances.rb run_instances method to allow for submission of
|
186
|
-
user data with the command to start an instance. Patch submitted
|
195
|
+
* Patched instances.rb run_instances method to allow for submission of
|
196
|
+
user data with the command to start an instance. Patch submitted
|
187
197
|
anonymously on RubyForge. This had not been functionally implemented
|
188
198
|
in the Amazon Web Services sample library prior to this patch.
|
189
|
-
* Added simple framework for adding unit tests for the library under test dir.
|
199
|
+
* Added simple framework for adding unit tests for the library under test dir.
|
190
200
|
No functional unit tests exist yet.
|
191
201
|
|
192
202
|
|
193
203
|
=== 0.0.4 2006-12-21
|
194
204
|
|
195
|
-
* Applied patch from Kevin Clark to svn version 7. Thanks for the
|
196
|
-
patch and the description Kevin! Please report if you
|
197
|
-
encounter any issues with this patched version. Here is Kevin's
|
198
|
-
description which I requested : "It helps me to think of modules as boxes full of classes and
|
205
|
+
* Applied patch from Kevin Clark to svn version 7. Thanks for the
|
206
|
+
patch and the description Kevin! Please report if you
|
207
|
+
encounter any issues with this patched version. Here is Kevin's
|
208
|
+
description which I requested : "It helps me to think of modules as boxes full of classes and
|
199
209
|
methods. REXML is a module which holds various classes related to parsing XML
|
200
210
|
including REXML::Node, REXML::Document and REXML::XPath. When you
|
201
211
|
include a module it takes everything out of the box and places it in
|
202
|
-
the local context. So, when you include REXML in the global namespace
|
212
|
+
the local context. So, when you include REXML in the global namespace
|
203
213
|
on line 27 of EC2.rb, it includes classes called Node, Document and XPath in the
|
204
214
|
global object space. This means that I can't have a class called Node
|
205
215
|
in my own project (which I do). The library would be a much better
|
@@ -209,23 +219,23 @@
|
|
209
219
|
|
210
220
|
=== 0.0.3 2006-12-16
|
211
221
|
|
212
|
-
* API CHANGE : Changed method name 'authorize' to 'authorize_security_group_ingress' to ensure consistent
|
222
|
+
* API CHANGE : Changed method name 'authorize' to 'authorize_security_group_ingress' to ensure consistent
|
213
223
|
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'authorize' for backwards compatibility.
|
214
|
-
* API CHANGE : Changed method name 'revoke' to 'revoke_security_group_ingress' to ensure consistent
|
215
|
-
|
216
|
-
* API CHANGE : Changed method name 'delete_securitygroup' to 'delete_security_group' to ensure consistent
|
217
|
-
|
218
|
-
* API CHANGE : Changed method name 'describe_securitygroups' to 'describe_security_group' to ensure consistent
|
219
|
-
|
220
|
-
* API CHANGE : Changed method name 'create_securitygroup' to 'create_security_group' to ensure consistent
|
221
|
-
|
224
|
+
* API CHANGE : Changed method name 'revoke' to 'revoke_security_group_ingress' to ensure consistent
|
225
|
+
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'revoke' for backwards compatibility.
|
226
|
+
* API CHANGE : Changed method name 'delete_securitygroup' to 'delete_security_group' to ensure consistent
|
227
|
+
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'delete_securitygroup' for backwards compatibility.
|
228
|
+
* API CHANGE : Changed method name 'describe_securitygroups' to 'describe_security_group' to ensure consistent
|
229
|
+
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'describe_securitygroups' for backwards compatibility.
|
230
|
+
* API CHANGE : Changed method name 'create_securitygroup' to 'create_security_group' to ensure consistent
|
231
|
+
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'create_securitygroup' for backwards compatibility.
|
222
232
|
* Added many API rdoc's, some method descriptions copied from Amazon Query API Developer Guide.
|
223
233
|
* Extracted some parts of the formerly monolithic EC2 library out into separate files for manageability.
|
224
234
|
* Changed the HTTP 'User-Agent' string used for each request so that we have our own user agent
|
225
235
|
to identify this library's calls. Now set the version # in the user agent string based on the
|
226
236
|
master version number for this library which is stored in lib/EC2/version.rb and should only
|
227
237
|
be defined in one place.
|
228
|
-
* Set @http.verify_mode = OpenSSL::SSL::VERIFY_NONE to avoid seeing SSL Cert warning
|
238
|
+
* Set @http.verify_mode = OpenSSL::SSL::VERIFY_NONE to avoid seeing SSL Cert warning
|
229
239
|
"warning: peer certificate won't be verified in this SSL session". File EC2.rb:96
|
230
240
|
* Make 'pathlist' utility method a private method (EC2.rb:111). No reason I can see for this to be exposed.
|
231
241
|
|
@@ -237,7 +247,7 @@
|
|
237
247
|
|
238
248
|
=== 0.0.1 2006-12-13
|
239
249
|
|
240
|
-
* Initial release of the Ruby Gem. This includes the version of the library exactly as provided by
|
241
|
-
Amazon Web Services as example code. No changes or enhancements to that code were made other than
|
250
|
+
* Initial release of the Ruby Gem. This includes the version of the library exactly as provided by
|
251
|
+
Amazon Web Services as example code. No changes or enhancements to that code were made other than
|
242
252
|
packaging it as a Ruby Gem.
|
243
|
-
* RubyForge project created. http://amazon-ec2
|
253
|
+
* RubyForge project created. http://github.com/grempe/amazon-ec2/tree/master
|
data/README.rdoc
CHANGED
@@ -312,19 +312,13 @@ EC2 will typically return sets of things (imagesSet, reservationSet, etc.) which
|
|
312
312
|
* Report Bugs / Request Features : http://grempe.lighthouseapp.com/projects/10644-amazon-ec2/overview
|
313
313
|
* Amazon Web Services : http://aws.amazon.com
|
314
314
|
|
315
|
-
=== Related Projects
|
316
|
-
|
317
|
-
Jesse Newland and I created the Capsize project which can help when using Capistrano and EC2 together. You can check out the latest code at:
|
318
|
-
|
319
|
-
http://github.com/jnewland/capsize/tree/master
|
320
|
-
|
321
315
|
== Credits
|
322
316
|
|
323
317
|
The original code for this library was provided by Amazon Web Services, LLC as sample code. Thanks to them for providing all of us with something to get us started.
|
324
318
|
|
325
319
|
== Contact
|
326
320
|
|
327
|
-
Comments, patches, Git pull requests and bug reports are welcome. Send an email to mailto:glenn
|
321
|
+
Comments, patches, Git pull requests and bug reports are welcome. Send an email to mailto:glenn@nospam@rempe.us or use the Google Groups forum for this project.
|
328
322
|
|
329
323
|
Enjoy!
|
330
324
|
|
data/Rakefile
CHANGED
data/bin/ec2-gem-example.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# Amazon Web Services EC2 Query API Ruby library
|
4
4
|
#
|
5
5
|
# Ruby Gem Name:: amazon-ec2
|
6
|
-
# Author:: Glenn Rempe (mailto:
|
6
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
7
7
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
8
8
|
# License:: Distributes under the same terms as Ruby
|
9
|
-
# Home:: http://amazon-ec2
|
9
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
10
10
|
#++
|
11
11
|
|
12
12
|
require 'rubygems'
|
@@ -15,9 +15,9 @@ require 'pp'
|
|
15
15
|
|
16
16
|
# pull these from the local shell environment variables set in ~/.bash_login
|
17
17
|
# or using appropriate methods specific to your login shell.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# e.g. in ~/.bash_login
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# # For amazon-ec2 and amazon s3 ruby gems
|
22
22
|
# export AMAZON_ACCESS_KEY_ID="FOO"
|
23
23
|
# export AMAZON_SECRET_ACCESS_KEY="BAR"
|
@@ -38,7 +38,7 @@ p ec2.methods.sort
|
|
38
38
|
puts "----- listing images owned by 'amazon' -----"
|
39
39
|
ec2.describe_images(:owner_id => "amazon").imagesSet.item.each do |image|
|
40
40
|
image.keys.each do |key|
|
41
|
-
puts "#{key} => #{image[key]}"
|
41
|
+
puts "#{key} => #{image[key]}"
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -56,4 +56,3 @@ pp ec2.delete_security_group(:group_name => "ec2-example-rb-test-group")
|
|
56
56
|
|
57
57
|
puts "----- listing my keypairs (verbose mode) -----"
|
58
58
|
pp ec2.describe_keypairs()
|
59
|
-
|
data/bin/ec2sh
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# Amazon Web Services EC2 Query API Ruby library
|
4
4
|
#
|
5
5
|
# Ruby Gem Name:: amazon-ec2
|
6
|
-
# Author:: Glenn Rempe (mailto:
|
6
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
7
7
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
8
8
|
# License:: Distributes under the same terms as Ruby
|
9
|
-
# Home:: http://amazon-ec2
|
9
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
10
10
|
#++
|
11
11
|
|
12
12
|
# CREDITS : Credit for this bit of shameful ripoff coolness
|
data/bin/setup.rb
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
# Amazon Web Services EC2 Query API Ruby library
|
4
4
|
#
|
5
5
|
# Ruby Gem Name:: amazon-ec2
|
6
|
-
# Author:: Glenn Rempe (mailto:
|
6
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
7
7
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
8
8
|
# License:: Distributes under the same terms as Ruby
|
9
|
-
# Home:: http://amazon-ec2
|
9
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
10
10
|
#++
|
11
11
|
|
12
12
|
if ENV['AMAZON_ACCESS_KEY_ID'] && ENV['AMAZON_SECRET_ACCESS_KEY']
|
13
|
-
@ec2 = EC2::Base.new(
|
13
|
+
@ec2 = EC2::Base.new(
|
14
14
|
:access_key_id => ENV['AMAZON_ACCESS_KEY_ID'],
|
15
|
-
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
|
15
|
+
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
19
|
-
include EC2
|
19
|
+
include EC2
|
data/lib/EC2.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
%w[ base64 cgi openssl digest/sha1 net/https rexml/document time ostruct ].each { |f| require f }
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
@@ -14,8 +14,8 @@ module EC2
|
|
14
14
|
|
15
15
|
#Amazon Developer Guide Docs:
|
16
16
|
#
|
17
|
-
# The DescribeAvailabilityZones operation describes availability zones that are currently
|
18
|
-
# available to the account and their states.
|
17
|
+
# The DescribeAvailabilityZones operation describes availability zones that are currently
|
18
|
+
# available to the account and their states.
|
19
19
|
#
|
20
20
|
# An optional list of zone names can be passed.
|
21
21
|
#
|
@@ -39,4 +39,3 @@ module EC2
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
data/lib/EC2/console.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
@@ -41,4 +41,4 @@ module EC2
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
end
|
44
|
+
end
|
data/lib/EC2/elastic_ips.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
data/lib/EC2/exceptions.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
data/lib/EC2/image_attributes.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
data/lib/EC2/images.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
data/lib/EC2/instances.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
@@ -64,6 +64,7 @@ module EC2
|
|
64
64
|
# :user_data => String (default : nil)
|
65
65
|
# :addressing_type => String (default : "public")
|
66
66
|
# :instance_type => String (default : "m1.small")
|
67
|
+
# :kernel_id => String (default : nil)
|
67
68
|
# :availability_zone => String (default : nil)
|
68
69
|
# :base64_encoded => Boolean (default : false)
|
69
70
|
#
|
@@ -77,6 +78,7 @@ module EC2
|
|
77
78
|
:user_data => nil,
|
78
79
|
:addressing_type => "public",
|
79
80
|
:instance_type => "m1.small",
|
81
|
+
:kernel_id => nil,
|
80
82
|
:availability_zone => nil,
|
81
83
|
:base64_encoded => false }.merge(options)
|
82
84
|
|
@@ -111,6 +113,7 @@ module EC2
|
|
111
113
|
params["UserData"] = user_data unless user_data.nil?
|
112
114
|
params["AddressingType"] = options[:addressing_type]
|
113
115
|
params["InstanceType"] = options[:instance_type]
|
116
|
+
params["KernelId"] = options[:kernel_id] unless options[:kernel_id].nil?
|
114
117
|
params["Placement.AvailabilityZone"] = options[:availability_zone] unless options[:availability_zone].nil?
|
115
118
|
|
116
119
|
return response_generator(:action => "RunInstances", :params => params)
|
data/lib/EC2/keypairs.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
data/lib/EC2/products.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
@@ -40,4 +40,4 @@ module EC2
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
end
|
43
|
+
end
|
data/lib/EC2/responses.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
# This allows us to access hash values as if they were methods
|
@@ -49,13 +49,13 @@ module EC2
|
|
49
49
|
:xml => "",
|
50
50
|
:parse_options => { 'ForceArray' => ['item'], 'SuppressEmpty' => nil }
|
51
51
|
}.merge(options)
|
52
|
-
|
52
|
+
|
53
53
|
# NOTE: Parsing the response as a nested set of Response objects was extremely
|
54
54
|
# memory intensive and appeared to leak (the memory was not freed on subsequent requests).
|
55
55
|
# It was changed to return the raw XmlSimple response.
|
56
|
-
|
56
|
+
|
57
57
|
response = XmlSimple.xml_in(options[:xml], options[:parse_options])
|
58
|
-
|
58
|
+
|
59
59
|
return response
|
60
60
|
end
|
61
61
|
|
data/lib/EC2/security_groups.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
data/lib/EC2/snapshots.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Author:: Yann Klis (mailto:yann.klis@novelys.com)
|
6
6
|
# Copyright:: Copyright (c) 2008 Yann Klis
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
@@ -34,7 +34,7 @@ module EC2
|
|
34
34
|
return response_generator(:action => "DescribeSnapshots", :params => params)
|
35
35
|
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
#Amazon Developer Guide Docs:
|
39
39
|
#
|
40
40
|
# The CreateSnapshot operation creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You can use snapshots for backups, to launch instances from identical snapshots, and to save data before shutting down an instance.
|
@@ -47,12 +47,12 @@ module EC2
|
|
47
47
|
#
|
48
48
|
# none
|
49
49
|
#
|
50
|
-
|
50
|
+
|
51
51
|
def create_snapshot( options = {} )
|
52
52
|
|
53
53
|
# defaults
|
54
54
|
options = { :volume_id => '' }.merge(options)
|
55
|
-
|
55
|
+
|
56
56
|
raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
|
57
57
|
|
58
58
|
params = {
|
@@ -60,9 +60,9 @@ module EC2
|
|
60
60
|
}
|
61
61
|
|
62
62
|
return response_generator(:action => "CreateSnapshot", :params => params)
|
63
|
-
|
63
|
+
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
#Amazon Developer Guide Docs:
|
67
67
|
#
|
68
68
|
# The DeleteSnapshot operation deletes a snapshot of an Amazon EBS volume that is stored in Amazon S3.
|
@@ -75,11 +75,11 @@ module EC2
|
|
75
75
|
#
|
76
76
|
# none
|
77
77
|
#
|
78
|
-
|
78
|
+
|
79
79
|
def delete_snapshot( options = {} )
|
80
80
|
|
81
81
|
options = { :snapshot_id => '' }.merge(options)
|
82
|
-
|
82
|
+
|
83
83
|
raise ArgumentError, "No :snapshot_id provided" if options[:snapshot_id].nil? || options[:snapshot_id].empty?
|
84
84
|
|
85
85
|
params = {
|
@@ -87,9 +87,8 @@ module EC2
|
|
87
87
|
}
|
88
88
|
|
89
89
|
return response_generator(:action => "DeleteSnapshot", :params => params)
|
90
|
-
|
90
|
+
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
data/lib/EC2/volumes.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Author:: Yann Klis (mailto:yann.klis@novelys.com)
|
6
6
|
# Copyright:: Copyright (c) 2008 Yann Klis
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
@@ -34,7 +34,7 @@ module EC2
|
|
34
34
|
return response_generator(:action => "DescribeVolumes", :params => params)
|
35
35
|
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
#Amazon Developer Guide Docs:
|
39
39
|
#
|
40
40
|
# The CreateVolume operation creates a new Amazon EBS volume that you can mount from any Amazon EC2 instance.
|
@@ -48,14 +48,14 @@ module EC2
|
|
48
48
|
# :size => String (default : '')
|
49
49
|
# :snapshot_id => String (default : '')
|
50
50
|
#
|
51
|
-
|
51
|
+
|
52
52
|
def create_volume( options = {} )
|
53
53
|
|
54
54
|
# defaults
|
55
55
|
options = { :availability_zone => '' }.merge(options)
|
56
|
-
|
56
|
+
|
57
57
|
raise ArgumentError, "No :availability_zone provided" if options[:availability_zone].nil? || options[:availability_zone].empty?
|
58
|
-
|
58
|
+
|
59
59
|
options = { :size => '' }.merge(options)
|
60
60
|
options = { :snapshot_id => '' }.merge(options)
|
61
61
|
|
@@ -66,9 +66,9 @@ module EC2
|
|
66
66
|
}
|
67
67
|
|
68
68
|
return response_generator(:action => "CreateVolume", :params => params)
|
69
|
-
|
69
|
+
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
#Amazon Developer Guide Docs:
|
73
73
|
#
|
74
74
|
# The DeleteVolume operation deletes an Amazon EBS volume.
|
@@ -81,11 +81,11 @@ module EC2
|
|
81
81
|
#
|
82
82
|
# none
|
83
83
|
#
|
84
|
-
|
84
|
+
|
85
85
|
def delete_volume( options = {} )
|
86
86
|
|
87
87
|
options = { :volume_id => '' }.merge(options)
|
88
|
-
|
88
|
+
|
89
89
|
raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
|
90
90
|
|
91
91
|
params = {
|
@@ -93,9 +93,9 @@ module EC2
|
|
93
93
|
}
|
94
94
|
|
95
95
|
return response_generator(:action => "DeleteVolume", :params => params)
|
96
|
-
|
96
|
+
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
#Amazon Developer Guide Docs:
|
100
100
|
#
|
101
101
|
# The AttachVolume operation attaches an Amazon EBS volume to an instance.
|
@@ -110,17 +110,17 @@ module EC2
|
|
110
110
|
#
|
111
111
|
# none
|
112
112
|
#
|
113
|
-
|
113
|
+
|
114
114
|
def attach_volume( options = {} )
|
115
115
|
|
116
116
|
options = { :volume_id => '' }.merge(options)
|
117
117
|
options = { :instance_id => '' }.merge(options)
|
118
118
|
options = { :device => '' }.merge(options)
|
119
|
-
|
119
|
+
|
120
120
|
raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
|
121
121
|
raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
122
|
-
raise ArgumentError, "No :
|
123
|
-
|
122
|
+
raise ArgumentError, "No :device provided" if options[:device].nil? || options[:device].empty?
|
123
|
+
|
124
124
|
params = {
|
125
125
|
"VolumeId" => options[:volume_id],
|
126
126
|
"InstanceId" => options[:instance_id],
|
@@ -128,9 +128,9 @@ module EC2
|
|
128
128
|
}
|
129
129
|
|
130
130
|
return response_generator(:action => "AttachVolume", :params => params)
|
131
|
-
|
131
|
+
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
#Amazon Developer Guide Docs:
|
135
135
|
#
|
136
136
|
# The DetachVolume operation detaches an Amazon EBS volume from an instance.
|
@@ -145,17 +145,17 @@ module EC2
|
|
145
145
|
# :device => String (default : '')
|
146
146
|
# :force => Boolean (default : '')
|
147
147
|
#
|
148
|
-
|
148
|
+
|
149
149
|
def detach_volume( options = {} )
|
150
150
|
|
151
151
|
options = { :volume_id => '' }.merge(options)
|
152
|
-
|
152
|
+
|
153
153
|
raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
|
154
|
-
|
154
|
+
|
155
155
|
options = { :instance_id => '' }.merge(options)
|
156
156
|
options = { :device => '' }.merge(options)
|
157
157
|
options = { :force => '' }.merge(options)
|
158
|
-
|
158
|
+
|
159
159
|
params = {
|
160
160
|
"VolumeId" => options[:volume_id],
|
161
161
|
"InstanceId" => options[:instance_id],
|
@@ -164,8 +164,7 @@ module EC2
|
|
164
164
|
}
|
165
165
|
|
166
166
|
return response_generator(:action => "DetachVolume", :params => params)
|
167
|
-
|
167
|
+
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
171
|
-
|
data/test/test_EC2.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
@@ -28,7 +28,7 @@ context "EC2 availability zones" do
|
|
28
28
|
</item>
|
29
29
|
</availabilityZoneInfo>
|
30
30
|
</DescribeAvailabilityZonesResponse>
|
31
|
-
|
31
|
+
RESPONSE
|
32
32
|
|
33
33
|
end
|
34
34
|
|
data/test/test_EC2_console.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
@@ -51,4 +51,4 @@ context "The EC2 console " do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
|
54
|
-
end
|
54
|
+
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
@@ -235,4 +235,4 @@ context "EC2 image_attributes " do
|
|
235
235
|
end
|
236
236
|
|
237
237
|
|
238
|
-
end
|
238
|
+
end
|
data/test/test_EC2_images.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
data/test/test_EC2_instances.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
@@ -30,7 +30,7 @@ context "EC2 instances " do
|
|
30
30
|
<imageId>ami-60a54009</imageId>
|
31
31
|
<instanceState>
|
32
32
|
<code>0</code>
|
33
|
-
|
33
|
+
<name>pending</name>
|
34
34
|
</instanceState>
|
35
35
|
<privateDnsName></privateDnsName>
|
36
36
|
<dnsName></dnsName>
|
@@ -44,7 +44,7 @@ context "EC2 instances " do
|
|
44
44
|
<imageId>ami-60a54009</imageId>
|
45
45
|
<instanceState>
|
46
46
|
<code>0</code>
|
47
|
-
|
47
|
+
<name>pending</name>
|
48
48
|
</instanceState>
|
49
49
|
<privateDnsName></privateDnsName>
|
50
50
|
<dnsName></dnsName>
|
@@ -58,7 +58,7 @@ context "EC2 instances " do
|
|
58
58
|
<imageId>ami-60a54009</imageId>
|
59
59
|
<instanceState>
|
60
60
|
<code>0</code>
|
61
|
-
|
61
|
+
<name>pending</name>
|
62
62
|
</instanceState>
|
63
63
|
<privateDnsName></privateDnsName>
|
64
64
|
<dnsName></dnsName>
|
@@ -232,6 +232,11 @@ context "EC2 instances " do
|
|
232
232
|
@ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :group_id => [], :user_data => "foo", :base64_encoded => true ).should.be.an.instance_of Hash
|
233
233
|
end
|
234
234
|
|
235
|
+
specify "should be able specify an kernel_id" do
|
236
|
+
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Placement.AvailabilityZone" => "zone123", "UserData" => "foo", "AddressingType" => 'public', 'InstanceType' => 'm1.small', 'KernelId' => 'kernfoo').
|
237
|
+
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
238
|
+
@ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :availability_zone => "zone123", :group_id => [], :user_data => "foo", :base64_encoded => true, :kernel_id => 'kernfoo' ).should.be.an.instance_of Hash
|
239
|
+
end
|
235
240
|
|
236
241
|
specify "should be able to call run_instances with :user_data and :base64_encoded => false" do
|
237
242
|
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "UserData" => "Zm9v", "AddressingType" => 'public', 'InstanceType' => 'm1.small').
|
data/test/test_EC2_keypairs.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
data/test/test_EC2_products.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
data/test/test_EC2_responses.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
data/test/test_EC2_snapshots.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Author:: Yann Klis (mailto:yann.klis@novelys.com)
|
6
6
|
# Copyright:: Copyright (c) 2008 Yann Klis
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
data/test/test_EC2_volumes.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Author:: Yann Klis (mailto:yann.klis@novelys.com)
|
6
6
|
# Copyright:: Copyright (c) 2008 Yann Klis
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
@@ -85,8 +85,7 @@ context "EC2 volumes " do
|
|
85
85
|
|
86
86
|
response = @ec2.describe_volumes( :volume_id => ["vol-4282672b"] )
|
87
87
|
response.volumeSet.item[0].volumeId.should.equal "vol-4282672b"
|
88
|
-
|
89
|
-
# response.volumeSet.item[0].size.should.equal "800"
|
88
|
+
response.volumeSet.item[0].attachmentSet.item[0]['size'].should.equal "800"
|
90
89
|
response.volumeSet.item[0].attachmentSet.item[0].volumeId.should.equal "vol-4282672b"
|
91
90
|
response.volumeSet.item[0].attachmentSet.item[0].instanceId.should.equal "i-6058a509"
|
92
91
|
end
|
@@ -99,8 +98,7 @@ context "EC2 volumes " do
|
|
99
98
|
|
100
99
|
response = @ec2.create_volume( :availability_zone => "us-east-1a", :size => "800" )
|
101
100
|
response.volumeId.should.equal "vol-4d826724"
|
102
|
-
|
103
|
-
# response.size.should.equal "800"
|
101
|
+
response['size'].should.equal "800"
|
104
102
|
response.status.should.equal "creating"
|
105
103
|
response.zone.should.equal "us-east-1a"
|
106
104
|
end
|
data/test/test_helper.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
%w[ test/unit rubygems test/spec mocha ].each { |f|
|
@@ -17,4 +17,3 @@
|
|
17
17
|
}
|
18
18
|
|
19
19
|
require File.dirname(__FILE__) + '/../lib/EC2'
|
20
|
-
|