Class: AWSCDK::ECRAssets::DockerImageAsset

Inherits:
Constructs::Construct
  • Object
show all
Defined in:
ecr_assets/docker_image_asset.rb

Overview

An asset that represents a Docker image.

The image will be created in build time and uploaded to an ECR repository.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ DockerImageAsset

Returns a new instance of DockerImageAsset.

Parameters:



13
14
15
16
17
18
19
# File 'ecr_assets/docker_image_asset.rb', line 13

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::ECRAssets::DockerImageAssetProps.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyX2Fzc2V0cy5Eb2NrZXJJbWFnZUFzc2V0UHJvcHMifQ==")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.jsii_overridable_methodsObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'ecr_assets/docker_image_asset.rb', line 21

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :asset_hash => { kind: :property, name: "assetHash", is_optional: false },
    :image_tag => { kind: :property, name: "imageTag", is_optional: false },
    :image_uri => { kind: :property, name: "imageUri", is_optional: false },
    :repository => { kind: :property, name: "repository", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :add_resource_metadata => { kind: :method, name: "addResourceMetadata", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


44
45
46
# File 'ecr_assets/docker_image_asset.rb', line 44

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ecr_assets.DockerImageAsset", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_resource_metadata(resource, resource_property) ⇒ void

This method returns an undefined value.

Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset.

This can be used by tools such as SAM CLI to provide local experience such as local invocation and debugging of Lambda functions.

Asset metadata will only be included if the stack is synthesized with the "aws:cdk:enable-asset-metadata" context key defined, which is the default behavior when synthesizing via the CDK Toolkit.

Parameters:

  • resource (AWSCDK::CfnResource)

    The CloudFormation resource which is using this asset [disable-awslint:ref-via-interface].

  • resource_property (String)

    The property name where this asset is referenced.

See Also:



131
132
133
134
135
# File 'ecr_assets/docker_image_asset.rb', line 131

def (resource, resource_property)
  Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "resource")
  Jsii::Type.check_type(resource_property, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceProperty")
  jsii_call_method("addResourceMetadata", [resource, resource_property])
end

#asset_hashString

A hash of this asset, which is available at construction time.

As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.

Returns:

  • (String)


55
56
57
# File 'ecr_assets/docker_image_asset.rb', line 55

def asset_hash()
  jsii_get_property("assetHash")
end

#image_tagString

The tag of this asset when it is uploaded to ECR.

The tag may differ from the assetHash if a stack synthesizer adds a dockerTagPrefix.

Returns:

  • (String)


64
65
66
# File 'ecr_assets/docker_image_asset.rb', line 64

def image_tag()
  jsii_get_property("imageTag")
end

#image_uriString

The full URI of the image (including a tag).

Use this reference to pull the asset.

Returns:

  • (String)


74
75
76
# File 'ecr_assets/docker_image_asset.rb', line 74

def image_uri()
  jsii_get_property("imageUri")
end

#image_uri=(value) ⇒ Object



78
79
80
81
# File 'ecr_assets/docker_image_asset.rb', line 78

def image_uri=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imageUri")
  jsii_set_property("imageUri", value)
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


37
38
39
# File 'ecr_assets/docker_image_asset.rb', line 37

def node()
  jsii_get_property("node")
end

#repositoryAWSCDK::ECR::IRepository

Repository where the image is stored.



86
87
88
# File 'ecr_assets/docker_image_asset.rb', line 86

def repository()
  jsii_get_property("repository")
end

#repository=(value) ⇒ Object



90
91
92
93
# File 'ecr_assets/docker_image_asset.rb', line 90

def repository=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNyLklSZXBvc2l0b3J5In0=")), "repository")
  jsii_set_property("repository", value)
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


98
99
100
# File 'ecr_assets/docker_image_asset.rb', line 98

def to_string()
  jsii_call_method("toString", [])
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.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



111
112
113
114
115
116
# File 'ecr_assets/docker_image_asset.rb', line 111

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