Class: AWSCDK::SchedulerTargets::FargateTaskProps

Inherits:
ECSRunTaskBaseProps
  • Object
show all
Defined in:
scheduler_targets/fargate_task_props.rb

Overview

Properties for scheduling an ECS Fargate Task.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dead_letter_queue: nil, input: nil, max_event_age: nil, retry_attempts: nil, role: nil, task_definition:, capacity_provider_strategies: nil, enable_ecs_managed_tags: nil, enable_execute_command: nil, group: nil, propagate_tags: nil, reference_id: nil, security_groups: nil, tags: nil, task_count: nil, vpc_subnets: nil, assign_public_ip: nil, platform_version: nil) ⇒ FargateTaskProps

Returns a new instance of FargateTaskProps.

Parameters:

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

    The SQS queue to be used as deadLetterQueue.

  • input (AWSCDK::Scheduler::ScheduleTargetInput, nil) (defaults to: nil)

    Input passed to the target.

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

    The maximum age of a request that Scheduler sends to a target for processing.

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

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

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

    An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.

  • task_definition (AWSCDK::ECS::TaskDefinition)

    The task definition to use for scheduled tasks.

  • capacity_provider_strategies (Array<AWSCDK::ECS::CapacityProviderStrategy>, nil) (defaults to: nil)

    The capacity provider strategy to use for the task.

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

    Specifies whether to enable Amazon ECS managed tags for the task.

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

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

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

    Specifies an ECS task group for the task.

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

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

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

    The reference ID to use for the task.

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

    The security groups associated with the task.

  • tags (Array<AWSCDK::SchedulerTargets::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)

    The number of tasks to create based on TaskDefinition.

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

    The subnets associated with the task.

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

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

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

    Specifies the platform version for the task.



25
26
27
28
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
# File 'scheduler_targets/fargate_task_props.rb', line 25

def initialize(dead_letter_queue: nil, input: nil, max_event_age: nil, retry_attempts: nil, role: nil, task_definition:, capacity_provider_strategies: nil, enable_ecs_managed_tags: nil, enable_execute_command: nil, group: nil, propagate_tags: nil, reference_id: nil, security_groups: nil, tags: nil, task_count: nil, vpc_subnets: nil, assign_public_ip: nil, platform_version: 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?
  @input = input
  Jsii::Type.check_type(@input, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2NoZWR1bGVyLlNjaGVkdWxlVGFyZ2V0SW5wdXQifQ==")), "input") unless @input.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?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @task_definition = task_definition
  Jsii::Type.check_type(@task_definition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlRhc2tEZWZpbml0aW9uIn0=")), "taskDefinition")
  @capacity_provider_strategies = capacity_provider_strategies.is_a?(Array) ? capacity_provider_strategies.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::CapacityProviderStrategy.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : capacity_provider_strategies
  Jsii::Type.check_type(@capacity_provider_strategies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2FwYWNpdHlQcm92aWRlclN0cmF0ZWd5In0sImtpbmQiOiJhcnJheSJ9fQ==")), "capacityProviderStrategies") unless @capacity_provider_strategies.nil?
  @enable_ecs_managed_tags = enable_ecs_managed_tags
  Jsii::Type.check_type(@enable_ecs_managed_tags, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableEcsManagedTags") unless @enable_ecs_managed_tags.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?
  @group = group
  Jsii::Type.check_type(@group, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "group") unless @group.nil?
  @propagate_tags = propagate_tags
  Jsii::Type.check_type(@propagate_tags, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "propagateTags") unless @propagate_tags.nil?
  @reference_id = reference_id
  Jsii::Type.check_type(@reference_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "referenceId") unless @reference_id.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::SchedulerTargets::Tag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zY2hlZHVsZXJfdGFyZ2V0cy5UYWcifSwia2luZCI6ImFycmF5In19")), "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?
  @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets
  Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil?
  @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?
  @platform_version = platform_version
  Jsii::Type.check_type(@platform_version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkZhcmdhdGVQbGF0Zm9ybVZlcnNpb24ifQ==")), "platformVersion") unless @platform_version.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.

If true, the task will receive a public IP address and be accessible from the internet. Should only be set to true when using public subnets.

Returns:

  • (Boolean, nil)


181
182
183
# File 'scheduler_targets/fargate_task_props.rb', line 181

def assign_public_ip
  @assign_public_ip
end

#capacity_provider_strategiesArray<AWSCDK::ECS::CapacityProviderStrategy>? (readonly)

Note:

Default: - No capacity provider strategy

The capacity provider strategy to use for the task.

Returns:



116
117
118
# File 'scheduler_targets/fargate_task_props.rb', line 116

def capacity_provider_strategies
  @capacity_provider_strategies
end

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

Note:

Default: - no dead-letter queue

The SQS queue to be used as deadLetterQueue.

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:



72
73
74
# File 'scheduler_targets/fargate_task_props.rb', line 72

def dead_letter_queue
  @dead_letter_queue
end

#enable_ecs_managed_tagsBoolean? (readonly)

Note:

Default: - false

Specifies whether to enable Amazon ECS managed tags for the task.

Returns:

  • (Boolean, nil)


121
122
123
# File 'scheduler_targets/fargate_task_props.rb', line 121

def enable_ecs_managed_tags
  @enable_ecs_managed_tags
end

#enable_execute_commandBoolean? (readonly)

Note:

Default: - false

Whether to enable 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)


128
129
130
# File 'scheduler_targets/fargate_task_props.rb', line 128

def enable_execute_command
  @enable_execute_command
end

#groupString? (readonly)

Note:

Default: - No group

Specifies an ECS task group for the task.

Returns:

  • (String, nil)


133
134
135
# File 'scheduler_targets/fargate_task_props.rb', line 133

def group
  @group
end

#inputAWSCDK::Scheduler::ScheduleTargetInput? (readonly)

Note:

Default: - no input.

Input passed to the target.



77
78
79
# File 'scheduler_targets/fargate_task_props.rb', line 77

def input
  @input
end

#max_event_ageAWSCDK::Duration? (readonly)

Note:

Default: Duration.hours(24)

The maximum age of a request that Scheduler sends to a target for processing.

Minimum value of 60. Maximum value of 86400.

Returns:



85
86
87
# File 'scheduler_targets/fargate_task_props.rb', line 85

def max_event_age
  @max_event_age
end

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

Note:

Default: - LATEST

Specifies the platform version for the task.

Specify only the numeric portion of the platform version, such as 1.1.0. Platform versions determine the underlying runtime environment for the task.



189
190
191
# File 'scheduler_targets/fargate_task_props.rb', line 189

def platform_version
  @platform_version
end

#propagate_tagsBoolean? (readonly)

Note:

Default: - No tag propagation

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

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

Returns:

  • (Boolean, nil)


140
141
142
# File 'scheduler_targets/fargate_task_props.rb', line 140

def propagate_tags
  @propagate_tags
end

#reference_idString? (readonly)

Note:

Default: - No reference ID.

The reference ID to use for the task.

Returns:

  • (String, nil)


145
146
147
# File 'scheduler_targets/fargate_task_props.rb', line 145

def reference_id
  @reference_id
end

#retry_attemptsNumeric? (readonly)

Note:

Default: 185

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

Minimum value of 0. Maximum value of 185.

Returns:

  • (Numeric, nil)


93
94
95
# File 'scheduler_targets/fargate_task_props.rb', line 93

def retry_attempts
  @retry_attempts
end

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

Note:

Default: - created by target

An execution role is an IAM role that EventBridge Scheduler assumes in order to interact with other AWS services on your behalf.

If none provided templates target will automatically create an IAM role with all the minimum necessary permissions to interact with the templated target. If you wish you may specify your own IAM role, then the templated targets will grant minimal required permissions.

Returns:



102
103
104
# File 'scheduler_targets/fargate_task_props.rb', line 102

def role
  @role
end

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

Note:

Default: - The security group for the VPC is used.

The security groups associated with the task.

These security groups must all be in the same VPC. Controls inbound and outbound network access for the task.

Returns:



153
154
155
# File 'scheduler_targets/fargate_task_props.rb', line 153

def security_groups
  @security_groups
end

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

Note:

Default: - No tags

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:



160
161
162
# File 'scheduler_targets/fargate_task_props.rb', line 160

def tags
  @tags
end

#task_countNumeric? (readonly)

Note:

Default: 1

The number of tasks to create based on TaskDefinition.

Returns:

  • (Numeric, nil)


165
166
167
# File 'scheduler_targets/fargate_task_props.rb', line 165

def task_count
  @task_count
end

#task_definitionAWSCDK::ECS::TaskDefinition (readonly)

The task definition to use for scheduled tasks.

Note: this must be TaskDefinition, and not ITaskDefinition, as it requires properties that are not known for imported task definitions If you want to run a RunTask with an imported task definition, consider using a Universal target.



111
112
113
# File 'scheduler_targets/fargate_task_props.rb', line 111

def task_definition
  @task_definition
end

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

Note:

Default: - all private subnets of the VPC are selected.

The subnets associated with the task.

These subnets must all be in the same VPC. The task will be launched in these subnets.



173
174
175
# File 'scheduler_targets/fargate_task_props.rb', line 173

def vpc_subnets
  @vpc_subnets
end

Class Method Details

.jsii_propertiesObject



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'scheduler_targets/fargate_task_props.rb', line 191

def self.jsii_properties
  {
    :dead_letter_queue => "deadLetterQueue",
    :input => "input",
    :max_event_age => "maxEventAge",
    :retry_attempts => "retryAttempts",
    :role => "role",
    :task_definition => "taskDefinition",
    :capacity_provider_strategies => "capacityProviderStrategies",
    :enable_ecs_managed_tags => "enableEcsManagedTags",
    :enable_execute_command => "enableExecuteCommand",
    :group => "group",
    :propagate_tags => "propagateTags",
    :reference_id => "referenceId",
    :security_groups => "securityGroups",
    :tags => "tags",
    :task_count => "taskCount",
    :vpc_subnets => "vpcSubnets",
    :assign_public_ip => "assignPublicIp",
    :platform_version => "platformVersion",
  }
end

Instance Method Details

#to_jsiiObject



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'scheduler_targets/fargate_task_props.rb', line 214

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "deadLetterQueue" => @dead_letter_queue,
    "input" => @input,
    "maxEventAge" => @max_event_age,
    "retryAttempts" => @retry_attempts,
    "role" => @role,
    "taskDefinition" => @task_definition,
    "capacityProviderStrategies" => @capacity_provider_strategies,
    "enableEcsManagedTags" => @enable_ecs_managed_tags,
    "enableExecuteCommand" => @enable_execute_command,
    "group" => @group,
    "propagateTags" => @propagate_tags,
    "referenceId" => @reference_id,
    "securityGroups" => @security_groups,
    "tags" => @tags,
    "taskCount" => @task_count,
    "vpcSubnets" => @vpc_subnets,
    "assignPublicIp" => @assign_public_ip,
    "platformVersion" => @platform_version,
  })
  result.compact
end