Class: AWSCDK::ECSPatterns::NetworkMultipleTargetGroupsFargateService

Inherits:
NetworkMultipleTargetGroupsServiceBase
  • Object
show all
Defined in:
ecs_patterns/network_multiple_target_groups_fargate_service.rb

Overview

A Fargate service running on an ECS cluster fronted by a network load balancer.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props = nil) ⇒ NetworkMultipleTargetGroupsFargateService

Constructs a new instance of the NetworkMultipleTargetGroupsFargateService class.

Parameters:



13
14
15
16
17
18
19
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 13

def initialize(scope, id, props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::ECSPatterns::NetworkMultipleTargetGroupsFargateServiceProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzX3BhdHRlcm5zLk5ldHdvcmtNdWx0aXBsZVRhcmdldEdyb3Vwc0ZhcmdhdGVTZXJ2aWNlUHJvcHMifQ==")), "props") unless props.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.jsii_overridable_methodsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 21

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :cluster => { kind: :property, name: "cluster", is_optional: false },
    :listener => { kind: :property, name: "listener", is_optional: false },
    :listeners => { kind: :property, name: "listeners", is_optional: false },
    :load_balancer => { kind: :property, name: "loadBalancer", is_optional: false },
    :load_balancers => { kind: :property, name: "loadBalancers", is_optional: false },
    :target_groups => { kind: :property, name: "targetGroups", is_optional: false },
    :internal_desired_count => { kind: :property, name: "internalDesiredCount", is_optional: true },
    :log_driver => { kind: :property, name: "logDriver", is_optional: true },
    :assign_public_ip => { kind: :property, name: "assignPublicIp", is_optional: false },
    :service => { kind: :property, name: "service", is_optional: false },
    :target_group => { kind: :property, name: "targetGroup", is_optional: false },
    :task_definition => { kind: :property, name: "taskDefinition", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :add_port_mapping_for_targets => { kind: :method, name: "addPortMappingForTargets", is_optional: false },
    :create_aws_log_driver => { kind: :method, name: "createAWSLogDriver", is_optional: false },
    :find_listener => { kind: :method, name: "findListener", is_optional: false },
    :get_default_cluster => { kind: :method, name: "getDefaultCluster", is_optional: false },
    :register_ecs_targets => { kind: :method, name: "registerECSTargets", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


120
121
122
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 120

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ecs_patterns.NetworkMultipleTargetGroupsFargateService", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_port_mapping_for_targets(container, targets) ⇒ void

This method returns an undefined value.



179
180
181
182
183
184
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 179

def add_port_mapping_for_targets(container, targets)
  Jsii::Type.check_type(container, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckRlZmluaXRpb24ifQ==")), "container")
  targets = targets.is_a?(Array) ? targets.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECSPatterns::NetworkTargetProps.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : targets
  Jsii::Type.check_type(targets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3NfcGF0dGVybnMuTmV0d29ya1RhcmdldFByb3BzIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "targets")
  jsii_call_method("addPortMappingForTargets", [container, targets])
end

#assign_public_ipBoolean

Determines whether the service will be assigned a public IP address.

Returns:

  • (Boolean)


127
128
129
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 127

def assign_public_ip()
  jsii_get_property("assignPublicIp")
end

#clusterAWSCDK::ECS::ICluster

The cluster that hosts the service.



56
57
58
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 56

def cluster()
  jsii_get_property("cluster")
end

#create_aws_log_driver(prefix) ⇒ AWSCDK::ECS::AWSLogDriver

Parameters:

  • prefix (String)

Returns:



188
189
190
191
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 188

def create_aws_log_driver(prefix)
  Jsii::Type.check_type(prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "prefix")
  jsii_call_method("createAWSLogDriver", [prefix])
end

#find_listener(name = nil) ⇒ AWSCDK::ElasticLoadBalancingv2::NetworkListener

Parameters:

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

Returns:



195
196
197
198
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 195

def find_listener(name = nil)
  Jsii::Type.check_type(name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless name.nil?
  jsii_call_method("findListener", [name])
end

#get_default_cluster(scope, vpc = nil) ⇒ AWSCDK::ECS::Cluster

Returns the default cluster.

Parameters:

Returns:



205
206
207
208
209
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 205

def get_default_cluster(scope, vpc = nil)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") unless vpc.nil?
  jsii_call_method("getDefaultCluster", [scope, vpc])
end

#internal_desired_countNumeric?

The desired number of instantiations of the task definition to keep running on the service.

The default is 1 for all new services and uses the existing services desired count when updating an existing service, if one is not provided.

Returns:

  • (Numeric, nil)


103
104
105
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 103

def internal_desired_count()
  jsii_get_property("internalDesiredCount")
end

#listenerAWSCDK::ElasticLoadBalancingv2::NetworkListener

Deprecated.
  • Use listeners instead.

The listener for the service.



64
65
66
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 64

def listener()
  jsii_get_property("listener")
end

#listenersArray<AWSCDK::ElasticLoadBalancingv2::NetworkListener>

The listeners of the service.



71
72
73
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 71

def listeners()
  jsii_get_property("listeners")
end

#load_balancerAWSCDK::ElasticLoadBalancingv2::NetworkLoadBalancer

Deprecated.
  • Use loadBalancers instead.

The Network Load Balancer for the service.



79
80
81
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 79

def load_balancer()
  jsii_get_property("loadBalancer")
end

#load_balancersArray<AWSCDK::ElasticLoadBalancingv2::NetworkLoadBalancer>

The load balancers of the service.



86
87
88
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 86

def load_balancers()
  jsii_get_property("loadBalancers")
end

#log_driverAWSCDK::ECS::LogDriver?

Returns:



108
109
110
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 108

def log_driver()
  jsii_get_property("logDriver")
end

#log_driver=(value) ⇒ Object



112
113
114
115
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 112

def log_driver=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxvZ0RyaXZlciJ9")), "logDriver") unless value.nil?
  jsii_set_property("logDriver", value)
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


49
50
51
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 49

def node()
  jsii_get_property("node")
end

#register_ecs_targets(service, container, targets) ⇒ AWSCDK::ElasticLoadBalancingv2::NetworkTargetGroup



215
216
217
218
219
220
221
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 215

def register_ecs_targets(service, container, targets)
  Jsii::Type.check_type(service, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkJhc2VTZXJ2aWNlIn0=")), "service")
  Jsii::Type.check_type(container, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckRlZmluaXRpb24ifQ==")), "container")
  targets = targets.is_a?(Array) ? targets.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECSPatterns::NetworkTargetProps.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : targets
  Jsii::Type.check_type(targets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3NfcGF0dGVybnMuTmV0d29ya1RhcmdldFByb3BzIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "targets")
  jsii_call_method("registerECSTargets", [service, container, targets])
end

#serviceAWSCDK::ECS::FargateService

The Fargate service in this construct.



134
135
136
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 134

def service()
  jsii_get_property("service")
end

#target_groupAWSCDK::ElasticLoadBalancingv2::NetworkTargetGroup

Deprecated.
  • Use targetGroups instead.

The default target group for the service.



142
143
144
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 142

def target_group()
  jsii_get_property("targetGroup")
end

#target_groupsArray<AWSCDK::ElasticLoadBalancingv2::NetworkTargetGroup>

The target groups of the service.



93
94
95
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 93

def target_groups()
  jsii_get_property("targetGroups")
end

#task_definitionAWSCDK::ECS::FargateTaskDefinition

The Fargate task definition in this construct.



149
150
151
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 149

def task_definition()
  jsii_get_property("taskDefinition")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


156
157
158
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 156

def to_string()
  jsii_call_method("toString", [])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



169
170
171
172
173
174
# File 'ecs_patterns/network_multiple_target_groups_fargate_service.rb', line 169

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end