Class: AWSCDK::AssetManifestBuilder

Inherits:
Jsii::Object
  • Object
show all
Defined in:
asset_manifest_builder.rb

Overview

Build an asset manifest from assets added to a stack.

This class does not need to be used by app builders; it is only necessary for building Stack Synthesizers.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAssetManifestBuilder

Returns a new instance of AssetManifestBuilder.



10
11
12
# File 'asset_manifest_builder.rb', line 10

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

Class Method Details

.jsii_overridable_methodsObject



14
15
16
17
18
19
20
21
22
23
# File 'asset_manifest_builder.rb', line 14

def self.jsii_overridable_methods
  {
    :has_assets => { kind: :property, name: "hasAssets", is_optional: false },
    :add_docker_image_asset => { kind: :method, name: "addDockerImageAsset", is_optional: false },
    :add_file_asset => { kind: :method, name: "addFileAsset", is_optional: false },
    :default_add_docker_image_asset => { kind: :method, name: "defaultAddDockerImageAsset", is_optional: false },
    :default_add_file_asset => { kind: :method, name: "defaultAddFileAsset", is_optional: false },
    :emit_manifest => { kind: :method, name: "emitManifest", is_optional: false },
  }
end

Instance Method Details

#add_docker_image_asset(stack, source_hash, source, dest, options = nil) ⇒ AWSCDK::CloudAssemblySchema::DockerImageDestination

Add a docker asset source and destination to the manifest.

sourceHash should be unique for every source.



42
43
44
45
46
47
48
49
50
51
52
# File 'asset_manifest_builder.rb', line 42

def add_docker_image_asset(stack, source_hash, source, dest, options = nil)
  Jsii::Type.check_type(stack, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFjayJ9")), "stack")
  Jsii::Type.check_type(source_hash, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sourceHash")
  source = source.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::DockerImageSource.new(**source.transform_keys(&:to_sym)) : source
  Jsii::Type.check_type(source, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuRG9ja2VySW1hZ2VTb3VyY2UifQ==")), "source")
  dest = dest.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::DockerImageDestination.new(**dest.transform_keys(&:to_sym)) : dest
  Jsii::Type.check_type(dest, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuRG9ja2VySW1hZ2VEZXN0aW5hdGlvbiJ9")), "dest")
  options = options.is_a?(Hash) ? ::AWSCDK::AddDockerImageAssetOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5BZGREb2NrZXJJbWFnZUFzc2V0T3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("addDockerImageAsset", [stack, source_hash, source, dest, options])
end

#add_file_asset(stack, source_hash, source, dest, options = nil) ⇒ AWSCDK::CloudAssemblySchema::FileDestination

Add a file asset source and destination to the manifest.

sourceHash should be unique for every source.



64
65
66
67
68
69
70
71
72
73
74
# File 'asset_manifest_builder.rb', line 64

def add_file_asset(stack, source_hash, source, dest, options = nil)
  Jsii::Type.check_type(stack, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFjayJ9")), "stack")
  Jsii::Type.check_type(source_hash, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sourceHash")
  source = source.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::FileSource.new(**source.transform_keys(&:to_sym)) : source
  Jsii::Type.check_type(source, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuRmlsZVNvdXJjZSJ9")), "source")
  dest = dest.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::FileDestination.new(**dest.transform_keys(&:to_sym)) : dest
  Jsii::Type.check_type(dest, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuRmlsZURlc3RpbmF0aW9uIn0=")), "dest")
  options = options.is_a?(Hash) ? ::AWSCDK::AddFileAssetOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5BZGRGaWxlQXNzZXRPcHRpb25zIn0=")), "options") unless options.nil?
  jsii_call_method("addFileAsset", [stack, source_hash, source, dest, options])
end

#default_add_docker_image_asset(stack, asset, target, options = nil) ⇒ AWSCDK::CloudAssemblySchema::DockerImageDestination

Add a docker image asset to the manifest with default settings.

Derive the region from the stack, use the asset hash as the key, and set the prefix.



85
86
87
88
89
90
91
92
93
94
# File 'asset_manifest_builder.rb', line 85

def default_add_docker_image_asset(stack, asset, target, options = nil)
  Jsii::Type.check_type(stack, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFjayJ9")), "stack")
  asset = asset.is_a?(Hash) ? ::AWSCDK::DockerImageAssetSource.new(**asset.transform_keys(&:to_sym)) : asset
  Jsii::Type.check_type(asset, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Eb2NrZXJJbWFnZUFzc2V0U291cmNlIn0=")), "asset")
  target = target.is_a?(Hash) ? ::AWSCDK::AssetManifestDockerImageDestination.new(**target.transform_keys(&:to_sym)) : target
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bc3NldE1hbmlmZXN0RG9ja2VySW1hZ2VEZXN0aW5hdGlvbiJ9")), "target")
  options = options.is_a?(Hash) ? ::AWSCDK::AddDockerImageAssetOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5BZGREb2NrZXJJbWFnZUFzc2V0T3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("defaultAddDockerImageAsset", [stack, asset, target, options])
end

#default_add_file_asset(stack, asset, target, options = nil) ⇒ AWSCDK::CloudAssemblySchema::FileDestination

Add a file asset to the manifest with default settings.

Derive the region from the stack, use the asset hash as the key, copy the file extension over, and set the prefix.



106
107
108
109
110
111
112
113
114
115
# File 'asset_manifest_builder.rb', line 106

def default_add_file_asset(stack, asset, target, options = nil)
  Jsii::Type.check_type(stack, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFjayJ9")), "stack")
  asset = asset.is_a?(Hash) ? ::AWSCDK::FileAssetSource.new(**asset.transform_keys(&:to_sym)) : asset
  Jsii::Type.check_type(asset, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5GaWxlQXNzZXRTb3VyY2UifQ==")), "asset")
  target = target.is_a?(Hash) ? ::AWSCDK::AssetManifestFileDestination.new(**target.transform_keys(&:to_sym)) : target
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bc3NldE1hbmlmZXN0RmlsZURlc3RpbmF0aW9uIn0=")), "target")
  options = options.is_a?(Hash) ? ::AWSCDK::AddFileAssetOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5BZGRGaWxlQXNzZXRPcHRpb25zIn0=")), "options") unless options.nil?
  jsii_call_method("defaultAddFileAsset", [stack, asset, target, options])
end

#emit_manifest(stack, session, options = nil, dependencies = nil) ⇒ String

Write the manifest to disk, and add it to the synthesis session.

Return the artifact id, which should be added to the additional_dependencies field of the stack artifact.

Parameters:

Returns:

  • (String)


127
128
129
130
131
132
133
134
# File 'asset_manifest_builder.rb', line 127

def emit_manifest(stack, session, options = nil, dependencies = nil)
  Jsii::Type.check_type(stack, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFjayJ9")), "stack")
  Jsii::Type.check_type(session, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JU3ludGhlc2lzU2Vzc2lvbiJ9")), "session")
  options = options.is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::AssetManifestOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuQXNzZXRNYW5pZmVzdE9wdGlvbnMifQ==")), "options") unless options.nil?
  Jsii::Type.check_type(dependencies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "dependencies") unless dependencies.nil?
  jsii_call_method("emitManifest", [stack, session, options, dependencies])
end

#has_assetsBoolean

Whether there are any assets registered in the manifest.

Returns:

  • (Boolean)


28
29
30
# File 'asset_manifest_builder.rb', line 28

def has_assets()
  jsii_get_property("hasAssets")
end