mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Take care of RedirectConfig in listeners parser
This commit is contained in:
parent
4ef5513890
commit
f195b59528
3 changed files with 52 additions and 27 deletions
|
@ -7,6 +7,7 @@ module Fog
|
|||
reset_listener
|
||||
@default_action = {}
|
||||
@certificate = {}
|
||||
@redirect_config = {}
|
||||
@results = { 'Listeners' => [] }
|
||||
@response = { 'DescribeListenersResult' => {}, 'ResponseMetadata' => {} }
|
||||
end
|
||||
|
@ -26,38 +27,47 @@ module Fog
|
|||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'member'
|
||||
if @in_default_actions
|
||||
if @in_default_actions
|
||||
case name
|
||||
when 'member'
|
||||
@listener['DefaultActions'] << @default_action
|
||||
@default_action = {}
|
||||
elsif @in_certificates
|
||||
@listener['Certificates'] << @certificate
|
||||
@certificate = {}
|
||||
else
|
||||
@results['Listeners'] << @listener
|
||||
reset_listener
|
||||
when 'Type', 'TargetGroupArn'
|
||||
@default_action[name] = value
|
||||
when 'Path', 'Protocol', 'Port', 'Query', 'Host', 'StatusCode'
|
||||
@redirect_config[name] = value
|
||||
when 'RedirectConfig'
|
||||
@default_action[name] = @redirect_config
|
||||
@redirect_config = {}
|
||||
when 'DefaultActions'
|
||||
@in_default_actions = false
|
||||
end
|
||||
when 'LoadBalancerArn', 'Protocol', 'Port', 'ListenerArn'
|
||||
@listener[name] = value
|
||||
when 'Type', 'TargetGroupArn'
|
||||
@default_action[name] = value
|
||||
when 'CertificateArn'
|
||||
@certificate[name] = value
|
||||
else
|
||||
case name
|
||||
when 'member'
|
||||
if @in_certificates
|
||||
@listener['Certificates'] << @certificate
|
||||
@certificate = {}
|
||||
else
|
||||
@results['Listeners'] << @listener
|
||||
reset_listener
|
||||
end
|
||||
when 'LoadBalancerArn', 'Protocol', 'Port', 'ListenerArn'
|
||||
@listener[name] = value
|
||||
when 'CertificateArn'
|
||||
@certificate[name] = value
|
||||
when 'Certificates'
|
||||
@in_certificates = false
|
||||
|
||||
when 'DefaultActions'
|
||||
@in_default_actions = false
|
||||
when 'Certificates'
|
||||
@in_certificates = false
|
||||
when 'RequestId'
|
||||
@response['ResponseMetadata'][name] = value
|
||||
|
||||
when 'RequestId'
|
||||
@response['ResponseMetadata'][name] = value
|
||||
when 'NextMarker'
|
||||
@results['NextMarker'] = value
|
||||
|
||||
when 'NextMarker'
|
||||
@results['NextMarker'] = value
|
||||
|
||||
when 'DescribeListenersResponse'
|
||||
@response['DescribeListenersResult'] = @results
|
||||
when 'DescribeListenersResponse'
|
||||
@response['DescribeListenersResult'] = @results
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,6 +14,15 @@ DESCRIBE_LISTENERS_RESULT = <<-EOF
|
|||
<member>
|
||||
<Type>forward</Type>
|
||||
<TargetGroupArn>arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067</TargetGroupArn>
|
||||
<RedirectConfig>
|
||||
<Protocol>HTTPS</Protocol>
|
||||
<Port>443</Port>
|
||||
<Path>\#{path}</Path>
|
||||
<Query>\#{query}</Query>
|
||||
<Host>\#{host}</Host>
|
||||
<StatusCode>HTTP_301</StatusCode>
|
||||
<Type>redirect</Type>
|
||||
</RedirectConfig>
|
||||
</member>
|
||||
</DefaultActions>
|
||||
<Certificates>
|
||||
|
|
|
@ -30,12 +30,18 @@ class AWS
|
|||
'CreateLoadBalancerResult' => {'LoadBalancers' => [LOAD_BALANCER], 'NextMarker' => Fog::Nullable::String}
|
||||
})
|
||||
|
||||
LISTENER_DEFAULT_ACTIONS = [{
|
||||
"Type" => String,
|
||||
"TargetGroupArn" => String,
|
||||
"RedirectConfig" => Fog::Nullable::Hash
|
||||
}]
|
||||
|
||||
LISTENER = {
|
||||
"LoadBalancerArn" => String,
|
||||
"Protocol" => String,
|
||||
"Port" => String,
|
||||
"ListenerArn" => String,
|
||||
"DefaultActions" => [{"Type" => String, "TargetGroupArn" => String}],
|
||||
"DefaultActions" => LISTENER_DEFAULT_ACTIONS,
|
||||
"Certificates" => [{"CertificateArn" => String}]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue