Class: AWSCDK::EventsTargets::ECSTaskProps

Inherits:
TargetBaseProps
  • Object
show all
Defined in:
events_targets/ecs_task_props.rb

Overview

Properties to define an ECS Event Task.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dead_letter_queue: nil, max_event_age: nil, retry_attempts: nil, cluster:, task_definition:, assign_public_ip: nil, container_overrides: nil, cpu: nil, enable_execute_command: nil, ephemeral_storage: nil, execution_role: nil, inference_accelerator_overrides: nil, launch_type: nil, memory: nil, platform_version: nil, propagate_tags: nil, role: nil, security_groups: nil, subnet_selection: nil, tags: nil, task_count: nil, task_role: nil) ⇒ ECSTaskProps

Returns a new instance of ECSTaskProps.

Parameters:

  • dead_letter_queue (AWSCDK::SQS::IQueue, nil) (defaults to: nil)

    The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.

  • max_event_age (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum age of a request that Lambda sends to a function for processing.

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

    The maximum number of times to retry when the function returns an error.

  • cluster (AWSCDK::ECS::ICluster)

    Cluster where service will be deployed.

  • task_definition (AWSCDK::ECS::ITaskDefinition)

    Task Definition of the task that should be started.

  • assign_public_ip (Boolean, nil) (defaults to: nil)

    Specifies whether the task's elastic network interface receives a public IP address.

  • container_overrides (Array<AWSCDK::EventsTargets::ContainerOverride>, nil) (defaults to: nil)

    Container setting overrides.

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

    The CPU override for the task.

  • enable_execute_command (Boolean, nil) (defaults to: nil)

    Whether or not to enable the execute command functionality for the containers in this task.

  • ephemeral_storage (AWSCDK::EventsTargets::EphemeralStorageOverride, nil) (defaults to: nil)

    The ephemeral storage setting override for the task.

  • execution_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The execution role for the task.

  • inference_accelerator_overrides (Array<AWSCDK::EventsTargets::InferenceAcceleratorOverride>, nil) (defaults to: nil)

    The Elastic Inference accelerator override for the task.

  • launch_type (AWSCDK::ECS::LaunchType, nil) (defaults to: nil)

    Specifies the launch type on which your task is running.

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

    The memory override for the task.

  • platform_version (AWSCDK::ECS::FargatePlatformVersion, nil) (defaults to: nil)

    The platform version on which to run your task.

  • propagate_tags (AWSCDK::ECS::PropagatedTagSource, nil) (defaults to: nil)

    Specifies whether to propagate the tags from the task definition to the task.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    Existing IAM role to run the ECS task.

  • security_groups (Array<AWSCDK::EC2::ISecurityGroup>, nil) (defaults to: nil)

    Existing security groups to use for the task's ENIs.

  • subnet_selection (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    In what subnets to place the task's ENIs.

  • tags (Array<AWSCDK::EventsTargets::Tag>, nil) (defaults to: nil)

    The metadata that you apply to the task to help you categorize and organize them.

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

    How many tasks should be started when this event is triggered.

  • task_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The IAM role for the task.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'events_targets/ecs_task_props.rb', line 29

def initialize(dead_letter_queue: nil, max_event_age: nil, retry_attempts: nil, cluster:, task_definition:, assign_public_ip: nil, container_overrides: nil, cpu: nil, enable_execute_command: nil, ephemeral_storage: nil, execution_role: nil, inference_accelerator_overrides: nil, launch_type: nil, memory: nil, platform_version: nil, propagate_tags: nil, role: nil, security_groups: nil, subnet_selection: nil, tags: nil, task_count: nil, task_role: nil)
  @dead_letter_queue = dead_letter_queue
  Jsii::Type.check_type(@dead_letter_queue, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3FzLklRdWV1ZSJ9")), "deadLetterQueue") unless @dead_letter_queue.nil?
  @max_event_age = max_event_age
  Jsii::Type.check_type(@max_event_age, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxEventAge") unless @max_event_age.nil?
  @retry_attempts = retry_attempts
  Jsii::Type.check_type(@retry_attempts, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "retryAttempts") unless @retry_attempts.nil?
  @cluster = cluster
  Jsii::Type.check_type(@cluster, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLklDbHVzdGVyIn0=")), "cluster")
  @task_definition = task_definition
  Jsii::Type.check_type(@task_definition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLklUYXNrRGVmaW5pdGlvbiJ9")), "taskDefinition")
  @assign_public_ip = assign_public_ip
  Jsii::Type.check_type(@assign_public_ip, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "assignPublicIp") unless @assign_public_ip.nil?
  @container_overrides = container_overrides.is_a?(Array) ? container_overrides.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EventsTargets::ContainerOverride.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : container_overrides
  Jsii::Type.check_type(@container_overrides, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19ldmVudHNfdGFyZ2V0cy5Db250YWluZXJPdmVycmlkZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "containerOverrides") unless @container_overrides.nil?
  @cpu = cpu
  Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cpu") unless @cpu.nil?
  @enable_execute_command = enable_execute_command
  Jsii::Type.check_type(@enable_execute_command, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableExecuteCommand") unless @enable_execute_command.nil?
  @ephemeral_storage = ephemeral_storage.is_a?(Hash) ? ::AWSCDK::EventsTargets::EphemeralStorageOverride.new(**ephemeral_storage.transform_keys(&:to_sym)) : ephemeral_storage
  Jsii::Type.check_type(@ephemeral_storage, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzX3RhcmdldHMuRXBoZW1lcmFsU3RvcmFnZU92ZXJyaWRlIn0=")), "ephemeralStorage") unless @ephemeral_storage.nil?
  @execution_role = execution_role
  Jsii::Type.check_type(@execution_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "executionRole") unless @execution_role.nil?
  @inference_accelerator_overrides = inference_accelerator_overrides.is_a?(Array) ? inference_accelerator_overrides.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EventsTargets::InferenceAcceleratorOverride.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : inference_accelerator_overrides
  Jsii::Type.check_type(@inference_accelerator_overrides, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19ldmVudHNfdGFyZ2V0cy5JbmZlcmVuY2VBY2NlbGVyYXRvck92ZXJyaWRlIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "inferenceAcceleratorOverrides") unless @inference_accelerator_overrides.nil?
  @launch_type = launch_type
  Jsii::Type.check_type(@launch_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxhdW5jaFR5cGUifQ==")), "launchType") unless @launch_type.nil?
  @memory = memory
  Jsii::Type.check_type(@memory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "memory") unless @memory.nil?
  @platform_version = platform_version
  Jsii::Type.check_type(@platform_version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkZhcmdhdGVQbGF0Zm9ybVZlcnNpb24ifQ==")), "platformVersion") unless @platform_version.nil?
  @propagate_tags = propagate_tags
  Jsii::Type.check_type(@propagate_tags, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlByb3BhZ2F0ZWRUYWdTb3VyY2UifQ==")), "propagateTags") unless @propagate_tags.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil?
  @subnet_selection = subnet_selection.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**subnet_selection.transform_keys(&:to_sym)) : subnet_selection
  Jsii::Type.check_type(@subnet_selection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "subnetSelection") unless @subnet_selection.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EventsTargets::Tag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19ldmVudHNfdGFyZ2V0cy5UYWcifSwia2luZCI6ImFycmF5In19")), "tags") unless @tags.nil?
  @task_count = task_count
  Jsii::Type.check_type(@task_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "taskCount") unless @task_count.nil?
  @task_role = task_role
  Jsii::Type.check_type(@task_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "taskRole") unless @task_role.nil?
end

Instance Attribute Details

#assign_public_ipBoolean? (readonly)

Note:

Default: - true if the subnet type is PUBLIC, otherwise false

Specifies whether the task's elastic network interface receives a public IP address.

You can specify true only when LaunchType is set to FARGATE.

Returns:

  • (Boolean, nil)


115
116
117
# File 'events_targets/ecs_task_props.rb', line 115

def assign_public_ip
  @assign_public_ip
end

#clusterAWSCDK::ECS::ICluster (readonly)

Cluster where service will be deployed.



104
105
106
# File 'events_targets/ecs_task_props.rb', line 104

def cluster
  @cluster
end

#container_overridesArray<AWSCDK::EventsTargets::ContainerOverride>? (readonly)

Container setting overrides.

Key is the name of the container to override, value is the values you want to override.



122
123
124
# File 'events_targets/ecs_task_props.rb', line 122

def container_overrides
  @container_overrides
end

#cpuString? (readonly)

Note:

Default: - The task definition's CPU value

The CPU override for the task.

Returns:

  • (String, nil)


127
128
129
# File 'events_targets/ecs_task_props.rb', line 127

def cpu
  @cpu
end

#dead_letter_queueAWSCDK::SQS::IQueue? (readonly)

Note:

Default: - no dead-letter queue

The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.

The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.

Returns:



84
85
86
# File 'events_targets/ecs_task_props.rb', line 84

def dead_letter_queue
  @dead_letter_queue
end

#enable_execute_commandBoolean? (readonly)

Note:

Default: - false

Whether or not to enable the execute command functionality for the containers in this task.

If true, this enables execute command functionality on all containers in the task.

Returns:

  • (Boolean, nil)


134
135
136
# File 'events_targets/ecs_task_props.rb', line 134

def enable_execute_command
  @enable_execute_command
end

#ephemeral_storageAWSCDK::EventsTargets::EphemeralStorageOverride? (readonly)

Note:

Default: - The task definition's ephemeral storage value

The ephemeral storage setting override for the task.

NOTE: This parameter is only supported for tasks hosted on Fargate that use the following platform versions:

  • Linux platform version 1.4.0 or later.
  • Windows platform version 1.0.0 or later.


144
145
146
# File 'events_targets/ecs_task_props.rb', line 144

def ephemeral_storage
  @ephemeral_storage
end

#execution_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - The task definition's execution role

The execution role for the task.

The Amazon Resource Name (ARN) of the task execution role override for the task.

Returns:



151
152
153
# File 'events_targets/ecs_task_props.rb', line 151

def execution_role
  @execution_role
end

#inference_accelerator_overridesArray<AWSCDK::EventsTargets::InferenceAcceleratorOverride>? (readonly)

Note:

Default: - The task definition's inference accelerator overrides

The Elastic Inference accelerator override for the task.



156
157
158
# File 'events_targets/ecs_task_props.rb', line 156

def inference_accelerator_overrides
  @inference_accelerator_overrides
end

#launch_typeAWSCDK::ECS::LaunchType? (readonly)

Note:

Default: - 'EC2' if isEc2Compatible for the taskDefinition is true, otherwise 'FARGATE'

Specifies the launch type on which your task is running.

The launch type that you specify here must match one of the launch type (compatibilities) of the target task.

Returns:



164
165
166
# File 'events_targets/ecs_task_props.rb', line 164

def launch_type
  @launch_type
end

#max_event_ageAWSCDK::Duration? (readonly)

Note:

Default: Duration.hours(24)

The maximum age of a request that Lambda sends to a function for processing.

Minimum value of 60. Maximum value of 86400.

Returns:



92
93
94
# File 'events_targets/ecs_task_props.rb', line 92

def max_event_age
  @max_event_age
end

#memoryString? (readonly)

Note:

Default: - The task definition's memory value

The memory override for the task.

Returns:

  • (String, nil)


169
170
171
# File 'events_targets/ecs_task_props.rb', line 169

def memory
  @memory
end

#platform_versionAWSCDK::ECS::FargatePlatformVersion? (readonly)

Note:

Default: - ECS will set the Fargate platform version to 'LATEST'

The platform version on which to run your task.

Unless you have specific compatibility requirements, you don't need to specify this.



177
178
179
# File 'events_targets/ecs_task_props.rb', line 177

def platform_version
  @platform_version
end

#propagate_tagsAWSCDK::ECS::PropagatedTagSource? (readonly)

Note:

Default: - Tags will not be propagated

Specifies whether to propagate the tags from the task definition to the task.

If no value is specified, the tags are not propagated.



184
185
186
# File 'events_targets/ecs_task_props.rb', line 184

def propagate_tags
  @propagate_tags
end

#retry_attemptsNumeric? (readonly)

Note:

Default: 185

The maximum number of times to retry when the function returns an error.

Minimum value of 0. Maximum value of 185.

Returns:

  • (Numeric, nil)


100
101
102
# File 'events_targets/ecs_task_props.rb', line 100

def retry_attempts
  @retry_attempts
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: A new IAM role is created

Existing IAM role to run the ECS task.

Returns:



189
190
191
# File 'events_targets/ecs_task_props.rb', line 189

def role
  @role
end

#security_groupsArray<AWSCDK::EC2::ISecurityGroup>? (readonly)

Note:

Default: A new security group is created

Existing security groups to use for the task's ENIs.

(Only applicable in case the TaskDefinition is configured for AwsVpc networking)

Returns:



196
197
198
# File 'events_targets/ecs_task_props.rb', line 196

def security_groups
  @security_groups
end

#subnet_selectionAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: Private subnets

In what subnets to place the task's ENIs.

(Only applicable in case the TaskDefinition is configured for AwsVpc networking)



203
204
205
# File 'events_targets/ecs_task_props.rb', line 203

def subnet_selection
  @subnet_selection
end

#tagsArray<AWSCDK::EventsTargets::Tag>? (readonly)

Note:

Default: - No additional tags are applied to the task

The metadata that you apply to the task to help you categorize and organize them.

Each tag consists of a key and an optional value, both of which you define.

Returns:



210
211
212
# File 'events_targets/ecs_task_props.rb', line 210

def tags
  @tags
end

#task_countNumeric? (readonly)

Note:

Default: 1

How many tasks should be started when this event is triggered.

Returns:

  • (Numeric, nil)


215
216
217
# File 'events_targets/ecs_task_props.rb', line 215

def task_count
  @task_count
end

#task_definitionAWSCDK::ECS::ITaskDefinition (readonly)

Task Definition of the task that should be started.



108
109
110
# File 'events_targets/ecs_task_props.rb', line 108

def task_definition
  @task_definition
end

#task_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - The task definition's task role

The IAM role for the task.

Returns:



220
221
222
# File 'events_targets/ecs_task_props.rb', line 220

def task_role
  @task_role
end

Class Method Details

.jsii_propertiesObject



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'events_targets/ecs_task_props.rb', line 222

def self.jsii_properties
  {
    :dead_letter_queue => "deadLetterQueue",
    :max_event_age => "maxEventAge",
    :retry_attempts => "retryAttempts",
    :cluster => "cluster",
    :task_definition => "taskDefinition",
    :assign_public_ip => "assignPublicIp",
    :container_overrides => "containerOverrides",
    :cpu => "cpu",
    :enable_execute_command => "enableExecuteCommand",
    :ephemeral_storage => "ephemeralStorage",
    :execution_role => "executionRole",
    :inference_accelerator_overrides => "inferenceAcceleratorOverrides",
    :launch_type => "launchType",
    :memory => "memory",
    :platform_version => "platformVersion",
    :propagate_tags => "propagateTags",
    :role => "role",
    :security_groups => "securityGroups",
    :subnet_selection => "subnetSelection",
    :tags => "tags",
    :task_count => "taskCount",
    :task_role => "taskRole",
  }
end

Instance Method Details

#to_jsiiObject



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'events_targets/ecs_task_props.rb', line 249

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "deadLetterQueue" => @dead_letter_queue,
    "maxEventAge" => @max_event_age,
    "retryAttempts" => @retry_attempts,
    "cluster" => @cluster,
    "taskDefinition" => @task_definition,
    "assignPublicIp" => @assign_public_ip,
    "containerOverrides" => @container_overrides,
    "cpu" => @cpu,
    "enableExecuteCommand" => @enable_execute_command,
    "ephemeralStorage" => @ephemeral_storage,
    "executionRole" => @execution_role,
    "inferenceAcceleratorOverrides" => @inference_accelerator_overrides,
    "launchType" => @launch_type,
    "memory" => @memory,
    "platformVersion" => @platform_version,
    "propagateTags" => @propagate_tags,
    "role" => @role,
    "securityGroups" => @security_groups,
    "subnetSelection" => @subnet_selection,
    "tags" => @tags,
    "taskCount" => @task_count,
    "taskRole" => @task_role,
  })
  result.compact
end