Class: AWSCDK::Batch::ECSContainerDefinitionProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Batch::ECSContainerDefinitionProps
- Defined in:
- batch/ecs_container_definition_props.rb
Overview
Props to configure an EcsContainerDefinition.
Direct Known Subclasses
ECSEC2ContainerDefinitionProps, ECSFargateContainerDefinitionProps
Instance Attribute Summary collapse
-
#command ⇒ Array<String>?
readonly
The command that's passed to the container.
-
#cpu ⇒ Numeric
readonly
The number of vCPUs reserved for the container.
-
#enable_execute_command ⇒ Boolean?
readonly
Determines whether execute command functionality is turned on for this task.
-
#environment ⇒ Hash{String => String}?
readonly
The environment variables to pass to a container.
-
#execution_role ⇒ AWSCDK::IAM::IRole?
readonly
The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.
-
#image ⇒ AWSCDK::ECS::ContainerImage
readonly
The image that this container will run.
-
#job_role ⇒ AWSCDK::IAM::IRole?
readonly
The role that the container can assume.
-
#linux_parameters ⇒ AWSCDK::Batch::LinuxParameters?
readonly
Linux-specific modifications that are applied to the container, such as details for device mappings.
-
#logging ⇒ AWSCDK::ECS::LogDriver?
readonly
The loging configuration for this Job.
-
#memory ⇒ AWSCDK::Size
readonly
The memory hard limit present to the container.
-
#readonly_root_filesystem ⇒ Boolean?
readonly
Gives the container readonly access to its root filesystem.
-
#secrets ⇒ Hash{String => AWSCDK::Batch::Secret}?
readonly
A map from environment variable names to the secrets for the container.
-
#user ⇒ String?
readonly
The user name to use inside the container.
-
#volumes ⇒ Array<AWSCDK::Batch::ECSVolume>?
readonly
The volumes to mount to this container.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cpu:, image:, memory:, command: nil, enable_execute_command: nil, environment: nil, execution_role: nil, job_role: nil, linux_parameters: nil, logging: nil, readonly_root_filesystem: nil, secrets: nil, user: nil, volumes: nil) ⇒ ECSContainerDefinitionProps
constructor
A new instance of ECSContainerDefinitionProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(cpu:, image:, memory:, command: nil, enable_execute_command: nil, environment: nil, execution_role: nil, job_role: nil, linux_parameters: nil, logging: nil, readonly_root_filesystem: nil, secrets: nil, user: nil, volumes: nil) ⇒ ECSContainerDefinitionProps
Returns a new instance of ECSContainerDefinitionProps.
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 49 50 |
# File 'batch/ecs_container_definition_props.rb', line 21 def initialize(cpu:, image:, memory:, command: nil, enable_execute_command: nil, environment: nil, execution_role: nil, job_role: nil, linux_parameters: nil, logging: nil, readonly_root_filesystem: nil, secrets: nil, user: nil, volumes: nil) @cpu = cpu Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpu") @image = image Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckltYWdlIn0=")), "image") @memory = memory Jsii::Type.check_type(@memory, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "memory") @command = command Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil? @enable_execute_command = enable_execute_command Jsii::Type.check_type(@enable_execute_command, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableExecuteCommand") unless @enable_execute_command.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? @job_role = job_role Jsii::Type.check_type(@job_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "jobRole") unless @job_role.nil? @linux_parameters = linux_parameters Jsii::Type.check_type(@linux_parameters, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guTGludXhQYXJhbWV0ZXJzIn0=")), "linuxParameters") unless @linux_parameters.nil? @logging = logging Jsii::Type.check_type(@logging, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxvZ0RyaXZlciJ9")), "logging") unless @logging.nil? @readonly_root_filesystem = readonly_root_filesystem Jsii::Type.check_type(@readonly_root_filesystem, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "readonlyRootFilesystem") unless @readonly_root_filesystem.nil? @secrets = secrets Jsii::Type.check_type(@secrets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5TZWNyZXQifSwia2luZCI6Im1hcCJ9fQ==")), "secrets") unless @secrets.nil? @user = user Jsii::Type.check_type(@user, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "user") unless @user.nil? @volumes = volumes Jsii::Type.check_type(@volumes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5FY3NWb2x1bWUifSwia2luZCI6ImFycmF5In19")), "volumes") unless @volumes.nil? end |
Instance Attribute Details
#command ⇒ Array<String>? (readonly)
Default: - no command
The command that's passed to the container.
75 76 77 |
# File 'batch/ecs_container_definition_props.rb', line 75 def command @command end |
#cpu ⇒ Numeric (readonly)
The number of vCPUs reserved for the container.
Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.
58 59 60 |
# File 'batch/ecs_container_definition_props.rb', line 58 def cpu @cpu end |
#enable_execute_command ⇒ Boolean? (readonly)
Default: undefined - AWS Batch default is false
Determines whether execute command functionality is turned on for this task.
If true, execute command functionality is turned on all the containers in the task.
This allows you to use ECS Exec to access containers interactively. When enabled, a job role with required SSM permissions will be created automatically if no job role is provided. If a job role is alreadyprovided, the required permissions will be added to it.
87 88 89 |
# File 'batch/ecs_container_definition_props.rb', line 87 def enable_execute_command @enable_execute_command end |
#environment ⇒ Hash{String => String}? (readonly)
Default: - no environment variables
The environment variables to pass to a container.
Cannot start with AWS_BATCH.
We don't recommend using plaintext environment variables for sensitive information, such as credential data.
95 96 97 |
# File 'batch/ecs_container_definition_props.rb', line 95 def environment @environment end |
#execution_role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - a Role will be created
The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.
101 102 103 |
# File 'batch/ecs_container_definition_props.rb', line 101 def execution_role @execution_role end |
#image ⇒ AWSCDK::ECS::ContainerImage (readonly)
The image that this container will run.
62 63 64 |
# File 'batch/ecs_container_definition_props.rb', line 62 def image @image end |
#job_role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - no job role
The role that the container can assume.
107 108 109 |
# File 'batch/ecs_container_definition_props.rb', line 107 def job_role @job_role end |
#linux_parameters ⇒ AWSCDK::Batch::LinuxParameters? (readonly)
Default: none
Linux-specific modifications that are applied to the container, such as details for device mappings.
112 113 114 |
# File 'batch/ecs_container_definition_props.rb', line 112 def linux_parameters @linux_parameters end |
#logging ⇒ AWSCDK::ECS::LogDriver? (readonly)
Default: - the log configuration of the Docker daemon
The loging configuration for this Job.
117 118 119 |
# File 'batch/ecs_container_definition_props.rb', line 117 def logging @logging end |
#memory ⇒ AWSCDK::Size (readonly)
The memory hard limit present to the container.
If your container attempts to exceed the memory specified, the container is terminated. You must specify at least 4 MiB of memory for a job.
69 70 71 |
# File 'batch/ecs_container_definition_props.rb', line 69 def memory @memory end |
#readonly_root_filesystem ⇒ Boolean? (readonly)
Default: false
Gives the container readonly access to its root filesystem.
122 123 124 |
# File 'batch/ecs_container_definition_props.rb', line 122 def readonly_root_filesystem @readonly_root_filesystem end |
#secrets ⇒ Hash{String => AWSCDK::Batch::Secret}? (readonly)
Default: - no secrets
A map from environment variable names to the secrets for the container.
Allows your job definitions to reference the secret by the environment variable name defined in this property.
131 132 133 |
# File 'batch/ecs_container_definition_props.rb', line 131 def secrets @secrets end |
#user ⇒ String? (readonly)
Default: - no user
The user name to use inside the container.
136 137 138 |
# File 'batch/ecs_container_definition_props.rb', line 136 def user @user end |
#volumes ⇒ Array<AWSCDK::Batch::ECSVolume>? (readonly)
Default: - no volumes
The volumes to mount to this container.
Automatically added to the job definition.
143 144 145 |
# File 'batch/ecs_container_definition_props.rb', line 143 def volumes @volumes end |
Class Method Details
.jsii_properties ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'batch/ecs_container_definition_props.rb', line 145 def self.jsii_properties { :cpu => "cpu", :image => "image", :memory => "memory", :command => "command", :enable_execute_command => "enableExecuteCommand", :environment => "environment", :execution_role => "executionRole", :job_role => "jobRole", :linux_parameters => "linuxParameters", :logging => "logging", :readonly_root_filesystem => "readonlyRootFilesystem", :secrets => "secrets", :user => "user", :volumes => "volumes", } end |
Instance Method Details
#to_jsii ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'batch/ecs_container_definition_props.rb', line 164 def to_jsii result = {} result.merge!({ "cpu" => @cpu, "image" => @image, "memory" => @memory, "command" => @command, "enableExecuteCommand" => @enable_execute_command, "environment" => @environment, "executionRole" => @execution_role, "jobRole" => @job_role, "linuxParameters" => @linux_parameters, "logging" => @logging, "readonlyRootFilesystem" => @readonly_root_filesystem, "secrets" => @secrets, "user" => @user, "volumes" => @volumes, }) result.compact end |