Class: Fog::Parsers::AWS::ECS::ContainerInstance

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

Instance Method Summary collapse

Methods inherited from Base

#reset

Instance Method Details

#end_element(name) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fog/aws/parsers/ecs/container_instance.rb', line 15

def end_element(name)
  super
  case name
  when 'stringSetValue'
    @context.pop
    case @context.last
    when 'remainingResources'
      @remaining_resource[name] = @string_set
    when 'registeredResources'
      @registered_resource[name] = @string_set
    end
    @string_set = []
  when *@contexts
    @context.pop
  when 'member'
    case @context.last
    when 'remainingResources'
      @container_instance['remainingResources'] ||= []
      @container_instance['remainingResources'] << @remaining_resource
      @remaining_resource = {}
    when 'registeredResources'
      @container_instance['registeredResources'] ||= []
      @container_instance['registeredResources'] << @registered_resource
      @registered_resource = {}
    when 'stringSetValue'
      @string_set << value.to_i
    end
  when 'longValue', 'integerValue'
    case @context.last
    when 'remainingResources'
      @remaining_resource[name] = value.to_i
    when 'registeredResources'
      @registered_resource[name] = value.to_i
    end
  when 'doubleValue'
    case @context.last
    when 'remainingResources'
      @remaining_resource[name] = value.to_f
    when 'registeredResources'
      @registered_resource[name] = value.to_f
    end
  when 'name', 'type'
    case @context.last
    when 'remainingResources'
      @remaining_resource[name] = value
    when 'registeredResources'
      @registered_resource[name] = value
    end
  when 'agentConnected'
    @container_instance[name] = value == 'true'
  when 'runningTasksCount', 'pendingTasksCount'
    @container_instance[name] = value.to_i
  when 'status', 'containerInstanceArn', 'ec2InstanceId'
    @container_instance[name] = value
  end
end

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



8
9
10
11
12
13
# File 'lib/fog/aws/parsers/ecs/container_instance.rb', line 8

def start_element(name, attrs = [])
  super
  if @contexts.include?(name)
    @context.push(name)
  end
end