Class: Ufo::Cfn::Stack::Builder::Resources::Listener
- Inherits:
-
Base
show all
- Defined in:
- lib/ufo/cfn/stack/builder/resources/listener.rb
Instance Attribute Summary
Attributes inherited from Base
#vars
#task_definition
Instance Method Summary
collapse
Methods inherited from Base
build, #initialize, #managed_security_group, #managed_security_groups?, #security_groups
#deploy, #info, #ps
#names
#acm, #applicationautoscaling, #aws_options, #cfn, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #s3, #ssm_client, #waf_client
#find_stack, #find_stack_resources, #stack_resources, #status, #task_definition_arns
#initialize
#sure?
#pretty_home, #pretty_path, #pretty_time
#logger
Instance Method Details
#build ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 3
def build
{
Type: "AWS::ElasticLoadBalancingV2::Listener",
Condition: "CreateElbIsTrue",
Properties: properties,
}
end
|
#default_action ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 52
def default_action
{
Type: "forward",
TargetGroupArn: {
"Fn::If": [
"ElbTargetGroupIsBlank",
{Ref: "TargetGroup"},
{Ref: "ElbTargetGroup"}
]
}
}
end
|
#default_actions ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 28
def default_actions
elb = Ufo.config.elb
default_actions = elb.default_actions return default_actions if default_actions
redirect = elb.redirect
if redirect.enabled
[redirect_action(redirect)]
else
[default_action]
end
end
|
#port ⇒ Object
24
25
26
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 24
def port
80
end
|
#properties ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 11
def properties
{
DefaultActions: default_actions,
LoadBalancerArn: {Ref: "Elb"},
Port: port,
Protocol: protocol,
}
end
|
#protocol ⇒ Object
20
21
22
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 20
def protocol
vars[:default_listener_protocol]
end
|
#redirect_action(redirect) ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 41
def redirect_action(redirect)
{
Type: "redirect",
RedirectConfig: {
Protocol: redirect.protocol,
StatusCode: "HTTP_#{redirect.code}", Port: redirect.port,
}
}
end
|