Class: AWSCDK::ECS::ECSTarget

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs/ecs_target.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container_name:, listener:, new_target_group_id:, container_port: nil, protocol: nil) ⇒ ECSTarget

Returns a new instance of ECSTarget.

Parameters:

  • container_name (String)

    The name of the container.

  • listener (AWSCDK::ECS::ListenerConfig)

    Listener and properties for adding target group to the listener.

  • new_target_group_id (String)

    ID for a target group to be created.

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

    The port number of the container.

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

    The protocol used for the port mapping.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'ecs/ecs_target.rb', line 11

def initialize(container_name:, listener:, new_target_group_id:, container_port: nil, protocol: nil)
  @container_name = container_name
  Jsii::Type.check_type(@container_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "containerName")
  @listener = listener
  Jsii::Type.check_type(@listener, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxpc3RlbmVyQ29uZmlnIn0=")), "listener")
  @new_target_group_id = new_target_group_id
  Jsii::Type.check_type(@new_target_group_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "newTargetGroupId")
  @container_port = container_port
  Jsii::Type.check_type(@container_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "containerPort") unless @container_port.nil?
  @protocol = protocol
  Jsii::Type.check_type(@protocol, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlByb3RvY29sIn0=")), "protocol") unless @protocol.nil?
end

Instance Attribute Details

#container_nameString (readonly)

The name of the container.

Returns:

  • (String)


27
28
29
# File 'ecs/ecs_target.rb', line 27

def container_name
  @container_name
end

#container_portNumeric? (readonly)

Note:

Default: - Container port of the first added port mapping.

The port number of the container.

Only applicable when using application/network load balancers.

Returns:

  • (Numeric, nil)


42
43
44
# File 'ecs/ecs_target.rb', line 42

def container_port
  @container_port
end

#listenerAWSCDK::ECS::ListenerConfig (readonly)

Listener and properties for adding target group to the listener.



31
32
33
# File 'ecs/ecs_target.rb', line 31

def listener
  @listener
end

#new_target_group_idString (readonly)

ID for a target group to be created.

Returns:

  • (String)


35
36
37
# File 'ecs/ecs_target.rb', line 35

def new_target_group_id
  @new_target_group_id
end

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

Note:

Default: Protocol.TCP

The protocol used for the port mapping.

Only applicable when using application load balancers.

Returns:



49
50
51
# File 'ecs/ecs_target.rb', line 49

def protocol
  @protocol
end

Class Method Details

.jsii_propertiesObject



51
52
53
54
55
56
57
58
59
# File 'ecs/ecs_target.rb', line 51

def self.jsii_properties
  {
    :container_name => "containerName",
    :listener => "listener",
    :new_target_group_id => "newTargetGroupId",
    :container_port => "containerPort",
    :protocol => "protocol",
  }
end

Instance Method Details

#to_jsiiObject



61
62
63
64
65
66
67
68
69
70
71
# File 'ecs/ecs_target.rb', line 61

def to_jsii
  result = {}
  result.merge!({
    "containerName" => @container_name,
    "listener" => @listener,
    "newTargetGroupId" => @new_target_group_id,
    "containerPort" => @container_port,
    "protocol" => @protocol,
  })
  result.compact
end