Class: AWSCDK::ECSPatterns::ScheduledFargateTaskImageOptions

Inherits:
ScheduledTaskImageProps
  • Object
show all
Defined in:
ecs_patterns/scheduled_fargate_task_image_options.rb

Overview

The properties for the ScheduledFargateTask using an image.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image:, command: nil, container_name: nil, environment: nil, log_driver: nil, secrets: nil, circuit_breaker: nil, cpu: nil, ephemeral_storage_gib: nil, memory_limit_mib: nil, platform_version: nil, runtime_platform: nil, task_definition: nil) ⇒ ScheduledFargateTaskImageOptions

Returns a new instance of ScheduledFargateTaskImageOptions.

Parameters:

  • image (AWSCDK::ECS::ContainerImage)

    The image used to start a container.

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

    The command that is passed to the container.

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

    Optional name for the container added.

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

    The environment variables to pass to the container.

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

  • circuit_breaker (AWSCDK::ECS::DeploymentCircuitBreaker, nil) (defaults to: nil)

    Whether to enable the deployment circuit breaker.

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

    The number of cpu units used by the task.

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

    The amount (in GiB) of ephemeral storage to be allocated to the task.

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

    The amount (in MiB) of memory used by the task.

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

    The platform version on which to run your service.

  • runtime_platform (AWSCDK::ECS::RuntimePlatform, nil) (defaults to: nil)

    The runtime platform of the task definition.

  • task_definition (AWSCDK::ECS::FargateTaskDefinition, nil) (defaults to: nil)

    The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both.



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
47
48
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 21

def initialize(image:, command: nil, container_name: nil, environment: nil, log_driver: nil, secrets: nil, circuit_breaker: nil, cpu: nil, ephemeral_storage_gib: nil, memory_limit_mib: nil, platform_version: nil, runtime_platform: nil, task_definition: 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?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "environment") unless @environment.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?
  @circuit_breaker = circuit_breaker.is_a?(Hash) ? ::AWSCDK::ECS::DeploymentCircuitBreaker.new(**circuit_breaker.transform_keys(&:to_sym)) : circuit_breaker
  Jsii::Type.check_type(@circuit_breaker, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkRlcGxveW1lbnRDaXJjdWl0QnJlYWtlciJ9")), "circuitBreaker") unless @circuit_breaker.nil?
  @cpu = cpu
  Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpu") unless @cpu.nil?
  @ephemeral_storage_gib = ephemeral_storage_gib
  Jsii::Type.check_type(@ephemeral_storage_gib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ephemeralStorageGiB") unless @ephemeral_storage_gib.nil?
  @memory_limit_mib = memory_limit_mib
  Jsii::Type.check_type(@memory_limit_mib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "memoryLimitMiB") unless @memory_limit_mib.nil?
  @platform_version = platform_version
  Jsii::Type.check_type(@platform_version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkZhcmdhdGVQbGF0Zm9ybVZlcnNpb24ifQ==")), "platformVersion") unless @platform_version.nil?
  @runtime_platform = runtime_platform.is_a?(Hash) ? ::AWSCDK::ECS::RuntimePlatform.new(**runtime_platform.transform_keys(&:to_sym)) : runtime_platform
  Jsii::Type.check_type(@runtime_platform, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlJ1bnRpbWVQbGF0Zm9ybSJ9")), "runtimePlatform") unless @runtime_platform.nil?
  @task_definition = task_definition
  Jsii::Type.check_type(@task_definition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkZhcmdhdGVUYXNrRGVmaW5pdGlvbiJ9")), "taskDefinition") unless @task_definition.nil?
end

Instance Attribute Details

#circuit_breakerAWSCDK::ECS::DeploymentCircuitBreaker? (readonly)

Note:

Default: - disabled

Whether to enable the deployment circuit breaker.

If this property is defined, circuit breaker will be implicitly enabled.



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

def circuit_breaker
  @circuit_breaker
end

#commandArray<String>? (readonly)

Note:

Default: - CMD value built into container image.

The command that is passed to the container.

If you provide a shell command as a single string, you have to quote command-line arguments.

Returns:

  • (Array<String>, nil)


63
64
65
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 63

def command
  @command
end

#container_nameString? (readonly)

Note:

Default: - ScheduledContainer

Optional name for the container added.

Returns:

  • (String, nil)


68
69
70
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 68

def container_name
  @container_name
end

#cpuNumeric? (readonly)

Note:

Default: 256

The number of cpu units used by the task.

Valid values, which determines your range of valid values for the memory parameter:

256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB

512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB

1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB

2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments

4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments

8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments

16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments

This default is set in the underlying FargateTaskDefinition construct.

Returns:

  • (Numeric, nil)


114
115
116
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 114

def cpu
  @cpu
end

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

Note:

Default: none

The environment variables to pass to the container.

Returns:

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


73
74
75
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 73

def environment
  @environment
end

#ephemeral_storage_gibNumeric? (readonly)

Note:

Default: Undefined, in which case, the task will receive 20GiB ephemeral storage.

The amount (in GiB) of ephemeral storage to be allocated to the task.

The minimum supported value is 21 GiB and the maximum supported value is 200 GiB.

Only supported in Fargate platform version 1.4.0 or later.

Returns:

  • (Numeric, nil)


123
124
125
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 123

def ephemeral_storage_gib
  @ephemeral_storage_gib
end

#imageAWSCDK::ECS::ContainerImage (readonly)

Note:

Default: - none

The image used to start a container.

Image or taskDefinition must be specified, but not both.



56
57
58
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 56

def image
  @image
end

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

Note:

Default: - AwsLogDriver if enableLogging is true

The log driver to use.

Returns:



78
79
80
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 78

def log_driver
  @log_driver
end

#memory_limit_mibNumeric? (readonly)

Note:

Default: 512

The amount (in MiB) of memory used by the task.

This field is required and you must use one of the following values, which determines your range of valid values for the cpu parameter:

512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)

1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)

2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)

Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)

Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)

Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU)

Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU)

