Class: AWSCDK::ECS::ContainerImage

Inherits:
Jsii::Object
  • Object
show all
Defined in:
ecs/container_image.rb

Overview

Constructs for types of container images.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContainerImage

Returns a new instance of ContainerImage.



8
9
10
# File 'ecs/container_image.rb', line 8

def initialize
  Jsii::Object.instance_method(:initialize).bind(self).call
end

Class Method Details

.from_asset(directory, props = nil) ⇒ AWSCDK::ECS::AssetImage

Reference an image that's constructed directly from sources on disk.

If you already have a DockerImageAsset instance, you can use the ContainerImage.fromDockerImageAsset method instead.

Parameters:

Returns:



26
27
28
29
30
31
# File 'ecs/container_image.rb', line 26

def self.from_asset(directory, props = nil)
  Jsii::Type.check_type(directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "directory")
  props = props.is_a?(Hash) ? ::AWSCDK::ECS::AssetImageProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkFzc2V0SW1hZ2VQcm9wcyJ9")), "props") unless props.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.ContainerImage", "fromAsset", [directory, props])
end

.from_docker_image_asset(asset) ⇒ AWSCDK::ECS::ContainerImage

Use an existing DockerImageAsset for this container image.

Parameters:

Returns:

  • (AWSCDK::ECS::ContainerImage)


37
38
39
40
# File 'ecs/container_image.rb', line 37

def self.from_docker_image_asset(asset)
  Jsii::Type.check_type(asset, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyX2Fzc2V0cy5Eb2NrZXJJbWFnZUFzc2V0In0=")), "asset")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.ContainerImage", "fromDockerImageAsset", [asset])
end

.from_ecr_repository(repository, tag = nil) ⇒ AWSCDK::ECS::ECRImage

Reference an image in an ECR repository.

Parameters:

  • repository (AWSCDK::ECR::IRepository)
  • tag (String, nil) (defaults to: nil)

    If you don't specify this parameter, latest is used as default.

Returns:



47
48
49
50
51
# File 'ecs/container_image.rb', line 47

def self.from_ecr_repository(repository, tag = nil)
  Jsii::Type.check_type(repository, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyLklSZXBvc2l0b3J5In0=")), "repository")
  Jsii::Type.check_type(tag, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tag") unless tag.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.ContainerImage", "fromEcrRepository", [repository, tag])
end

.from_registry(name, props = nil) ⇒ AWSCDK::ECS::RepositoryImage

Reference an image on DockerHub or another online registry.

Parameters:

Returns:



58
59
60
61
62
63
# File 'ecs/container_image.rb', line 58

def self.from_registry(name, props = nil)
  Jsii::Type.check_type(name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  props = props.is_a?(Hash) ? ::AWSCDK::ECS::RepositoryImageProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlJlcG9zaXRvcnlJbWFnZVByb3BzIn0=")), "props") unless props.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.ContainerImage", "fromRegistry", [name, props])
end

.from_tarball(tarball_file) ⇒ AWSCDK::ECS::ContainerImage

Use an existing tarball for this container image.

Use this method if the container image has already been created by another process (e.g. jib) and you want to add it as a container image asset.

Parameters:

  • tarball_file (String)

    Absolute path to the tarball.

Returns:

  • (AWSCDK::ECS::ContainerImage)


72
73
74
75
# File 'ecs/container_image.rb', line 72

def self.from_tarball(tarball_file)
  Jsii::Type.check_type(tarball_file, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tarballFile")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ecs.ContainerImage", "fromTarball", [tarball_file])
end

.jsii_overridable_methodsObject



12
13
14
15
16
# File 'ecs/container_image.rb', line 12

def self.jsii_overridable_methods
  {
    :bind => { kind: :method, name: "bind", is_optional: false },
  }
end

Instance Method Details

#bind(scope, container_definition) ⇒ AWSCDK::ECS::ContainerImageConfig

Called when the image is used by a ContainerDefinition.

Parameters:

Returns:



82
83
84
85
86
# File 'ecs/container_image.rb', line 82

def bind(scope, container_definition)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(container_definition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckRlZmluaXRpb24ifQ==")), "containerDefinition")
  jsii_call_method("bind", [scope, container_definition])
end