Class: Fog::Parsers::AWS::ECS::Task

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

Direct Known Subclasses

DescribeTasks, RunTask, StartTask, StopTask

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
71
72
# File 'lib/fog/aws/parsers/ecs/task.rb', line 15

def end_element(name)
  super
  case name
  when 'containerOverrides'
    @task['overrides'] ||= {}
    @task['overrides'][name] = @container_overrides
    @context.pop
  when 'task'
    @response[@result][name] = @task
  when *@contexts
    @context.pop
  when 'member'
    case @context.last
    when 'tasks'
      @response[@result]['tasks'] << @task
      @task = {}
    when 'containers'
      @task['containers'] ||= []
      @task['containers'] << @container
      @container = {}
    when 'networkBindings'
      @container['networkBindings'] ||= []
      @container['networkBindings'] << @net_binding
      @net_binding = {}
    when 'failures'
      @response[@result]['failures'] << @failure
      @failure = {}
    end
  when 'clusterArn', 'desiredStatus', 'startedBy', 'containerInstanceArn', 'taskDefinitionArn'
    @task[name] = value
  when 'taskArn', 'lastStatus'
    case @context.last
    when 'tasks'
      @task[name] = value
    when 'containers'
      @container[name] = value
    end
  when 'containerArn'
    @container[name] = value
  when 'exitCode'
    @container[name] = value.to_i
  when 'name'
    case @context.last
    when 'containers'
      @container[name] = value
    when 'containerOverrides'
      @container_overrides << value
    end
  when 'networkBindings'
    @container[name] = @net_bindings
  when 'bindIP'
    @net_binding[name] = value
  when 'hostPort', 'containerPort'
    @net_binding[name] = value.to_i
  when 'arn', 'reason'
    @failure[name] = value
  end
end

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



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

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