amazon-ec2 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,21 @@
1
1
  =CHANGELOG.txt : Amazon Elastic Compute Cloud (EC2) Ruby Gem
2
2
 
3
+
4
+ ===0.0.4 (12/16/2006)
5
+ * Applied patch from Kevin Clark to svn version 7. Thanks for the
6
+ patch and the description Kevin! Please report if you
7
+ encounter any issues with this patched version. Here is Kevin's
8
+ description which I requested : "It helps me to think of modules as boxes full of classes and
9
+ methods. REXML is a module which holds various classes related to parsing XML
10
+ including REXML::Node, REXML::Document and REXML::XPath. When you
11
+ include a module it takes everything out of the box and places it in
12
+ the local context. So, when you include REXML in the global namespace
13
+ on line 27 of EC2.rb, it includes classes called Node, Document and XPath in the
14
+ global object space. This means that I can't have a class called Node
15
+ in my own project (which I do). The library would be a much better
16
+ neighbor if it instead accessed the REXML::Document and REXML::XPath
17
+ classes explicitly through the module."
18
+
3
19
  ===0.0.3 (12/16/2006)
4
20
  * API CHANGE : Changed method name 'authorize' to 'authorize_security_group_ingress' to ensure consistent
5
21
  naming of Ruby library methods to match AWS EC2 API actions. Alias to 'authorize' for backwards compatibility.
@@ -1,3 +1 @@
1
1
  =History.txt : Amazon Elastic Compute Cloud (EC2) Ruby Gem
2
-
3
- ==Version History
data/lib/EC2.rb CHANGED
@@ -24,8 +24,6 @@ require 'net/https'
24
24
  require 'rexml/document'
25
25
  require 'time'
26
26
 
27
- include REXML
28
-
29
27
  # Require any lib files that we have bundled with this Ruby Gem in the lib/EC2 directory.
30
28
  # Parts of the EC2 module and AWSAuthConnection class are broken out into separate
31
29
  # files for maintainability and are organized by the functional groupings defined
@@ -32,11 +32,11 @@ module EC2
32
32
  end
33
33
 
34
34
  def parse_error
35
- doc = Document.new(@http_xml)
36
- element = XPath.first(doc, ERROR_XPATH)
35
+ doc = REXML::Document.new(@http_xml)
36
+ element = REXML::XPath.first(doc, ERROR_XPATH)
37
37
 
38
- errorCode = XPath.first(element, "Code").text
39
- errorMessage = XPath.first(element, "Message").text
38
+ errorCode = REXML::XPath.first(element, "Code").text
39
+ errorMessage = REXML::XPath.first(element, "Message").text
40
40
 
41
41
  [["#{errorCode}: #{errorMessage}"]]
42
42
  end
@@ -58,15 +58,15 @@ module EC2
58
58
  class DescribeImagesResponse < Response
59
59
  ELEMENT_XPATH = "DescribeImagesResponse/imagesSet/item"
60
60
  def parse
61
- doc = Document.new(@http_xml)
61
+ doc = REXML::Document.new(@http_xml)
62
62
  lines = []
63
63
 
64
64
  doc.elements.each(ELEMENT_XPATH) do |element|
65
- imageId = XPath.first(element, "imageId").text
66
- imageLocation = XPath.first(element, "imageLocation").text
67
- imageOwnerId = XPath.first(element, "imageOwnerId").text
68
- imageState = XPath.first(element, "imageState").text
69
- isPublic = XPath.first(element, "isPublic").text
65
+ imageId = REXML::XPath.first(element, "imageId").text
66
+ imageLocation = REXML::XPath.first(element, "imageLocation").text
67
+ imageOwnerId = REXML::XPath.first(element, "imageOwnerId").text
68
+ imageState = REXML::XPath.first(element, "imageState").text
69
+ isPublic = REXML::XPath.first(element, "isPublic").text
70
70
  lines << ["IMAGE", imageId, imageLocation, imageOwnerId, imageState, isPublic]
71
71
  end
72
72
  lines
