Class: Fog::Parsers::AWS::ECS::DescribeClusters

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

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fog/aws/parsers/ecs/describe_clusters.rb', line 27

def end_element(name)
  super
  case name
  when 'clusterName', 'clusterArn', 'status'
    @cluster[name] = value
  when 'arn', 'reason'
    @failure[name] = value
  when 'member'
    case @context.last
    when 'clusters'
      @clusters << @cluster unless @cluster.empty?
      @cluster = {}
    when 'failures'
      @failures << @failure unless @failure.empty?
      @failure = {}
    end
  when 'clusters'
    @response[@result][name] = @clusters
    @context.pop
  when 'failures'
    @response[@result][name] = @failures
    @context.pop
  end
end

#resetObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/aws/parsers/ecs/describe_clusters.rb', line 8

def reset
  super
  @result = 'DescribeClustersResult'
  @response[@result] = {}
  @contexts = %w(failures clusters)
  @context  = []
  @clusters = []
  @failures = []
  @cluster  = {}
  @failure  = {}
end

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



20
21
22
23
24
25
# File 'lib/fog/aws/parsers/ecs/describe_clusters.rb', line 20

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