1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Take care of Certificates block in listeners parser

This commit is contained in:
KevinLoiseau 2019-11-26 11:18:14 +01:00
parent 9310aaaefa
commit 4ef5513890
No known key found for this signature in database
GPG key ID: 709159A779B96CC3
3 changed files with 23 additions and 3 deletions

View file

@ -6,12 +6,13 @@ module Fog
def reset
reset_listener
@default_action = {}
@certificate = {}
@results = { 'Listeners' => [] }
@response = { 'DescribeListenersResult' => {}, 'ResponseMetadata' => {} }
end
def reset_listener
@listener= { 'DefaultActions' => [] }
@listener= { 'DefaultActions' => [], 'Certificates' => [] }
end
def start_element(name, attrs = [])
@ -19,6 +20,8 @@ module Fog
case name
when 'DefaultActions'
@in_default_actions = true
when 'Certificates'
@in_certificates = true
end
end
@ -28,6 +31,9 @@ module Fog
if @in_default_actions
@listener['DefaultActions'] << @default_action
@default_action = {}
elsif @in_certificates
@listener['Certificates'] << @certificate
@certificate = {}
else
@results['Listeners'] << @listener
reset_listener
@ -36,9 +42,13 @@ module Fog
@listener[name] = value
when 'Type', 'TargetGroupArn'
@default_action[name] = value
when 'CertificateArn'
@certificate[name] = value
when 'DefaultActions'
@in_default_actions = false
when 'Certificates'
@in_certificates = false
when 'RequestId'
@response['ResponseMetadata'][name] = value

View file

@ -7,7 +7,7 @@ DESCRIBE_LISTENERS_RESULT = <<-EOF
<Listeners>
<member>
<LoadBalancerArn>arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188</LoadBalancerArn>
<Protocol>HTTP</Protocol>
<Protocol>HTTPS</Protocol>
<Port>80</Port>
<ListenerArn>arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2</ListenerArn>
<DefaultActions>
@ -16,6 +16,11 @@ DESCRIBE_LISTENERS_RESULT = <<-EOF
<TargetGroupArn>arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067</TargetGroupArn>
</member>
</DefaultActions>
<Certificates>
<member>
<CertificateArn>arn:aws:elasticloadbalancing:us-west-2:123456789012:certificate/56d36256-1245-40d6-916e-6f5a95e2b4c6</CertificateArn>
</member>
</Certificates>
</member>
</Listeners>
</DescribeListenersResult>

View file

@ -26,12 +26,17 @@ class AWS
'DescribeLoadBalancersResult' => {'LoadBalancers' => [LOAD_BALANCER], 'NextMarker' => Fog::Nullable::String}
})
CREATE_LOAD_BALANCER = BASIC.merge({
'CreateLoadBalancerResult' => {'LoadBalancers' => [LOAD_BALANCER], 'NextMarker' => Fog::Nullable::String}
})
LISTENER = {
"LoadBalancerArn" => String,
"Protocol" => String,
"Port" => String,
"ListenerArn" => String,
"DefaultActions" => [{"Type" => String, "TargetGroupArn" => String}]
"DefaultActions" => [{"Type" => String, "TargetGroupArn" => String}],
"Certificates" => [{"CertificateArn" => String}]
}
DESCRIBE_LISTENERS = BASIC.merge({