Class: AWSCDK::ECS::ExternalTaskDefinitionProps

Inherits:
CommonTaskDefinitionProps
  • Object
show all
Defined in:
ecs/external_task_definition_props.rb

Overview

The properties for a task definition run on an External cluster.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enable_fault_injection: nil, execution_role: nil, family: nil, proxy_configuration: nil, task_role: nil, volumes: nil, network_mode: nil) ⇒ ExternalTaskDefinitionProps

Returns a new instance of ExternalTaskDefinitionProps.

Parameters:

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

    Enables fault injection and allows for fault injection requests to be accepted from the task's containers.

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

    The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.

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

    The name of a family that this task definition is registered to.

  • proxy_configuration (AWSCDK::ECS::ProxyConfiguration, nil) (defaults to: nil)

    The configuration details for the App Mesh proxy.

  • 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.

  • volumes (Array<AWSCDK::ECS::Volume>, nil) (defaults to: nil)

    The list of volume definitions for the task.

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

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



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'ecs/external_task_definition_props.rb', line 14

def initialize(enable_fault_injection: nil, execution_role: nil, family: nil, proxy_configuration: nil, task_role: nil, volumes: nil, network_mode: nil)
  @enable_fault_injection = enable_fault_injection
  Jsii::Type.check_type(@enable_fault_injection, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableFaultInjection") unless @enable_fault_injection.nil?
  @execution_role = execution_role
  Jsii::Type.check_type(@execution_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "executionRole") unless @execution_role.nil?
  @family = family
  Jsii::Type.check_type(@family, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "family") unless @family.nil?
  @proxy_configuration = proxy_configuration
  Jsii::Type.check_type(@proxy_configuration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlByb3h5Q29uZmlndXJhdGlvbiJ9")), "proxyConfiguration") unless @proxy_configuration.nil?
  @task_role = task_role
  Jsii::Type.check_type(@task_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "taskRole") unless @task_role.nil?
  @volumes = volumes.is_a?(Array) ? volumes.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::Volume.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : volumes
  Jsii::Type.check_type(@volumes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuVm9sdW1lIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "volumes") unless @volumes.nil?
  @network_mode = network_mode
  Jsii::Type.check_type(@network_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLk5ldHdvcmtNb2RlIn0=")), "networkMode") unless @network_mode.nil?
end

Instance Attribute Details

#enable_fault_injectionBoolean? (readonly)

Note:

Default: undefined - ECS default setting is false

Enables fault injection and allows for fault injection requests to be accepted from the task's containers.

Fault injection only works with tasks using the NetworkMode.AWS_VPC or NetworkMode.HOST network modes.

Returns:

  • (Boolean, nil)


37
38
39
# File 'ecs/external_task_definition_props.rb', line 37

def enable_fault_injection
  @enable_fault_injection
end

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

Note:

Default: - An execution role will be automatically created if you use ECR images in your task definition.

The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.

The role will be used to retrieve container images from ECR and create CloudWatch log groups.

Returns:



44
45
46
# File 'ecs/external_task_definition_props.rb', line 44

def execution_role
  @execution_role
end

#familyString? (readonly)

Note:

Default: - Automatically generated name.

The name of a family that this task definition is registered to.

A family groups multiple versions of a task definition.

Returns:

  • (String, nil)


51
52
53
# File 'ecs/external_task_definition_props.rb', line 51

def family
  @family
end

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

Note:

Default: NetworkMode.BRIDGE

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

With ECS Anywhere, supported modes are bridge, host and none.

Returns:



76
77
78
# File 'ecs/external_task_definition_props.rb', line 76

def network_mode
  @network_mode
end

#proxy_configurationAWSCDK::ECS::ProxyConfiguration? (readonly)

Note:

Default: - No proxy configuration.

The configuration details for the App Mesh proxy.



56
57
58
# File 'ecs/external_task_definition_props.rb', line 56

def proxy_configuration
  @proxy_configuration
end

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

Note:

Default: - A task role is automatically created for you.

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

Returns:



61
62
63
# File 'ecs/external_task_definition_props.rb', line 61

def task_role
  @task_role
end

#volumesArray<AWSCDK::ECS::Volume>? (readonly)

Note:

Default: - No volumes are passed to the Docker daemon on a container instance.

The list of volume definitions for the task.

For more information, see Task Definition Parameter Volumes.

Returns:



69
70
71
# File 'ecs/external_task_definition_props.rb', line 69

def volumes
  @volumes
end

Class Method Details

.jsii_propertiesObject



78
79
80
81
82
83
84
85
86
87
88
# File 'ecs/external_task_definition_props.rb', line 78

def self.jsii_properties
  {
    :enable_fault_injection => "enableFaultInjection",
    :execution_role => "executionRole",
    :family => "family",
    :proxy_configuration => "proxyConfiguration",
    :task_role => "taskRole",
    :volumes => "volumes",
    :network_mode => "networkMode",
  }
end

Instance Method Details

#to_jsiiObject



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'ecs/external_task_definition_props.rb', line 90

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "enableFaultInjection" => @enable_fault_injection,
    "executionRole" => @execution_role,
    "family" => @family,
    "proxyConfiguration" => @proxy_configuration,
    "taskRole" => @task_role,
    "volumes" => @volumes,
    "networkMode" => @network_mode,
  })
  result.compact
end