@@ -77,8 +77,8 @@ module EC2
77
77
  class RegisterImageResponse < Response
78
78
  ELEMENT_XPATH = "RegisterImageResponse/imageId"
79
79
  def parse
80
- doc = Document.new(@http_xml)
81
- lines = [["IMAGE", XPath.first(doc, ELEMENT_XPATH).text]]
80
+ doc = REXML::Document.new(@http_xml)
81
+ lines = [["IMAGE", REXML::XPath.first(doc, ELEMENT_XPATH).text]]
82
82
  end
83
83
  end
84
84
 
@@ -94,12 +94,12 @@ module EC2
94
94
  class CreateKeyPairResponse < Response
95
95
  ELEMENT_XPATH = "CreateKeyPairResponse"
96
96
  def parse
97
- doc = Document.new(@http_xml)
98
- element = XPath.first(doc, ELEMENT_XPATH)
97
+ doc = REXML::Document.new(@http_xml)
98
+ element = REXML::XPath.first(doc, ELEMENT_XPATH)
99
99
 
100
- keyName = XPath.first(element, "keyName").text
101
- keyFingerprint = XPath.first(element, "keyFingerprint").text
102
- keyMaterial = XPath.first(element, "keyMaterial").text
100
+ keyName = REXML::XPath.first(element, "keyName").text
101
+ keyFingerprint = REXML::XPath.first(element, "keyFingerprint").text
102
+ keyMaterial = REXML::XPath.first(element, "keyMaterial").text
103
103
 
104
104
  line = [["KEYPAIR", keyName, keyFingerprint], [keyMaterial]]
105
105
  end
@@ -109,12 +109,12 @@ module EC2
109
109
  class DescribeKeyPairsResponse < Response
110
110
  ELEMENT_XPATH = "DescribeKeyPairsResponse/keySet/item"
111
111
  def parse
112
- doc = Document.new(@http_xml)
112
+ doc = REXML::Document.new(@http_xml)
113
113
  lines = []
114
114
 
115
115
  doc.elements.each(ELEMENT_XPATH) do |element|
116
- keyName = XPath.first(element, "keyName").text
117
- keyFingerprint = XPath.first(element, "keyFingerprint").text
116
+ keyName = REXML::XPath.first(element, "keyName").text
117
+ keyFingerprint = REXML::XPath.first(element, "keyFingerprint").text
118
118
  lines << ["KEYPAIR", keyName, keyFingerprint]
119
119
  end
120
120
  lines
@@ -133,13 +133,13 @@ module EC2
133
133
  class RunInstancesResponse < Response
134
134
  ELEMENT_XPATH = "RunInstancesResponse"
135
135
  def parse
136
- doc = Document.new(@http_xml)
136
+ doc = REXML::Document.new(@http_xml)
137
137
  lines = []
138
138
 
139
- rootelement = XPath.first(doc, ELEMENT_XPATH)
139
+ rootelement = REXML::XPath.first(doc, ELEMENT_XPATH)
140
140
 
141
- reservationId = XPath.first(rootelement, "reservationId").text
142
- ownerId = XPath.first(rootelement, "ownerId").text
141
+ reservationId = REXML::XPath.first(rootelement, "reservationId").text
142
+ ownerId = REXML::XPath.first(rootelement, "ownerId").text
143
143
  groups = nil
144
144
  rootelement.elements.each("groupSet/item/groupId") do |element|
145
145
  if not groups
@@ -150,16 +150,16 @@ module EC2
150
150
  end
151
151
  lines << ["RESERVATION", reservationId, ownerId, groups]
152
152
 
153
- # rootelement = XPath.first(doc, ELEMENT_XPATH)
153
+ # rootelement = REXML::XPath.first(doc, ELEMENT_XPATH)
154
154
  rootelement.elements.each("instancesSet/item") do |element|
155
- instanceId = XPath.first(element, "instanceId").text
156
- imageId = XPath.first(element, "imageId").text
157
- instanceState = XPath.first(element, "instanceState/name").text
155
+ instanceId = REXML::XPath.first(element, "instanceId").text
156
+ imageId = REXML::XPath.first(element, "imageId").text
157
+ instanceState = REXML::XPath.first(element, "instanceState/name").text
158
158
  # Only for debug mode, which we don't support yet:
