Class: AWSCDK::ECSPatterns::ApplicationTargetProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs_patterns/application_target_props.rb

Overview

Properties to define an application target group.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container_port:, host_header: nil, listener: nil, path_pattern: nil, priority: nil, protocol: nil) ⇒ ApplicationTargetProps

Returns a new instance of ApplicationTargetProps.

Parameters:

  • container_port (Numeric)

    The port number of the container.

  • host_header (String, nil) (defaults to: nil)

    Rule applies if the requested host matches the indicated host.

  • listener (String, nil) (defaults to: nil)

    Name of the listener the target group attached to.

  • path_pattern (String, nil) (defaults to: nil)

    Rule applies if the requested path matches the given path pattern.

  • priority (Numeric, nil) (defaults to: nil)

    Priority of this target group.

  • protocol (AWSCDK::ECS::Protocol, nil) (defaults to: nil)

    The protocol used for the port mapping.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'ecs_patterns/application_target_props.rb', line 13

def initialize(container_port:, host_header: nil, listener: nil, path_pattern: nil, priority: nil, protocol: nil)
  @container_port = container_port
  Jsii::Type.check_type(@container_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "containerPort")
  @host_header = host_header
  Jsii::Type.check_type(@host_header, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hostHeader") unless @host_header.nil?
  @listener = listener
  Jsii::Type.check_type(@listener, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "listener") unless @listener.nil?
  @path_pattern = path_pattern
  Jsii::Type.check_type(@path_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "pathPattern") unless @path_pattern.nil?
  @priority = priority
  Jsii::Type.check_type(@priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "priority") unless @priority.nil?
  @protocol = protocol
  Jsii::Type.check_type(@protocol, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlByb3RvY29sIn0=")), "protocol") unless @protocol.nil?
end

Instance Attribute Details

#container_portNumeric (readonly)

The port number of the container.

Only applicable when using application/network load balancers.

Returns:

  • (Numeric)


33
34
35
# File 'ecs_patterns/application_target_props.rb', line 33

def container_port
  @container_port
end

#host_headerString? (readonly)

Note:

Default: No host condition

Rule applies if the requested host matches the indicated host.

May contain up to three '*' wildcards.

Requires that priority is set.



43
44
45
# File 'ecs_patterns/application_target_props.rb', line 43

def host_header
  @host_header
end

#listenerString? (readonly)

Note:

Default: - default listener (first added listener)

Name of the listener the target group attached to.

Returns:

  • (String, nil)


48
49
50
# File 'ecs_patterns/application_target_props.rb', line 48

def listener
  @listener
end

#path_patternString? (readonly)

Note:

Default: No path condition

Rule applies if the requested path matches the given path pattern.

May contain up to three '*' wildcards.

Requires that priority is set.



58
59
60
# File 'ecs_patterns/application_target_props.rb', line 58

def path_pattern
  @path_pattern
end

#priorityNumeric? (readonly)

Note:

Default: Target groups are used as defaults

Priority of this target group.

The rule with the lowest priority will be used for every request. If priority is not given, these target groups will be added as defaults, and must not have conditions.

Priorities must be unique.

Returns:

  • (Numeric, nil)


69
70
71
# File 'ecs_patterns/application_target_props.rb', line 69

def priority
  @priority
end

#protocolAWSCDK::ECS::Protocol? (readonly)

Note:

Default: ecs.Protocol.TCP

The protocol used for the port mapping.

Only applicable when using application load balancers.

Returns:



76
77
78
# File 'ecs_patterns/application_target_props.rb', line 76

def protocol
  @protocol
end

Class Method Details

.jsii_propertiesObject



78
79
80
81
82
83
84
85
86
87
# File 'ecs_patterns/application_target_props.rb', line 78

def self.jsii_properties
  {
    :container_port => "containerPort",
    :host_header => "hostHeader",
    :listener => "listener",
    :path_pattern => "pathPattern",
    :priority => "priority",
    :protocol => "protocol",
  }
end

Instance Method Details

#to_jsiiObject



89
90
91
92
93
94
95
96
97
98
99
100
# File 'ecs_patterns/application_target_props.rb', line 89

def to_jsii
  result = {}
  result.merge!({
    "containerPort" => @container_port,
    "hostHeader" => @host_header,
    "listener" => @listener,
    "pathPattern" => @path_pattern,
    "priority" => @priority,
    "protocol" => @protocol,
  })
  result.compact
end