Class: AWSCDK::ECSPatterns::ApplicationLoadBalancedTaskImageOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs_patterns/application_load_balanced_task_image_options.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image:, command: nil, container_name: nil, container_port: nil, docker_labels: nil, enable_logging: nil, entry_point: nil, environment: nil, execution_role: nil, family: nil, log_driver: nil, secrets: nil, task_role: nil) ⇒ ApplicationLoadBalancedTaskImageOptions

Returns a new instance of ApplicationLoadBalancedTaskImageOptions.

Parameters:

  • image (AWSCDK::ECS::ContainerImage)

    The image used to start a container.

  • command (Array<String>, nil) (defaults to: nil)

    The command that's passed to the container.

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

    The container name value to be specified in the task definition.

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

    The port number on the container that is bound to the user-specified or automatically assigned host port.

  • docker_labels (Hash{String => String}, nil) (defaults to: nil)

    A key/value map of labels to add to the container.

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

    Flag to indicate whether to enable logging.

  • entry_point (Array<String>, nil) (defaults to: nil)

    The entry point that's passed to the container.

  • environment (Hash{String => String}, nil) (defaults to: nil)

    The environment variables to pass to the container.

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

    The name of the task execution IAM role that grants the Amazon ECS container 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.

  • log_driver (AWSCDK::ECS::LogDriver, nil) (defaults to: nil)

    The log driver to use.

  • secrets (Hash{String => AWSCDK::ECS::Secret}, nil) (defaults to: nil)

    The secret to expose to the container as an environment variable.

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

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



19
20
21
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
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 19

def initialize(image:, command: nil, container_name: nil, container_port: nil, docker_labels: nil, enable_logging: nil, entry_point: nil, environment: nil, execution_role: nil, family: nil, log_driver: nil, secrets: nil, task_role: nil)
  @image = image
  Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckltYWdlIn0=")), "image")
  @command = command
  Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil?
  @container_name = container_name
  Jsii::Type.check_type(@container_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "containerName") unless @container_name.nil?
  @container_port = container_port
  Jsii::Type.check_type(@container_port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "containerPort") unless @container_port.nil?
  @docker_labels = docker_labels
  Jsii::Type.check_type(@docker_labels, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "dockerLabels") unless @docker_labels.nil?
  @enable_logging = enable_logging
  Jsii::Type.check_type(@enable_logging, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableLogging") unless @enable_logging.nil?
  @entry_point = entry_point
  Jsii::Type.check_type(@entry_point, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "entryPoint") unless @entry_point.nil?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "environment") unless @environment.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?
  @log_driver = log_driver
  Jsii::Type.check_type(@log_driver, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxvZ0RyaXZlciJ9")), "logDriver") unless @log_driver.nil?
  @secrets = secrets
  Jsii::Type.check_type(@secrets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuU2VjcmV0In0sImtpbmQiOiJtYXAifX0=")), "secrets") unless @secrets.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

#commandArray<String>? (readonly)

Note:

Default: none

The command that's passed to the container.

If there are multiple arguments, make sure that each argument is a separated string in the array.

This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run.

For more information about the Docker CMD parameter, see https://docs.docker.com/engine/reference/builder/#cmd.

Returns:

  • (Array<String>, nil)


67
68
69
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 67

def command
  @command
end

#container_nameString? (readonly)

Note:

Default: - none

The container name value to be specified in the task definition.

Returns:

  • (String, nil)


72
73
74
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 72

def container_name
  @container_name
end

#container_portNumeric? (readonly)

Note:

Default: 80

The port number on the container that is bound to the user-specified or automatically assigned host port.

If you are using containers in a task with the awsvpc or host network mode, exposed ports should be specified using containerPort. If you are using containers in a task with the bridge network mode and you specify a container port and not a host port, your container automatically receives a host port in the ephemeral port range.

Port mappings that are automatically assigned in this way do not count toward the 100 reserved ports limit of a container instance.

For more information, see hostPort.

Returns:

  • (Numeric, nil)


86
87
88
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 86

def container_port
  @container_port
end

#docker_labelsHash{String => String}? (readonly)

Note:

Default: - No labels.

A key/value map of labels to add to the container.

Returns:

  • (Hash{String => String}, nil)


91
92
93
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 91

def docker_labels
  @docker_labels
end

#enable_loggingBoolean? (readonly)

Note:

Default: true

Flag to indicate whether to enable logging.

Returns:

  • (Boolean, nil)


96
97
98
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 96

def enable_logging
  @enable_logging
end

#entry_pointArray<String>? (readonly)

Note:

Default: none

The entry point that's passed to the container.

This parameter maps to Entrypoint in the Create a container section of the Docker Remote API and the --entrypoint option to docker run.

For more information about the Docker ENTRYPOINT parameter, see https://docs.docker.com/engine/reference/builder/#entrypoint.

Returns:

  • (Array<String>, nil)


107
108
109
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 107

def entry_point
  @entry_point
end

#environmentHash{String => String}? (readonly)

Note:

Default: - No environment variables.

The environment variables to pass to the container.

Returns:

  • (Hash{String => String}, nil)


112
113
114
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 112

def environment
  @environment
end

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

Note:

Default: - No value

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

Returns:



117
118
119
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 117

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)


124
125
126
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 124

def family
  @family
end

#imageAWSCDK::ECS::ContainerImage (readonly)

Note:

Default: - none

The image used to start a container.

Image or taskDefinition must be specified, not both.



54
55
56
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 54

def image
  @image
end

#log_driverAWSCDK::ECS::LogDriver? (readonly)

Note:

Default: - AwsLogDriver if enableLogging is true

The log driver to use.

Returns:



129
130
131
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 129

def log_driver
  @log_driver
end

#secretsHash{String => AWSCDK::ECS::Secret}? (readonly)

Note:

Default: - No secret environment variables.

The secret to expose to the container as an environment variable.

Returns:



134
135
136
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 134

def secrets
  @secrets
end

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

Note:

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

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

Returns:



139
140
141
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 139

def task_role
  @task_role
end

Class Method Details

.jsii_propertiesObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 141

def self.jsii_properties
  {
    :image => "image",
    :command => "command",
    :container_name => "containerName",
    :container_port => "containerPort",
    :docker_labels => "dockerLabels",
    :enable_logging => "enableLogging",
    :entry_point => "entryPoint",
    :environment => "environment",
    :execution_role => "executionRole",
    :family => "family",
    :log_driver => "logDriver",
    :secrets => "secrets",
    :task_role => "taskRole",
  }
end

Instance Method Details

#to_jsiiObject



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'ecs_patterns/application_load_balanced_task_image_options.rb', line 159

def to_jsii
  result = {}
  result.merge!({
    "image" => @image,
    "command" => @command,
    "containerName" => @container_name,
    "containerPort" => @container_port,
    "dockerLabels" => @docker_labels,
    "enableLogging" => @enable_logging,
    "entryPoint" => @entry_point,
    "environment" => @environment,
    "executionRole" => @execution_role,
    "family" => @family,
    "logDriver" => @log_driver,
    "secrets" => @secrets,
    "taskRole" => @task_role,
  })
  result.compact
end