Class: AWSCDK::ECS::TaskDefinitionAttributes

Inherits:
CommonTaskDefinitionAttributes
  • Object
show all
Defined in:
ecs/task_definition_attributes.rb

Overview

A reference to an existing task definition.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_definition_arn:, execution_role: nil, network_mode: nil, task_role: nil, compatibility: nil) ⇒ TaskDefinitionAttributes

Returns a new instance of TaskDefinitionAttributes.

Parameters:

  • task_definition_arn (String)

    The arn of the task definition.

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

    The IAM role that grants containers and Fargate agents permission to make AWS API calls on your behalf.

  • network_mode (AWSCDK::ECS::NetworkMode, nil) (defaults to: nil)

    The networking mode to use for the containers in the task.

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

    The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.

  • compatibility (AWSCDK::ECS::Compatibility, nil) (defaults to: nil)

    What launch types this task definition should be compatible with.



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

def initialize(task_definition_arn:, execution_role: nil, network_mode: nil, task_role: nil, compatibility: nil)
  @task_definition_arn = task_definition_arn
  Jsii::Type.check_type(@task_definition_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "taskDefinitionArn")
  @execution_role = execution_role
  Jsii::Type.check_type(@execution_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "executionRole") unless @execution_role.nil?
  @network_mode = network_mode
  Jsii::Type.check_type(@network_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLk5ldHdvcmtNb2RlIn0=")), "networkMode") unless @network_mode.nil?
  @task_role = task_role
  Jsii::Type.check_type(@task_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "taskRole") unless @task_role.nil?
  @compatibility = compatibility
  Jsii::Type.check_type(@compatibility, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbXBhdGliaWxpdHkifQ==")), "compatibility") unless @compatibility.nil?
end

Instance Attribute Details

#compatibilityAWSCDK::ECS::Compatibility? (readonly)

Note:

Default: Compatibility.EC2_AND_FARGATE

What launch types this task definition should be compatible with.

Returns:



50
51
52
# File 'ecs/task_definition_attributes.rb', line 50

def compatibility
  @compatibility
end

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

Note:

Default: - undefined

The IAM role that grants containers and Fargate agents permission to make AWS API calls on your behalf.

Some tasks do not have an execution role.

Returns:



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

def execution_role
  @execution_role
end

#network_modeAWSCDK::ECS::NetworkMode? (readonly)

Note:

Default: Network mode cannot be provided to the imported task.

The networking mode to use for the containers in the task.

Returns:



40
41
42
# File 'ecs/task_definition_attributes.rb', line 40

def network_mode
  @network_mode
end

#task_definition_arnString (readonly)

The arn of the task definition.

Returns:

  • (String)


28
29
30
# File 'ecs/task_definition_attributes.rb', line 28

def task_definition_arn
  @task_definition_arn
end

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

Note:

Default: Permissions cannot be granted to the imported task.

The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.

Returns:



45
46
47
# File 'ecs/task_definition_attributes.rb', line 45

def task_role
  @task_role
end

Class Method Details

.jsii_propertiesObject



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

def self.jsii_properties
  {
    :task_definition_arn => "taskDefinitionArn",
    :execution_role => "executionRole",
    :network_mode => "networkMode",
    :task_role => "taskRole",
    :compatibility => "compatibility",
  }
end

Instance Method Details

#to_jsiiObject



62
63
64
65
66
67
68
69
70
71
72
73
# File 'ecs/task_definition_attributes.rb', line 62

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "taskDefinitionArn" => @task_definition_arn,
    "executionRole" => @execution_role,
    "networkMode" => @network_mode,
    "taskRole" => @task_role,
    "compatibility" => @compatibility,
  })
  result.compact
end