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:



2426
2427
2428
2429
# File 'lib/ec2/ec2.rb', line 2426

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



2469
2470
2471
# File 'lib/ec2/ec2.rb', line 2469

def reset
  @result = []
end

#tagend(name) ⇒ Object



2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
# File 'lib/ec2/ec2.rb', line 2440

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



2431
2432
2433
2434
2435
2436
2437
2438
# File 'lib/ec2/ec2.rb', line 2431

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