Class: EC2::TerminateInstancesResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/EC2/responses.rb

Constant Summary collapse

ELEMENT_XPATH =
"TerminateInstancesResponse/instancesSet/item"

Constants inherited from Response

Response::ERROR_XPATH

Instance Attribute Summary

Attributes inherited from Response

#http_response, #http_xml, #structure

Instance Method Summary collapse

Methods inherited from Response

#initialize, #is_error?, #parse_error, #to_s

Constructor Details

This class inherits a constructor from EC2::Response

Instance Method Details

#parseObject



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/EC2/responses.rb', line 208

def parse
  doc = REXML::Document.new(@http_xml)
  lines = []
  
  doc.elements.each(ELEMENT_XPATH) do |element|
    instanceId = REXML::XPath.first(element, "instanceId").text
    shutdownState = REXML::XPath.first(element, "shutdownState/name").text
    # Only for debug mode, which we don't support yet:
    shutdownStateCode = REXML::XPath.first(element, "shutdownState/code").text
    previousState = REXML::XPath.first(element, "previousState/name").text
    # Only for debug mode, which we don't support yet:
    previousStateCode = REXML::XPath.first(element, "previousState/code").text
    lines << ["INSTANCE", instanceId, previousState, shutdownState]
  end
  lines
end