This default is set in the underlying FargateTaskDefinition construct.

Returns:

  • (Numeric, nil)


147
148
149
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 147

def memory_limit_mib
  @memory_limit_mib
end

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

Note:

Default: Latest

The platform version on which to run your service.

If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.



156
157
158
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 156

def platform_version
  @platform_version
end

#runtime_platformAWSCDK::ECS::RuntimePlatform? (readonly)

Note:

Default: - If the property is undefined, operatingSystemFamily is LINUX and cpuArchitecture is X86_64

The runtime platform of the task definition.



161
162
163
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 161

def runtime_platform
  @runtime_platform
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:



83
84
85
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 83

def secrets
  @secrets
end

#task_definitionAWSCDK::ECS::FargateTaskDefinition? (readonly)

Note:

Default: - none

The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both.

[disable-awslint:ref-via-interface]



168
169
170
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 168

def task_definition
  @task_definition
end

Class Method Details

.jsii_propertiesObject



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 170

def self.jsii_properties
  {
    :image => "image",
    :command => "command",
    :container_name => "containerName",
    :environment => "environment",
    :log_driver => "logDriver",
    :secrets => "secrets",
    :circuit_breaker => "circuitBreaker",
    :cpu => "cpu",
    :ephemeral_storage_gib => "ephemeralStorageGiB",
    :memory_limit_mib => "memoryLimitMiB",
    :platform_version => "platformVersion",
    :runtime_platform => "runtimePlatform",
    :task_definition => "taskDefinition",
  }
end

Instance Method Details

#to_jsiiObject



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'ecs_patterns/scheduled_fargate_task_image_options.rb', line 188

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "image" => @image,
    "command" => @command,
    "containerName" => @container_name,
    "environment" => @environment,
    "logDriver" => @log_driver,
    "secrets" => @secrets,
    "circuitBreaker" => @circuit_breaker,
    "cpu" => @cpu,
    "ephemeralStorageGiB" => @ephemeral_storage_gib,
    "memoryLimitMiB" => @memory_limit_mib,
    "platformVersion" => @platform_version,
    "runtimePlatform" => @runtime_platform,
    "taskDefinition" => @task_definition,
  })
  result.compact
end