Class: AWSCDK::ECSPatterns::ScheduledEC2TaskImageOptions
- Inherits:
-
ScheduledTaskImageProps
- Object
- ScheduledTaskImageProps
- AWSCDK::ECSPatterns::ScheduledEC2TaskImageOptions
- Defined in:
- ecs_patterns/scheduled_ec2_task_image_options.rb
Overview
The properties for the ScheduledEc2Task using an image.
Instance Attribute Summary collapse
-
#command ⇒ Array<String>?
readonly
The command that is passed to the container.
-
#container_name ⇒ String?
readonly
Optional name for the container added.
-
#cpu ⇒ Numeric?
readonly
The minimum number of CPU units to reserve for the container.
-
#environment ⇒ Hash{String => String}?
readonly
The environment variables to pass to the container.
-
#image ⇒ AWSCDK::ECS::ContainerImage
readonly
The image used to start a container.
-
#log_driver ⇒ AWSCDK::ECS::LogDriver?
readonly
The log driver to use.
-
#memory_limit_mib ⇒ Numeric?
readonly
The hard limit (in MiB) of memory to present to the container.
-
#memory_reservation_mib ⇒ Numeric?
readonly
The soft limit (in MiB) of memory to reserve for the container.
-
#secrets ⇒ Hash{String => AWSCDK::ECS::Secret}?
readonly
The secret to expose to the container as an environment variable.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(image:, command: nil, container_name: nil, environment: nil, log_driver: nil, secrets: nil, cpu: nil, memory_limit_mib: nil, memory_reservation_mib: nil) ⇒ ScheduledEC2TaskImageOptions
constructor
A new instance of ScheduledEC2TaskImageOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(image:, command: nil, container_name: nil, environment: nil, log_driver: nil, secrets: nil, cpu: nil, memory_limit_mib: nil, memory_reservation_mib: nil) ⇒ ScheduledEC2TaskImageOptions
Returns a new instance of ScheduledEC2TaskImageOptions.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 16 def initialize(image:, command: nil, container_name: nil, environment: nil, log_driver: nil, secrets: nil, cpu: nil, memory_limit_mib: nil, memory_reservation_mib: 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? @cpu = cpu Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpu") unless @cpu.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? @memory_reservation_mib = memory_reservation_mib Jsii::Type.check_type(@memory_reservation_mib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "memoryReservationMiB") unless @memory_reservation_mib.nil? end |
Instance Attribute Details
#command ⇒ Array<String>? (readonly)
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.
50 51 52 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 50 def command @command end |
#container_name ⇒ String? (readonly)
Default: - ScheduledContainer
Optional name for the container added.
55 56 57 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 55 def container_name @container_name end |
#cpu ⇒ Numeric? (readonly)
Default: none
The minimum number of CPU units to reserve for the container.
75 76 77 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 75 def cpu @cpu end |
#environment ⇒ Hash{String => String}? (readonly)
Default: none
The environment variables to pass to the container.
60 61 62 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 60 def environment @environment end |
#image ⇒ AWSCDK::ECS::ContainerImage (readonly)
Default: - none
The image used to start a container.
Image or taskDefinition must be specified, but not both.
43 44 45 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 43 def image @image end |
#log_driver ⇒ AWSCDK::ECS::LogDriver? (readonly)
Default: - AwsLogDriver if enableLogging is true
The log driver to use.
65 66 67 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 65 def log_driver @log_driver end |
#memory_limit_mib ⇒ Numeric? (readonly)
Default: - No memory limit.
The hard limit (in MiB) of memory to present to the container.
If your container attempts to exceed the allocated memory, the container is terminated.
At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
85 86 87 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 85 def memory_limit_mib @memory_limit_mib end |
#memory_reservation_mib ⇒ Numeric? (readonly)
Default: - No memory reserved.
The soft limit (in MiB) of memory to reserve for the container.
When system memory is under contention, Docker attempts to keep the container memory within the limit. If the container requires more memory, it can consume up to the value specified by the Memory property or all of the available memory on the container instance—whichever comes first.
At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
97 98 99 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 97 def memory_reservation_mib @memory_reservation_mib end |
#secrets ⇒ Hash{String => AWSCDK::ECS::Secret}? (readonly)
Default: - No secret environment variables.
The secret to expose to the container as an environment variable.
70 71 72 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 70 def secrets @secrets end |
Class Method Details
.jsii_properties ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 99 def self.jsii_properties { :image => "image", :command => "command", :container_name => "containerName", :environment => "environment", :log_driver => "logDriver", :secrets => "secrets", :cpu => "cpu", :memory_limit_mib => "memoryLimitMiB", :memory_reservation_mib => "memoryReservationMiB", } end |
Instance Method Details
#to_jsii ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'ecs_patterns/scheduled_ec2_task_image_options.rb', line 113 def to_jsii result = {} result.merge!(super) result.merge!({ "image" => @image, "command" => @command, "containerName" => @container_name, "environment" => @environment, "logDriver" => @log_driver, "secrets" => @secrets, "cpu" => @cpu, "memoryLimitMiB" => @memory_limit_mib, "memoryReservationMiB" => @memory_reservation_mib, }) result.compact end |