Class: Fog::Parsers::Compute::AWS::DescribeInstanceStatus

Inherits:
Base
  • Object
show all
Defined in:
lib/fog/aws/parsers/compute/describe_instance_status.rb

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from Base

#attr_value, #characters, #initialize, #value

Constructor Details

This class inherits a constructor from Fog::Parsers::Base

Instance Method Details

#end_element(name) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 32

def end_element(name)
  if @in_events_set
    case name
    when 'code', 'description'
      @event[name] = value
    when 'notAfter', 'notBefore'
      @event[name] = Time.parse(value)
    when 'item'
      @instance['eventsSet'] << @event
      new_event
    when 'eventsSet'
      @in_events_set = false
    end
  else
    case name
    when 'instanceId', 'availabilityZone'
      @instance[name] = value
    when 'name', 'code'
      @instance['instanceState'][name] = value
    when 'item'
      @response['instanceStatusSet'] << @instance
      new_instance
    when 'requestId'
      @response[name] = value

    end
  end
end

#new_eventObject



11
12
13
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 11

def new_event
  @event = {}
end

#new_instanceObject



7
8
9
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 7

def new_instance
  @instance = { 'eventsSet' => [], 'instanceState' => {} }
end

#resetObject



15
16
17
18
19
20
21
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 15

def reset
  @instance_status = {}
  @response = { 'instanceStatusSet' => [] }
  @in_events_set = false
  new_event
  new_instance
end

#start_element(name, attrs = []) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/fog/aws/parsers/compute/describe_instance_status.rb', line 23

def start_element(name, attrs=[])
  super
  case name
  when 'eventsSet'
    @in_events_set = true
  end
end