Class: AWSCDK::AssetStagingProps

Inherits:
FingerprintOptions
  • Object
show all
Defined in:
asset_staging_props.rb

Overview

Initialization properties for AssetStaging.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exclude: nil, follow: nil, ignore_mode: nil, extra_hash: nil, asset_hash: nil, asset_hash_type: nil, bundling: nil, source_path:) ⇒ AssetStagingProps

Returns a new instance of AssetStagingProps.

Parameters:

  • exclude (Array<String>, nil) (defaults to: nil)

    File paths matching the patterns will be excluded.

  • follow (AWSCDK::SymlinkFollowMode, nil) (defaults to: nil)

    A strategy for how to handle symlinks.

  • ignore_mode (AWSCDK::IgnoreMode, nil) (defaults to: nil)

    The ignore behavior to use for exclude patterns.

  • extra_hash (String, nil) (defaults to: nil)

    Extra information to encode into the fingerprint (e.g. build instructions and other inputs).

  • asset_hash (String, nil) (defaults to: nil)

    Specify a custom hash for this asset.

  • asset_hash_type (AWSCDK::AssetHashType, nil) (defaults to: nil)

    Specifies the type of hash to calculate for this asset.

  • bundling (AWSCDK::BundlingOptions, nil) (defaults to: nil)

    Bundle the asset by executing a command in a Docker container or a custom bundling provider.

  • source_path (String)

    The source file or directory to copy from.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'asset_staging_props.rb', line 16

def initialize(exclude: nil, follow: nil, ignore_mode: nil, extra_hash: nil, asset_hash: nil, asset_hash_type: nil, bundling: nil, source_path:)
  @exclude = exclude
  Jsii::Type.check_type(@exclude, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "exclude") unless @exclude.nil?
  @follow = follow
  Jsii::Type.check_type(@follow, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TeW1saW5rRm9sbG93TW9kZSJ9")), "follow") unless @follow.nil?
  @ignore_mode = ignore_mode
  Jsii::Type.check_type(@ignore_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JZ25vcmVNb2RlIn0=")), "ignoreMode") unless @ignore_mode.nil?
  @extra_hash = extra_hash
  Jsii::Type.check_type(@extra_hash, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "extraHash") unless @extra_hash.nil?
  @asset_hash = asset_hash
  Jsii::Type.check_type(@asset_hash, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "assetHash") unless @asset_hash.nil?
  @asset_hash_type = asset_hash_type
  Jsii::Type.check_type(@asset_hash_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bc3NldEhhc2hUeXBlIn0=")), "assetHashType") unless @asset_hash_type.nil?
  @bundling = bundling.is_a?(Hash) ? ::AWSCDK::BundlingOptions.new(**bundling.transform_keys(&:to_sym)) : bundling
  Jsii::Type.check_type(@bundling, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5CdW5kbGluZ09wdGlvbnMifQ==")), "bundling") unless @bundling.nil?
  @source_path = source_path
  Jsii::Type.check_type(@source_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sourcePath")
end

Instance Attribute Details

#asset_hashString? (readonly)

Note:

Default: - based on assetHashType

Specify a custom hash for this asset.

If asset_hash_type is set it must be set to AssetHashType.CUSTOM. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash.

NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated.

Returns:

  • (String, nil)


73
74
75
# File 'asset_staging_props.rb', line 73

def asset_hash
  @asset_hash
end

#asset_hash_typeAWSCDK::AssetHashType? (readonly)

Note:

Default: - the default is AssetHashType.SOURCE, but if assetHash is explicitly specified this value defaults to AssetHashType.CUSTOM.

Specifies the type of hash to calculate for this asset.

If asset_hash is configured, this option must be undefined or AssetHashType.CUSTOM.

Returns:



81
82
83
# File 'asset_staging_props.rb', line 81

def asset_hash_type
  @asset_hash_type
end

#bundlingAWSCDK::BundlingOptions? (readonly)

Note:

Default: - uploaded as-is to S3 if the asset is a regular file or a .zip file, archived into a .zip file and uploaded to S3 otherwise

Bundle the asset by executing a command in a Docker container or a custom bundling provider.

The asset path will be mounted at /asset-input. The Docker container is responsible for putting content at /asset-output. The content at /asset-output will be zipped and used as the final asset.

Returns:



91
92
93
# File 'asset_staging_props.rb', line 91

def bundling
  @bundling
end

#excludeArray<String>? (readonly)

Note:

Default: - nothing is excluded

File paths matching the patterns will be excluded.

See ignore_mode to set the matching behavior. Has no effect on Assets bundled using the bundling property.

Returns:

  • (Array<String>, nil)


42
43
44
# File 'asset_staging_props.rb', line 42

def exclude
  @exclude
end

#extra_hashString? (readonly)

Note:

Default: - hash is only based on source content

Extra information to encode into the fingerprint (e.g. build instructions and other inputs).

Returns:

  • (String, nil)


57
58
59
# File 'asset_staging_props.rb', line 57

def extra_hash
  @extra_hash
end

#followAWSCDK::SymlinkFollowMode? (readonly)

Note:

Default: SymlinkFollowMode.NEVER

A strategy for how to handle symlinks.

Returns:



47
48
49
# File 'asset_staging_props.rb', line 47

def follow
  @follow
end

#ignore_modeAWSCDK::IgnoreMode? (readonly)

Note:

Default: IgnoreMode.GLOB

The ignore behavior to use for exclude patterns.

Returns:



52
53
54
# File 'asset_staging_props.rb', line 52

def ignore_mode
  @ignore_mode
end

#source_pathString (readonly)

The source file or directory to copy from.

Returns:

  • (String)


95
96
97
# File 'asset_staging_props.rb', line 95

def source_path
  @source_path
end

Class Method Details

.jsii_propertiesObject



97
98
99
100
101
102
103
104
105
106
107
108
# File 'asset_staging_props.rb', line 97

def self.jsii_properties
  {
    :exclude => "exclude",
    :follow => "follow",
    :ignore_mode => "ignoreMode",
    :extra_hash => "extraHash",
    :asset_hash => "assetHash",
    :asset_hash_type => "assetHashType",
    :bundling => "bundling",
    :source_path => "sourcePath",
  }
end

Instance Method Details

#to_jsiiObject



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'asset_staging_props.rb', line 110

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "exclude" => @exclude,
    "follow" => @follow,
    "ignoreMode" => @ignore_mode,
    "extraHash" => @extra_hash,
    "assetHash" => @asset_hash,
    "assetHashType" => @asset_hash_type,
    "bundling" => @bundling,
    "sourcePath" => @source_path,
  })
  result.compact
end