Class: AWSCDK::ECS::EC2TaskDefinition
- Inherits:
-
TaskDefinition
- Object
- TaskDefinition
- AWSCDK::ECS::EC2TaskDefinition
- Includes:
- IEC2TaskDefinition
- Defined in:
- ecs/ec2_task_definition.rb
Overview
The details of a task definition run on an EC2 cluster.
Class Method Summary collapse
-
.from_ec2_task_definition_arn(scope, id, ec2_task_definition_arn) ⇒ AWSCDK::ECS::IEC2TaskDefinition
Imports a task definition from the specified task definition ARN.
-
.from_ec2_task_definition_attributes(scope, id, attrs) ⇒ AWSCDK::ECS::IEC2TaskDefinition
Imports an existing Ec2 task definition from its attributes.
- .jsii_overridable_methods ⇒ Object
-
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
Instance Method Summary collapse
-
#add_container(id, props) ⇒ AWSCDK::ECS::ContainerDefinition
Tasks running in AWSVPC networking mode requires an additional environment variable for the region to be sourced.
-
#add_extension(extension) ⇒ void
Adds the specified extension to the task definition.
-
#add_firelens_log_router(id, props) ⇒ AWSCDK::ECS::FirelensLogRouter
Adds a firelens log router to the task definition.
-
#add_inference_accelerator(inference_accelerator) ⇒ void
deprecated
Deprecated.
ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
-
#add_placement_constraint(constraint) ⇒ void
Adds the specified placement constraint to the task definition.
-
#add_to_execution_role_policy(statement) ⇒ void
Adds a policy statement to the task execution IAM role.
-
#add_to_task_role_policy(statement) ⇒ void
Adds a policy statement to the task IAM role.
-
#add_volume(volume) ⇒ void
Adds a volume to the task definition.
-
#apply_cross_stack_reference_strength(strength) ⇒ void
Override the cross-stack reference strength for this resource.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#compatibility ⇒ AWSCDK::ECS::Compatibility
The task launch type compatibility requirement.
-
#containers ⇒ Array<AWSCDK::ECS::ContainerDefinition>
The container definitions.
-
#default_container ⇒ AWSCDK::ECS::ContainerDefinition?
Default container for this task.
- #default_container=(value) ⇒ Object
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
-
#ephemeral_storage_gib ⇒ Numeric?
The amount (in GiB) of ephemeral storage to be allocated to the task.
-
#execution_role ⇒ AWSCDK::IAM::IRole?
Execution role for this task definition.
-
#family ⇒ String
The name of a family that this task definition is registered to.
-
#find_container(container_name) ⇒ AWSCDK::ECS::ContainerDefinition?
Returns the container that match the provided containerName.
-
#find_port_mapping_by_name(name) ⇒ AWSCDK::ECS::PortMapping?
Determine the existing port mapping for the provided name.
- #generate_physical_name ⇒ String
-
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g.
bucket.bucketArn). -
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g.
bucket.bucketName). -
#grant_run(grantee) ⇒ AWSCDK::IAM::Grant
Grants permissions to run this task definition.
-
#inference_accelerators ⇒ Array<AWSCDK::ECS::InferenceAccelerator>
Public getter method to access list of inference accelerators attached to the instance.
-
#initialize(scope, id, props = nil) ⇒ EC2TaskDefinition
constructor
Constructs a new instance of the Ec2TaskDefinition class.
-
#is_ec2_compatible ⇒ Boolean
Return true if the task definition can be run on an EC2 cluster.
-
#is_external_compatible ⇒ Boolean
Return true if the task definition can be run on a ECS anywhere cluster.
-
#is_fargate_compatible ⇒ Boolean
Return true if the task definition can be run on a Fargate cluster.
-
#is_managed_instances_compatible ⇒ Boolean
Return true if the task definition can be run on Managed Instances.
-
#network_mode ⇒ AWSCDK::ECS::NetworkMode
The networking mode to use for the containers in the task.
-
#node ⇒ Constructs::Node
The tree node.
-
#obtain_execution_role ⇒ AWSCDK::IAM::IRole
Creates the task execution IAM role if it doesn't already exist.
-
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
-
#pid_mode ⇒ AWSCDK::ECS::PidMode?
The process namespace to use for the containers in the task.
-
#references_secret_json_field ⇒ Boolean?
Whether this task definition has at least a container that references a specific JSON field of a secret stored in Secrets Manager.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#task_definition_arn ⇒ String
The full Amazon Resource Name (ARN) of the task definition.
-
#task_definition_ref ⇒ AWSCDK::Interfaces::AWSECS::TaskDefinitionReference
A reference to this task definition.
-
#task_role ⇒ AWSCDK::IAM::IRole
The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props = nil) ⇒ EC2TaskDefinition
Constructs a new instance of the Ec2TaskDefinition class.
14 15 16 17 18 19 20 |
# File 'ecs/ec2_task_definition.rb', line 14 def initialize(scope, id, props = nil) props = props.is_a?(Hash) ? ::AWSCDK::ECS::EC2TaskDefinitionProps.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkVjMlRhc2tEZWZpbml0aW9uUHJvcHMifQ==")), "props") unless props.nil? Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.from_ec2_task_definition_arn(scope, id, ec2_task_definition_arn) ⇒ AWSCDK::ECS::IEC2TaskDefinition
Imports a task definition from the specified task definition ARN.
73 74 75 76 77 78 |
# File 'ecs/ec2_task_definition.rb', line 73 def self.from_ec2_task_definition_arn(scope, id, ec2_task_definition_arn) 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(ec2_task_definition_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ec2TaskDefinitionArn") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.Ec2TaskDefinition", "fromEc2TaskDefinitionArn", [scope, id, ec2_task_definition_arn]) end |
.from_ec2_task_definition_attributes(scope, id, attrs) ⇒ AWSCDK::ECS::IEC2TaskDefinition
Imports an existing Ec2 task definition from its attributes.
86 87 88 89 90 91 92 |
# File 'ecs/ec2_task_definition.rb', line 86 def self.from_ec2_task_definition_attributes(scope, id, attrs) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") attrs = attrs.is_a?(Hash) ? ::AWSCDK::ECS::EC2TaskDefinitionAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkVjMlRhc2tEZWZpbml0aW9uQXR0cmlidXRlcyJ9")), "attrs") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.Ec2TaskDefinition", "fromEc2TaskDefinitionAttributes", [scope, id, attrs]) end |
.jsii_overridable_methods ⇒ Object
22 23 24 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 63 64 65 |
# File 'ecs/ec2_task_definition.rb', line 22 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :physical_name => { kind: :property, name: "physicalName", is_optional: false }, :stack => { kind: :property, name: "stack", is_optional: false }, :compatibility => { kind: :property, name: "compatibility", is_optional: false }, :containers => { kind: :property, name: "containers", is_optional: false }, :family => { kind: :property, name: "family", is_optional: false }, :inference_accelerators => { kind: :property, name: "inferenceAccelerators", is_optional: false }, :is_ec2_compatible => { kind: :property, name: "isEc2Compatible", is_optional: false }, :is_external_compatible => { kind: :property, name: "isExternalCompatible", is_optional: false }, :is_fargate_compatible => { kind: :property, name: "isFargateCompatible", is_optional: false }, :is_managed_instances_compatible => { kind: :property, name: "isManagedInstancesCompatible", is_optional: false }, :network_mode => { kind: :property, name: "networkMode", is_optional: false }, :task_definition_arn => { kind: :property, name: "taskDefinitionArn", is_optional: false }, :task_definition_ref => { kind: :property, name: "taskDefinitionRef", is_optional: false }, :task_role => { kind: :property, name: "taskRole", is_optional: false }, :ephemeral_storage_gib => { kind: :property, name: "ephemeralStorageGiB", is_optional: true }, :execution_role => { kind: :property, name: "executionRole", is_optional: true }, :pid_mode => { kind: :property, name: "pidMode", is_optional: true }, :references_secret_json_field => { kind: :property, name: "referencesSecretJsonField", is_optional: true }, :default_container => { kind: :property, name: "defaultContainer", is_optional: true }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false }, :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false }, :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false }, :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false }, :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false }, :add_container => { kind: :method, name: "addContainer", is_optional: false }, :add_extension => { kind: :method, name: "addExtension", is_optional: false }, :add_firelens_log_router => { kind: :method, name: "addFirelensLogRouter", is_optional: false }, :add_inference_accelerator => { kind: :method, name: "addInferenceAccelerator", is_optional: false }, :add_placement_constraint => { kind: :method, name: "addPlacementConstraint", is_optional: false }, :add_to_execution_role_policy => { kind: :method, name: "addToExecutionRolePolicy", is_optional: false }, :add_to_task_role_policy => { kind: :method, name: "addToTaskRolePolicy", is_optional: false }, :add_volume => { kind: :method, name: "addVolume", is_optional: false }, :find_container => { kind: :method, name: "findContainer", is_optional: false }, :find_port_mapping_by_name => { kind: :method, name: "findPortMappingByName", is_optional: false }, :grant_run => { kind: :method, name: "grantRun", is_optional: false }, :obtain_execution_role => { kind: :method, name: "obtainExecutionRole", is_optional: false }, } end |
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
140 141 142 |
# File 'ecs/ec2_task_definition.rb', line 140 def self.PROPERTY_INJECTION_ID() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ecs.Ec2TaskDefinition", "PROPERTY_INJECTION_ID") end |
Instance Method Details
#add_container(id, props) ⇒ AWSCDK::ECS::ContainerDefinition
Tasks running in AWSVPC networking mode requires an additional environment variable for the region to be sourced.
This override adds in the additional environment variable as required
379 380 381 382 383 384 |
# File 'ecs/ec2_task_definition.rb', line 379 def add_container(id, props) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") props = props.is_a?(Hash) ? ::AWSCDK::ECS::ContainerDefinitionOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckRlZmluaXRpb25PcHRpb25zIn0=")), "props") jsii_call_method("addContainer", [id, props]) end |
#add_extension(extension) ⇒ void
This method returns an undefined value.
Adds the specified extension to the task definition.
Extension can be used to apply a packaged modification to a task definition.
393 394 395 396 |
# File 'ecs/ec2_task_definition.rb', line 393 def add_extension(extension) Jsii::Type.check_type(extension, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLklUYXNrRGVmaW5pdGlvbkV4dGVuc2lvbiJ9")), "extension") jsii_call_method("addExtension", [extension]) end |
#add_firelens_log_router(id, props) ⇒ AWSCDK::ECS::FirelensLogRouter
Adds a firelens log router to the task definition.
403 404 405 406 407 408 |
# File 'ecs/ec2_task_definition.rb', line 403 def add_firelens_log_router(id, props) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") props = props.is_a?(Hash) ? ::AWSCDK::ECS::FirelensLogRouterDefinitionOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkZpcmVsZW5zTG9nUm91dGVyRGVmaW5pdGlvbk9wdGlvbnMifQ==")), "props") jsii_call_method("addFirelensLogRouter", [id, props]) end |
#add_inference_accelerator(inference_accelerator) ⇒ void
ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
This method returns an undefined value.
Adds an inference accelerator to the task definition.
415 416 417 418 419 |
# File 'ecs/ec2_task_definition.rb', line 415 def add_inference_accelerator(inference_accelerator) inference_accelerator = inference_accelerator.is_a?(Hash) ? ::AWSCDK::ECS::InferenceAccelerator.new(**inference_accelerator.transform_keys(&:to_sym)) : inference_accelerator Jsii::Type.check_type(inference_accelerator, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkluZmVyZW5jZUFjY2VsZXJhdG9yIn0=")), "inferenceAccelerator") jsii_call_method("addInferenceAccelerator", [inference_accelerator]) end |
#add_placement_constraint(constraint) ⇒ void
This method returns an undefined value.
Adds the specified placement constraint to the task definition.
425 426 427 428 |
# File 'ecs/ec2_task_definition.rb', line 425 def add_placement_constraint(constraint) Jsii::Type.check_type(constraint, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlBsYWNlbWVudENvbnN0cmFpbnQifQ==")), "constraint") jsii_call_method("addPlacementConstraint", [constraint]) end |
#add_to_execution_role_policy(statement) ⇒ void
This method returns an undefined value.
Adds a policy statement to the task execution IAM role.
434 435 436 437 |
# File 'ecs/ec2_task_definition.rb', line 434 def add_to_execution_role_policy(statement) Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement") jsii_call_method("addToExecutionRolePolicy", [statement]) end |
#add_to_task_role_policy(statement) ⇒ void
This method returns an undefined value.
Adds a policy statement to the task IAM role.
443 444 445 446 |
# File 'ecs/ec2_task_definition.rb', line 443 def add_to_task_role_policy(statement) Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement") jsii_call_method("addToTaskRolePolicy", [statement]) end |
#add_volume(volume) ⇒ void
This method returns an undefined value.
Adds a volume to the task definition.
452 453 454 455 456 |
# File 'ecs/ec2_task_definition.rb', line 452 def add_volume(volume) volume = volume.is_a?(Hash) ? ::AWSCDK::ECS::Volume.new(**volume.transform_keys(&:to_sym)) : volume Jsii::Type.check_type(volume, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlZvbHVtZSJ9")), "volume") jsii_call_method("addVolume", [volume]) end |
#apply_cross_stack_reference_strength(strength) ⇒ void
This method returns an undefined value.
Override the cross-stack reference strength for this resource.
When set, any cross-stack reference to this resource will use the specified
mechanism instead of the global default determined by the
@aws-cdk/core:defaultCrossStackReferences context key. This is useful for
selectively weakening specific references to avoid the "deadly embrace" problem
without changing the app-wide default.
315 316 317 318 |
# File 'ecs/ec2_task_definition.rb', line 315 def apply_cross_stack_reference_strength(strength) Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength") jsii_call_method("applyCrossStackReferenceStrength", [strength]) end |
#apply_removal_policy(policy) ⇒ void
This method returns an undefined value.
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
332 333 334 335 |
# File 'ecs/ec2_task_definition.rb', line 332 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#compatibility ⇒ AWSCDK::ECS::Compatibility
The task launch type compatibility requirement.
147 148 149 |
# File 'ecs/ec2_task_definition.rb', line 147 def compatibility() jsii_get_property("compatibility") end |
#containers ⇒ Array<AWSCDK::ECS::ContainerDefinition>
The container definitions.
154 155 156 |
# File 'ecs/ec2_task_definition.rb', line 154 def containers() jsii_get_property("containers") end |
#default_container ⇒ AWSCDK::ECS::ContainerDefinition?
Default container for this task.
Load balancers will send traffic to this container. The first essential container that is added to this task will become the default container.
273 274 275 |
# File 'ecs/ec2_task_definition.rb', line 273 def default_container() jsii_get_property("defaultContainer") end |
#default_container=(value) ⇒ Object
277 278 279 280 |
# File 'ecs/ec2_task_definition.rb', line 277 def default_container=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckRlZmluaXRpb24ifQ==")), "defaultContainer") unless value.nil? jsii_set_property("defaultContainer", value) end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
112 113 114 |
# File 'ecs/ec2_task_definition.rb', line 112 def env() jsii_get_property("env") end |
#ephemeral_storage_gib ⇒ Numeric?
The amount (in GiB) of ephemeral storage to be allocated to the task.
Only supported in Fargate platform version 1.4.0 or later.
235 236 237 |
# File 'ecs/ec2_task_definition.rb', line 235 def ephemeral_storage_gib() jsii_get_property("ephemeralStorageGiB") end |
#execution_role ⇒ AWSCDK::IAM::IRole?
Execution role for this task definition.
242 243 244 |
# File 'ecs/ec2_task_definition.rb', line 242 def execution_role() jsii_get_property("executionRole") end |
#family ⇒ String
The name of a family that this task definition is registered to.
A family groups multiple versions of a task definition.
163 164 165 |
# File 'ecs/ec2_task_definition.rb', line 163 def family() jsii_get_property("family") end |
#find_container(container_name) ⇒ AWSCDK::ECS::ContainerDefinition?
Returns the container that match the provided containerName.
462 463 464 465 |
# File 'ecs/ec2_task_definition.rb', line 462 def find_container(container_name) Jsii::Type.check_type(container_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "containerName") jsii_call_method("findContainer", [container_name]) end |
#find_port_mapping_by_name(name) ⇒ AWSCDK::ECS::PortMapping?
Determine the existing port mapping for the provided name.
471 472 473 474 |
# File 'ecs/ec2_task_definition.rb', line 471 def find_port_mapping_by_name(name) Jsii::Type.check_type(name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") jsii_call_method("findPortMappingByName", [name]) end |
#generate_physical_name ⇒ String
338 339 340 |
# File 'ecs/ec2_task_definition.rb', line 338 def generate_physical_name() jsii_call_method("generatePhysicalName", []) end |
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).
Normally, this token will resolve to arn_attr, but if the resource is
referenced across environments, arn_components will be used to synthesize
a concrete ARN with the resource's physical name. Make sure to reference
this.physicalName in arn_components.
352 353 354 355 356 357 |
# File 'ecs/ec2_task_definition.rb', line 352 def get_resource_arn_attribute(arn_attr, arn_components) Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr") arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents") jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components]) end |
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).
Normally, this token will resolve to name_attr, but if the resource is
referenced across environments, it will be resolved to this.physicalName,
which will be a concrete name.
367 368 369 370 |
# File 'ecs/ec2_task_definition.rb', line 367 def get_resource_name_attribute(name_attr) Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr") jsii_call_method("getResourceNameAttribute", [name_attr]) end |
#grant_run(grantee) ⇒ AWSCDK::IAM::Grant
Grants permissions to run this task definition.
This will grant the following permissions:
- ecs:RunTask
- iam:PassRole
[disable-awslint:no-grants]
487 488 489 490 |
# File 'ecs/ec2_task_definition.rb', line 487 def grant_run(grantee) Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee") jsii_call_method("grantRun", [grantee]) end |
#inference_accelerators ⇒ Array<AWSCDK::ECS::InferenceAccelerator>
Public getter method to access list of inference accelerators attached to the instance.
170 171 172 |
# File 'ecs/ec2_task_definition.rb', line 170 def inference_accelerators() jsii_get_property("inferenceAccelerators") end |
#is_ec2_compatible ⇒ Boolean
Return true if the task definition can be run on an EC2 cluster.
177 178 179 |
# File 'ecs/ec2_task_definition.rb', line 177 def is_ec2_compatible() jsii_get_property("isEc2Compatible") end |
#is_external_compatible ⇒ Boolean
Return true if the task definition can be run on a ECS anywhere cluster.
184 185 186 |
# File 'ecs/ec2_task_definition.rb', line 184 def is_external_compatible() jsii_get_property("isExternalCompatible") end |
#is_fargate_compatible ⇒ Boolean
Return true if the task definition can be run on a Fargate cluster.
191 192 193 |
# File 'ecs/ec2_task_definition.rb', line 191 def is_fargate_compatible() jsii_get_property("isFargateCompatible") end |
#is_managed_instances_compatible ⇒ Boolean
Return true if the task definition can be run on Managed Instances.
198 199 200 |
# File 'ecs/ec2_task_definition.rb', line 198 def is_managed_instances_compatible() jsii_get_property("isManagedInstancesCompatible") end |
#network_mode ⇒ AWSCDK::ECS::NetworkMode
The networking mode to use for the containers in the task.
205 206 207 |
# File 'ecs/ec2_task_definition.rb', line 205 def network_mode() jsii_get_property("networkMode") end |
#node ⇒ Constructs::Node
The tree node.
97 98 99 |
# File 'ecs/ec2_task_definition.rb', line 97 def node() jsii_get_property("node") end |
#obtain_execution_role ⇒ AWSCDK::IAM::IRole
Creates the task execution IAM role if it doesn't already exist.
495 496 497 |
# File 'ecs/ec2_task_definition.rb', line 495 def obtain_execution_role() jsii_call_method("obtainExecutionRole", []) end |
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
This value will resolve to one of the following:
- a concrete value (e.g.
"my-awesome-bucket") undefined, when a name should be generated by CloudFormation- a concrete name generated automatically during synthesis, in cross-environment scenarios.
126 127 128 |
# File 'ecs/ec2_task_definition.rb', line 126 def physical_name() jsii_get_property("physicalName") end |
#pid_mode ⇒ AWSCDK::ECS::PidMode?
The process namespace to use for the containers in the task.
Only supported for tasks that are hosted on AWS Fargate if the tasks are using platform version 1.4.0 or later (Linux). Not supported in Windows containers. If pidMode is specified for a Fargate task, then runtimePlatform.operatingSystemFamily must also be specified. For more information, see Task Definition Parameters.
255 256 257 |
# File 'ecs/ec2_task_definition.rb', line 255 def pid_mode() jsii_get_property("pidMode") end |
#references_secret_json_field ⇒ Boolean?
Whether this task definition has at least a container that references a specific JSON field of a secret stored in Secrets Manager.
262 263 264 |
# File 'ecs/ec2_task_definition.rb', line 262 def references_secret_json_field() jsii_get_property("referencesSecretJsonField") end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
133 134 135 |
# File 'ecs/ec2_task_definition.rb', line 133 def stack() jsii_get_property("stack") end |
#task_definition_arn ⇒ String
The full Amazon Resource Name (ARN) of the task definition.
212 213 214 |
# File 'ecs/ec2_task_definition.rb', line 212 def task_definition_arn() jsii_get_property("taskDefinitionArn") end |
#task_definition_ref ⇒ AWSCDK::Interfaces::AWSECS::TaskDefinitionReference
A reference to this task definition.
219 220 221 |
# File 'ecs/ec2_task_definition.rb', line 219 def task_definition_ref() jsii_get_property("taskDefinitionRef") end |
#task_role ⇒ AWSCDK::IAM::IRole
The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
226 227 228 |
# File 'ecs/ec2_task_definition.rb', line 226 def task_role() jsii_get_property("taskRole") end |
#to_string ⇒ String
Returns a string representation of this construct.
285 286 287 |
# File 'ecs/ec2_task_definition.rb', line 285 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.
298 299 300 301 302 303 |
# File 'ecs/ec2_task_definition.rb', line 298 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 |