Class: Fog::Parsers::AWS::ELBV2::DescribeListeners

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

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object



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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/fog/aws/parsers/elbv2/describe_listeners.rb', line 36

def end_element(name)
  if @in_default_actions
    case name
    when 'member'
      if @in_target_groups
        @target_groups << @target_group
        @target_group = {}
      else
        @listener['DefaultActions'] << @default_action
        @default_action = {}
      end
    when 'TargetGroupArn'
      if @in_target_groups
        @target_group[name] = value
      else
        @default_action[name] = value
      end
    when 'Weight'
      @target_group[name] = value
    when 'Type', 'Order'
      @default_action[name] = value
    when 'Path', 'Protocol', 'Port', 'Query', 'Host', 'StatusCode', 'ContentType',
         'MessageBody', 'StatusCode'
      @config[name] = value
    when 'RedirectConfig', 'ForwardConfig', 'FixedResponseConfig'
      @default_action[name] = @config
      @config = {}
    when 'DurationSeconds', 'Enabled'
      @target_group_stickiness_config[name] = value
    when 'DefaultActions'
      @in_default_actions = false
    when 'TargetGroupStickinessConfig'
      if @in_target_group_stickiness_config
        @config['TargetGroupStickinessConfig'] = @target_group_stickiness_config
        @in_target_group_stickiness_config = false
        @target_group_stickiness_config = {}
      end
    when 'TargetGroups'
      @config['TargetGroups'] = @target_groups
      @in_target_groups = false
      @target_groups = []
    end
  else
    case name
    when 'member'
      if @in_certificates
        @listener['Certificates'] << @certificate
        @certificate = {}
      else
        @results['Listeners'] << @listener
        reset_listener
      end
    when 'LoadBalancerArn', 'Protocol', 'Port', 'ListenerArn', 'SslPolicy'
      @listener[name] = value
    when 'CertificateArn'
      @certificate[name] = value
    when 'Certificates'
      @in_certificates = false

    when 'RequestId'
      @response['ResponseMetadata'][name] = value

    when 'NextMarker'
      @results['NextMarker'] = value

    when 'DescribeListenersResponse'
      @response['DescribeListenersResult'] = @results
    end
  end
end

#resetObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/aws/parsers/elbv2/describe_listeners.rb', line 6

def reset
  reset_listener
  @default_action = {}
  @certificate = {}
  @config = {}
  @target_groups = []
  @target_group = {}
  @target_group_stickiness_config = {}
  @results = { 'Listeners' => [] }
  @response = { 'DescribeListenersResult' => {}, 'ResponseMetadata' => {} }
end

#reset_listenerObject



18
19
20
# File 'lib/fog/aws/parsers/elbv2/describe_listeners.rb', line 18

def reset_listener
  @listener= { 'DefaultActions' => [], 'Certificates' => [] }
end

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



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fog/aws/parsers/elbv2/describe_listeners.rb', line 22

def start_element(name, attrs = [])
  super
  case name
  when 'DefaultActions'
    @in_default_actions = true
  when 'Certificates'
    @in_certificates = true
  when 'TargetGroups'
    @in_target_groups = true
  when 'TargetGroupStickinessConfig'
    @in_target_group_stickiness_config = true
  end
end