Class: AWSCDK::FileAssetSource

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
file_asset_source.rb

Overview

Represents the source for a file asset.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_hash:, deploy_time: nil, display_name: nil, executable: nil, file_name: nil, packaging: nil) ⇒ FileAssetSource

Returns a new instance of FileAssetSource.

Parameters:

  • source_hash (String)

    A hash on the content source.

  • deploy_time (Boolean, nil) (defaults to: nil)

    Whether or not the asset needs to exist beyond deployment time;

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

    A display name for this asset.

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

    An external command that will produce the packaged asset.

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

    The path, relative to the root of the cloud assembly, in which this asset source resides.

  • packaging (AWSCDK::FileAssetPackaging, nil) (defaults to: nil)

    Which type of packaging to perform.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'file_asset_source.rb', line 13

def initialize(source_hash:, deploy_time: nil, display_name: nil, executable: nil, file_name: nil, packaging: nil)
  @source_hash = source_hash
  Jsii::Type.check_type(@source_hash, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sourceHash")
  @deploy_time = deploy_time
  Jsii::Type.check_type(@deploy_time, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "deployTime") unless @deploy_time.nil?
  @display_name = display_name
  Jsii::Type.check_type(@display_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "displayName") unless @display_name.nil?
  @executable = executable
  Jsii::Type.check_type(@executable, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "executable") unless @executable.nil?
  @file_name = file_name
  Jsii::Type.check_type(@file_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "fileName") unless @file_name.nil?
  @packaging = packaging
  Jsii::Type.check_type(@packaging, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5GaWxlQXNzZXRQYWNrYWdpbmcifQ==")), "packaging") unless @packaging.nil?
end

Instance Attribute Details

#deploy_timeBoolean? (readonly)

Note:

Default: false

Whether or not the asset needs to exist beyond deployment time;

i.e. are copied over to a different location and not needed afterwards. Setting this property to true has an impact on the lifecycle of the asset, because we will assume that it is safe to delete after the CloudFormation deployment succeeds.

For example, Lambda Function assets are copied over to Lambda during deployment. Therefore, it is not necessary to store the asset in S3, so we consider those deployTime assets.

Returns:

  • (Boolean, nil)


50
51
52
# File 'file_asset_source.rb', line 50

def deploy_time
  @deploy_time
end

#display_nameString? (readonly)

Note:

Default: - The asset hash is used to display the asset

A display name for this asset.

If supplied, the display name will be used in locations where the asset identifier is printed, like in the CLI progress information.

Returns:

  • (String, nil)


58
59
60
# File 'file_asset_source.rb', line 58

def display_name
  @display_name
end

#executableArray<String>? (readonly)

Note:

Default: - Exactly one of fileName and executable is required

An external command that will produce the packaged asset.

The command should produce the location of a ZIP file on stdout.

Returns:

  • (Array<String>, nil)


65
66
67
# File 'file_asset_source.rb', line 65

def executable
  @executable
end

#file_nameString? (readonly)

Note:

Default: - Exactly one of fileName and executable is required

The path, relative to the root of the cloud assembly, in which this asset source resides.

This can be a path to a file or a directory, depending on the packaging type.

Returns:

  • (String, nil)


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

def file_name
  @file_name
end

#packagingAWSCDK::FileAssetPackaging? (readonly)

Note:

Default: - Required if fileName is specified.

Which type of packaging to perform.

Returns:



78
79
80
# File 'file_asset_source.rb', line 78

def packaging
  @packaging
end

#source_hashString (readonly)

A hash on the content source.

This hash is used to uniquely identify this asset throughout the system. If this value doesn't change, the asset will not be rebuilt or republished.

Returns:

  • (String)


35
36
37
# File 'file_asset_source.rb', line 35

def source_hash
  @source_hash
end

Class Method Details

.jsii_propertiesObject



80
81
82
83
84
85
86
87
88
89
# File 'file_asset_source.rb', line 80

def self.jsii_properties
  {
    :source_hash => "sourceHash",
    :deploy_time => "deployTime",
    :display_name => "displayName",
    :executable => "executable",
    :file_name => "fileName",
    :packaging => "packaging",
  }
end

Instance Method Details

#to_jsiiObject



91
92
93
94
95
96
97
98
99
100
101
102
# File 'file_asset_source.rb', line 91

def to_jsii
  result = {}
  result.merge!({
    "sourceHash" => @source_hash,
    "deployTime" => @deploy_time,
    "displayName" => @display_name,
    "executable" => @executable,
    "fileName" => @file_name,
    "packaging" => @packaging,
  })
  result.compact
end