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, #manage_ecs_security_group?, #managed_security_group, #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
10
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 3
def build
return unless vars[:create_listener]
{
Type: "AWS::ElasticLoadBalancingV2::Listener",
Condition: "CreateElbIsTrue",
Properties: properties,
}
end
|
#default_action ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 53
def default_action
{
Type: "forward",
TargetGroupArn: {
"Fn::If": [
"ElbTargetGroupIsBlank",
{Ref: "TargetGroup"}, {Ref: "ElbTargetGroup"} ]
}
}
end
|
#default_actions ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 29
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
25
26
27
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 25
def port
Ufo.config.elb.port
end
|
#properties ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 12
def properties
{
DefaultActions: default_actions,
LoadBalancerArn: {Ref: "Elb"},
Port: port,
Protocol: protocol,
}
end
|
#protocol ⇒ Object
21
22
23
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 21
def protocol
Ufo.config.elb.protocol || vars[:default_listener_protocol]
end
|
#redirect_action(redirect) ⇒ Object
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/ufo/cfn/stack/builder/resources/listener.rb', line 42
def redirect_action(redirect)
{
Type: "redirect",
RedirectConfig: {
Protocol: redirect.protocol,
StatusCode: "HTTP_#{redirect.code}", Port: redirect.port,
}
}
end
|