159
- instanceStateCode = XPath.first(element, "instanceState/code").text
160
- dnsName = XPath.first(element, "dnsName").text
159
+ instanceStateCode = REXML::XPath.first(element, "instanceState/code").text
160
+ dnsName = REXML::XPath.first(element, "dnsName").text
161
161
  # We don't return this, but still:
162
- reason = XPath.first(element, "reason").text
162
+ reason = REXML::XPath.first(element, "reason").text
163
163
  lines << ["INSTANCE", instanceId, imageId, dnsName, instanceState]
164
164
  end
165
165
  lines
@@ -170,12 +170,12 @@ module EC2
170
170
  class DescribeInstancesResponse < Response
171
171
  ELEMENT_XPATH = "DescribeInstancesResponse/reservationSet/item"
172
172
  def parse
173
- doc = Document.new(@http_xml)
173
+ doc = REXML::Document.new(@http_xml)
174
174
  lines = []
175
175
 
176
176
  doc.elements.each(ELEMENT_XPATH) do |rootelement|
177
- reservationId = XPath.first(rootelement, "reservationId").text
178
- ownerId = XPath.first(rootelement, "ownerId").text
177
+ reservationId = REXML::XPath.first(rootelement, "reservationId").text
178
+ ownerId = REXML::XPath.first(rootelement, "ownerId").text
179
179
  groups = nil
180
180
  rootelement.elements.each("groupSet/item/groupId") do |element|
181
181
  if not groups
@@ -187,14 +187,14 @@ module EC2
187
187
  lines << ["RESERVATION", reservationId, ownerId, groups]
188
188
 
189
189
  rootelement.elements.each("instancesSet/item") do |element|
190
- instanceId = XPath.first(element, "instanceId").text
191
- imageId = XPath.first(element, "imageId").text
192
- instanceState = XPath.first(element, "instanceState/name").text
190
+ instanceId = REXML::XPath.first(element, "instanceId").text
191
+ imageId = REXML::XPath.first(element, "imageId").text
192
+ instanceState = REXML::XPath.first(element, "instanceState/name").text
193
193
  # Only for debug mode, which we don't support yet:
194
- instanceStateCode = XPath.first(element, "instanceState/code").text
195
- dnsName = XPath.first(element, "dnsName").text
194
+ instanceStateCode = REXML::XPath.first(element, "instanceState/code").text
195
+ dnsName = REXML::XPath.first(element, "dnsName").text
196
196
  # We don't return this, but still:
197
- reason = XPath.first(element, "reason").text
197
+ reason = REXML::XPath.first(element, "reason").text
198
198
  lines << ["INSTANCE", instanceId, imageId, dnsName, instanceState]
199
199
  end
200
200
  end
@@ -206,17 +206,17 @@ module EC2
206
206
  class TerminateInstancesResponse < Response
207
207
  ELEMENT_XPATH = "TerminateInstancesResponse/instancesSet/item"
208
208
  def parse
209
- doc = Document.new(@http_xml)
209
+ doc = REXML::Document.new(@http_xml)
210
210
  lines = []
211
211
 
212
212
  doc.elements.each(ELEMENT_XPATH) do |element|
213
- instanceId = XPath.first(element, "instanceId").text
214
- shutdownState = XPath.first(element, "shutdownState/name").text
213
+ instanceId = REXML::XPath.first(element, "instanceId").text
214
+ shutdownState = REXML::XPath.first(element, "shutdownState/name").text
215
215
  # Only for debug mode, which we don't support yet:
216
- shutdownStateCode = XPath.first(element, "shutdownState/code").text
217
- previousState = XPath.first(element, "previousState/name").text
216
+ shutdownStateCode = REXML::XPath.first(element, "shutdownState/code").text
217
+ previousState = REXML::XPath.first(element, "previousState/name").text
218
218
  # Only for debug mode, which we don't support yet:
219
- previousStateCode = XPath.first(element, "previousState/code").text
219
+ previousStateCode = REXML::XPath.first(element, "previousState/code").text
220
220
  lines << ["INSTANCE", instanceId, previousState, shutdownState]
221
221
  end
222
222
  lines
@@ -235,18 +235,18 @@ module EC2
235
235
  class DescribeSecurityGroupsResponse < Response
236
236
  ELEMENT_XPATH = "DescribeSecurityGroupsResponse/securityGroupInfo/item"
237
237
  def parse
238
- doc = Document.new(@http_xml)
238
+ doc = REXML::Document.new(@http_xml)
239
239
  lines = []
240
240
 
241
241
  doc.elements.each(ELEMENT_XPATH) do |rootelement|
242
- groupName = XPath.first(rootelement, "groupName").text
243
- ownerId = XPath.first(rootelement, "ownerId").text
244
- groupDescription = XPath.first(rootelement, "groupDescription").text
242
+ groupName = REXML::XPath.first(rootelement, "groupName").text
243
+ ownerId = REXML::XPath.first(rootelement, "ownerId").text
244
+ groupDescription = REXML::XPath.first(rootelement, "groupDescription").text
245
245
  lines << ["GROUP", ownerId, groupName, groupDescription]
246
246
  rootelement.elements.each("ipPermissions/item") do |element|
247
- ipProtocol = XPath.first(element, "ipProtocol").text
248
- fromPort = XPath.first(element, "fromPort").text
249
- toPort = XPath.first(element, "toPort").text
247
+ ipProtocol = REXML::XPath.first(element, "ipProtocol").text
248
+ fromPort = REXML::XPath.first(element, "fromPort").text
249
+ toPort = REXML::XPath.first(element, "toPort").text
250
250
  permArr = [
251
251
  "PERMISSION",
252
252
  ownerId,
@@ -258,12 +258,12 @@ module EC2
258
258
  "FROM"
259
259
  ]
260
260
  element.elements.each("groups/item") do |subelement|
261
- userId = XPath.first(subelement, "userId").text
262
- targetGroupName = XPath.first(subelement, "groupName").text
261
+ userId = REXML::XPath.first(subelement, "userId").text
262
+ targetGroupName = REXML::XPath.first(subelement, "groupName").text
263
263
  lines << permArr + ["USER", userId, "GRPNAME", targetGroupName]
264
264
  end
265
265
  element.elements.each("ipRanges/item") do |subelement|
266
- cidrIp = XPath.first(subelement, "cidrIp").text
266
+ cidrIp = REXML::XPath.first(subelement, "cidrIp").text
267
267
  lines << permArr + ["CIDR", cidrIp]
268
268
  end
269
269
  end
@@ -316,11 +316,11 @@ module EC2
316
316
  class DescribeImageAttributeResponse < Response
317
317
  ELEMENT_XPATH = "DescribeImageAttributeResponse"
318
318
  def parse
319
- doc = Document.new(@http_xml)
319
+ doc = REXML::Document.new(@http_xml)
320
320
  lines = []
321
321
 
322
- rootelement = XPath.first(doc, ELEMENT_XPATH)
323
- imageId = XPath.first(rootelement, "imageId").text
322
+ rootelement = REXML::XPath.first(doc, ELEMENT_XPATH)
323
+ imageId = REXML::XPath.first(rootelement, "imageId").text
324
324
 
325
325
  # Handle launchPermission attributes:
326
326
  rootelement.elements.each("launchPermission/item/*") do |element|
@@ -2,7 +2,7 @@ module EC2 #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: amazon-ec2
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.3
7
- date: 2006-12-16 00:00:00 -08:00
6
+ version: 0.0.4
7
+ date: 2006-12-21 00:00:00 -08:00
8
8
  summary: An interface library that allows Ruby or Ruby on Rails applications to easily connect to the HTTP 'Query API' for the Amazon Web Services Elastic Compute Cloud (EC2) and manipulate server instances.
9
9
  require_paths:
10
10
  - lib