1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/parsers/elb/describe_load_balancer_attributes.rb
Josh Lane d48d376e9c initial import
* take the liberty of correcting Aws naming
2014-12-31 09:17:51 -08:00

54 lines
2 KiB
Ruby

module Fog
module Parsers
module AWS
module ELB
class DescribeLoadBalancerAttributes < Fog::Parsers::Base
def reset
@response = { 'DescribeLoadBalancerAttributesResult' => { 'LoadBalancerAttributes' => {} }, 'ResponseMetadata' => {} }
@stack = []
end
def start_element(name, attrs = [])
super
case name
when 'ConnectionDraining'
@connection_draining = {}
when 'CrossZoneLoadBalancing'
@cross_zone_load_balancing = {}
when 'ConnectionSettings'
@connection_settings = {}
end
end
def end_element(name)
case name
when 'Enabled'
if @cross_zone_load_balancing
@cross_zone_load_balancing['Enabled'] = value == 'true' ? true : false
elsif @connection_draining
@connection_draining['Enabled'] = value == 'true' ? true : false
end
when 'IdleTimeout'
@connection_settings['IdleTimeout'] = value.to_i
when 'Timeout'
if @connection_draining
@connection_draining['Timeout'] = value.to_i
end
when 'ConnectionDraining'
@response['DescribeLoadBalancerAttributesResult']['LoadBalancerAttributes']['ConnectionDraining'] = @connection_draining
@connection_draining = nil
when 'CrossZoneLoadBalancing'
@response['DescribeLoadBalancerAttributesResult']['LoadBalancerAttributes']['CrossZoneLoadBalancing'] = @cross_zone_load_balancing
@cross_zone_load_balancing = nil
when 'ConnectionSettings'
@response['DescribeLoadBalancerAttributesResult']['LoadBalancerAttributes']['ConnectionSettings'] = @connection_settings
@connection_settings = nil
when 'RequestId'
@response['ResponseMetadata'][name] = value
end
end
end
end
end
end
end