Class: AWSCDK::Batch::ECSEC2ContainerDefinition
- Inherits:
-
Constructs::Construct
- Object
- Constructs::Construct
- AWSCDK::Batch::ECSEC2ContainerDefinition
- Includes:
- IECSContainerDefinition, IECSEC2ContainerDefinition
- Defined in:
- batch/ecsec2_container_definition.rb
Overview
A container orchestrated by ECS that uses EC2 resources.
Class Method Summary collapse
- .jsii_overridable_methods ⇒ Object
-
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
Instance Method Summary collapse
-
#add_ulimit(ulimit) ⇒ void
Add a ulimit to this container.
-
#add_volume(volume) ⇒ void
Add a Volume to this container.
-
#command ⇒ Array<String>?
The command that's passed to the container.
-
#cpu ⇒ Numeric
The number of vCPUs reserved for the container.
-
#enable_execute_command ⇒ Boolean?
Whether to enable ecs exec for this container.
-
#environment ⇒ Hash{String => String}?
The environment variables to pass to a container.
-
#execution_role ⇒ AWSCDK::IAM::IRole
The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.
-
#gpu ⇒ Numeric?
The number of physical GPUs to reserve for the container.
-
#image ⇒ AWSCDK::ECS::ContainerImage
The image that this container will run.
-
#initialize(scope, id, props) ⇒ ECSEC2ContainerDefinition
constructor
A new instance of ECSEC2ContainerDefinition.
-
#job_role ⇒ AWSCDK::IAM::IRole?
The role that the container can assume.
-
#linux_parameters ⇒ AWSCDK::Batch::LinuxParameters?
Linux-specific modifications that are applied to the container, such as details for device mappings.
-
#log_driver_config ⇒ AWSCDK::ECS::LogDriverConfig?
The configuration of the log driver.
-
#memory ⇒ AWSCDK::Size
The memory hard limit present to the container.
-
#node ⇒ Constructs::Node
The tree node.
-
#privileged ⇒ Boolean?
When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).
-
#readonly_root_filesystem ⇒ Boolean?
Gives the container readonly access to its root filesystem.
-
#secrets ⇒ Hash{String => AWSCDK::Batch::Secret}?
A map from environment variable names to the secrets for the container.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#ulimits ⇒ Array<AWSCDK::Batch::Ulimit>
Limits to set for the user this docker container will run as.
-
#user ⇒ String?
The user name to use inside the container.
-
#volumes ⇒ Array<AWSCDK::Batch::ECSVolume>
The volumes to mount to this container.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props) ⇒ ECSEC2ContainerDefinition
Returns a new instance of ECSEC2ContainerDefinition.
13 14 15 16 17 18 19 |
# File 'batch/ecsec2_container_definition.rb', line 13 def initialize(scope, id, props) props = props.is_a?(Hash) ? ::AWSCDK::Batch::ECSEC2ContainerDefinitionProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guRWNzRWMyQ29udGFpbmVyRGVmaW5pdGlvblByb3BzIn0=")), "props") Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
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 'batch/ecsec2_container_definition.rb', line 21 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :cpu => { kind: :property, name: "cpu", is_optional: false }, :execution_role => { kind: :property, name: "executionRole", is_optional: false }, :image => { kind: :property, name: "image", is_optional: false }, :memory => { kind: :property, name: "memory", is_optional: false }, :ulimits => { kind: :property, name: "ulimits", is_optional: false }, :volumes => { kind: :property, name: "volumes", is_optional: false }, :command => { kind: :property, name: "command", is_optional: true }, :enable_execute_command => { kind: :property, name: "enableExecuteCommand", is_optional: true }, :environment => { kind: :property, name: "environment", is_optional: true }, :gpu => { kind: :property, name: "gpu", is_optional: true }, :job_role => { kind: :property, name: "jobRole", is_optional: true }, :linux_parameters => { kind: :property, name: "linuxParameters", is_optional: true }, :log_driver_config => { kind: :property, name: "logDriverConfig", is_optional: true }, :privileged => { kind: :property, name: "privileged", is_optional: true }, :readonly_root_filesystem => { kind: :property, name: "readonlyRootFilesystem", is_optional: true }, :secrets => { kind: :property, name: "secrets", is_optional: true }, :user => { kind: :property, name: "user", is_optional: true }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :add_ulimit => { kind: :method, name: "addUlimit", is_optional: false }, :add_volume => { kind: :method, name: "addVolume", is_optional: false }, } end |
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
58 59 60 |
# File 'batch/ecsec2_container_definition.rb', line 58 def self.PROPERTY_INJECTION_ID() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_batch.EcsEc2ContainerDefinition", "PROPERTY_INJECTION_ID") end |
Instance Method Details
#add_ulimit(ulimit) ⇒ void
This method returns an undefined value.
Add a ulimit to this container.
225 226 227 228 229 |
# File 'batch/ecsec2_container_definition.rb', line 225 def add_ulimit(ulimit) ulimit = ulimit.is_a?(Hash) ? ::AWSCDK::Batch::Ulimit.new(**ulimit.transform_keys(&:to_sym)) : ulimit Jsii::Type.check_type(ulimit, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guVWxpbWl0In0=")), "ulimit") jsii_call_method("addUlimit", [ulimit]) end |
#add_volume(volume) ⇒ void
This method returns an undefined value.
Add a Volume to this container.
235 236 237 238 |
# File 'batch/ecsec2_container_definition.rb', line 235 def add_volume(volume) Jsii::Type.check_type(volume, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guRWNzVm9sdW1lIn0=")), "volume") jsii_call_method("addVolume", [volume]) end |
#command ⇒ Array<String>?
The command that's passed to the container.
115 116 117 |
# File 'batch/ecsec2_container_definition.rb', line 115 def command() jsii_get_property("command") end |
#cpu ⇒ Numeric
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.
68 69 70 |
# File 'batch/ecsec2_container_definition.rb', line 68 def cpu() jsii_get_property("cpu") end |
#enable_execute_command ⇒ Boolean?
Whether to enable ecs exec for this container.
122 123 124 |
# File 'batch/ecsec2_container_definition.rb', line 122 def enable_execute_command() jsii_get_property("enableExecuteCommand") end |
#environment ⇒ Hash{String => String}?
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.
132 133 134 |
# File 'batch/ecsec2_container_definition.rb', line 132 def environment() jsii_get_property("environment") end |
#execution_role ⇒ AWSCDK::IAM::IRole
The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.
75 76 77 |
# File 'batch/ecsec2_container_definition.rb', line 75 def execution_role() jsii_get_property("executionRole") end |
#gpu ⇒ Numeric?
The number of physical GPUs to reserve for the container.
Make sure that the number of GPUs reserved for all containers in a job doesn't exceed the number of available GPUs on the compute resource that the job is launched on.
142 143 144 |
# File 'batch/ecsec2_container_definition.rb', line 142 def gpu() jsii_get_property("gpu") end |
#image ⇒ AWSCDK::ECS::ContainerImage
The image that this container will run.
82 83 84 |
# File 'batch/ecsec2_container_definition.rb', line 82 def image() jsii_get_property("image") end |
#job_role ⇒ AWSCDK::IAM::IRole?
The role that the container can assume.
149 150 151 |
# File 'batch/ecsec2_container_definition.rb', line 149 def job_role() jsii_get_property("jobRole") end |
#linux_parameters ⇒ AWSCDK::Batch::LinuxParameters?
Linux-specific modifications that are applied to the container, such as details for device mappings.
156 157 158 |
# File 'batch/ecsec2_container_definition.rb', line 156 def linux_parameters() jsii_get_property("linuxParameters") end |
#log_driver_config ⇒ AWSCDK::ECS::LogDriverConfig?
The configuration of the log driver.
163 164 165 |
# File 'batch/ecsec2_container_definition.rb', line 163 def log_driver_config() jsii_get_property("logDriverConfig") end |
#memory ⇒ AWSCDK::Size
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.
92 93 94 |
# File 'batch/ecsec2_container_definition.rb', line 92 def memory() jsii_get_property("memory") end |
#node ⇒ Constructs::Node
The tree node.
51 52 53 |
# File 'batch/ecsec2_container_definition.rb', line 51 def node() jsii_get_property("node") end |
#privileged ⇒ Boolean?
When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).
170 171 172 |
# File 'batch/ecsec2_container_definition.rb', line 170 def privileged() jsii_get_property("privileged") end |
#readonly_root_filesystem ⇒ Boolean?
Gives the container readonly access to its root filesystem.
177 178 179 |
# File 'batch/ecsec2_container_definition.rb', line 177 def readonly_root_filesystem() jsii_get_property("readonlyRootFilesystem") end |
#secrets ⇒ Hash{String => AWSCDK::Batch::Secret}?
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.
187 188 189 |
# File 'batch/ecsec2_container_definition.rb', line 187 def secrets() jsii_get_property("secrets") end |
#to_string ⇒ String
Returns a string representation of this construct.
201 202 203 |
# File 'batch/ecsec2_container_definition.rb', line 201 def to_string() jsii_call_method("toString", []) end |
#ulimits ⇒ Array<AWSCDK::Batch::Ulimit>
Limits to set for the user this docker container will run as.
99 100 101 |
# File 'batch/ecsec2_container_definition.rb', line 99 def ulimits() jsii_get_property("ulimits") end |
#user ⇒ String?
The user name to use inside the container.
194 195 196 |
# File 'batch/ecsec2_container_definition.rb', line 194 def user() jsii_get_property("user") end |
#volumes ⇒ Array<AWSCDK::Batch::ECSVolume>
The volumes to mount to this container.
Automatically added to the job definition.
108 109 110 |
# File 'batch/ecsec2_container_definition.rb', line 108 def volumes() jsii_get_property("volumes") end |
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
214 215 216 217 218 219 |
# File 'batch/ecsec2_container_definition.rb', line 214 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |