Class: Aws::Ec2::QEc2DescribeSnapshotsParser

Inherits:
AwsParser
  • Object
show all
Defined in:
lib/ec2/ec2.rb

Overview


PARSERS: EBS - Snapshots

Constant Summary

Constants inherited from AwsParser

AwsParser::DEFAULT_XML_LIBRARY

Instance Attribute Summary

Attributes inherited from AwsParser

#result, #xml_lib, #xmlpath

Instance Method Summary collapse

Methods inherited from AwsParser

#method_missing, #parse, #tag_end, #tag_start, #tagtext, #text, xml_lib, xml_lib=

Constructor Details

#initialize(params = {}) ⇒ QEc2DescribeSnapshotsParser

:nodoc:



2192
2193
2194
2195
# File 'lib/ec2/ec2.rb', line 2192

def initialize (params={})
  @inside_tagset = false
  super(params)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Aws::AwsParser

Instance Method Details

#resetObject



2235
2236
2237
# File 'lib/ec2/ec2.rb', line 2235

def reset
  @result = []
end

#tagend(name) ⇒ Object



2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
# File 'lib/ec2/ec2.rb', line 2206

def tagend(name)
  case name
    when 'volumeId' then
      @snapshot[:aws_volume_id] = @text
    when 'snapshotId' then
      @snapshot[:aws_id] = @text
    when 'status' then
      @snapshot[:aws_status] = @text
    when 'startTime' then
      @snapshot[:aws_started_at] = Time.parse(@text)
    when 'progress' then
      @snapshot[:aws_progress] = @text
    when 'description' then
      @snapshot[:aws_description] = @text
    when 'ownerId' then
      @snapshot[:aws_owner] = @text
    when 'volumeSize' then
      @snapshot[:aws_volume_size] = @text.to_i
    when 'tagSet' then
      @inside_tagset = false
    when 'key' then
      @key = ('aws_tag_' + @text).to_sym
    when 'value' then
      @snapshot[@key] = @text
    when 'item' then
      @result << @snapshot unless @inside_tagset
  end
end

#tagstart(name, attributes) ⇒ Object



2197
2198
2199
2200
2201
2202
2203
2204
# File 'lib/ec2/ec2.rb', line 2197

def tagstart(name, attributes)
  case name
    when 'tagSet'
      @inside_tagset = true
    when 'item'
      @snapshot = {} unless @inside_tagset
  end
end