Class: AWSCDK::EC2::InitFileAssetOptions

Inherits:
InitFileOptions
  • Object
show all
Defined in:
ec2/init_file_asset_options.rb

Overview

Additional options for creating an InitFile from an asset.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base64_encoded: nil, group: nil, mode: nil, owner: nil, service_restart_handles: nil, asset_hash: nil, asset_hash_type: nil, bundling: nil, exclude: nil, follow_symlinks: nil, ignore_mode: nil, deploy_time: nil, display_name: nil, readers: nil, source_kms_key: nil) ⇒ InitFileAssetOptions

Returns a new instance of InitFileAssetOptions.

Parameters:

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

    True if the inlined content (from a string or file) should be treated as base64 encoded.

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

    The name of the owning group for this file.

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

    A six-digit octal value representing the mode for this file.

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

    The name of the owning user for this file.

  • service_restart_handles (Array<AWSCDK::EC2::InitServiceRestartHandle>, nil) (defaults to: nil)

    Restart the given service after this file has been written.

  • 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.

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

    File paths matching the patterns will be excluded.

  • follow_symlinks (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.

  • 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.

  • readers (Array<AWSCDK::IAM::IGrantable>, nil) (defaults to: nil)

    A list of principals that should be able to read this asset from S3.

  • source_kms_key (AWSCDK::Interfaces::AWSKMS::IKeyRef, nil) (defaults to: nil)

    The ARN of the KMS key used to encrypt the handler code.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'ec2/init_file_asset_options.rb', line 23

def initialize(base64_encoded: nil, group: nil, mode: nil, owner: nil, service_restart_handles: nil, asset_hash: nil, asset_hash_type: nil, bundling: nil, exclude: nil, follow_symlinks: nil, ignore_mode: nil, deploy_time: nil, display_name: nil, readers: nil, source_kms_key: nil)
  @base64_encoded = base64_encoded
  Jsii::Type.check_type(@base64_encoded, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "base64Encoded") unless @base64_encoded.nil?
  @group = group
  Jsii::Type.check_type(@group, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "group") unless @group.nil?
  @mode = mode
  Jsii::Type.check_type(@mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "mode") unless @mode.nil?
  @owner = owner
  Jsii::Type.check_type(@owner, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "owner") unless @owner.nil?
  @service_restart_handles = service_restart_handles
  Jsii::Type.check_type(@service_restart_handles, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSW5pdFNlcnZpY2VSZXN0YXJ0SGFuZGxlIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "serviceRestartHandles") unless @service_restart_handles.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?
  @exclude = exclude
  Jsii::Type.check_type(@exclude, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "exclude") unless @exclude.nil?
  @follow_symlinks = follow_symlinks
  Jsii::Type.check_type(@follow_symlinks, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TeW1saW5rRm9sbG93TW9kZSJ9")), "followSymlinks") unless @follow_symlinks.nil?
  @ignore_mode = ignore_mode
  Jsii::Type.check_type(@ignore_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JZ25vcmVNb2RlIn0=")), "ignoreMode") unless @ignore_mode.nil?
  @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?
  @readers = readers
  Jsii::Type.check_type(@readers, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pYW0uSUdyYW50YWJsZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "readers") unless @readers.nil?
  @source_kms_key = source_kms_key
  Jsii::Type.check_type(@source_kms_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19rbXMuSUtleVJlZiJ9")), "sourceKMSKey") unless @source_kms_key.nil?
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)


109
110
111
# File 'ec2/init_file_asset_options.rb', line 109

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:



117
118
119
# File 'ec2/init_file_asset_options.rb', line 117

def asset_hash_type
  @asset_hash_type
end

#base64_encodedBoolean? (readonly)

Note:

Default: false

True if the inlined content (from a string or file) should be treated as base64 encoded.

Only applicable for inlined string and file content.

Returns:

  • (Boolean, nil)


62
63
64
# File 'ec2/init_file_asset_options.rb', line 62

def base64_encoded
  @base64_encoded
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:



127
128
129
# File 'ec2/init_file_asset_options.rb', line 127

def bundling
  @bundling
end

#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)


160
161
162
# File 'ec2/init_file_asset_options.rb', line 160

def deploy_time
  @deploy_time
end

#display_nameString? (readonly)

Note:

Default: - Stack-relative construct path

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. If the same asset is added multiple times, the display name of the first occurrence is used.

The default is the construct path of the Asset construct, with respect to the enclosing stack. If the asset is produced by a construct helper function (such as lambda.Code.fromAsset()), this will look like MyFunction/Code.

We use the stack-relative construct path so that in the common case where you have multiple stacks with the same asset, we won't show something like /MyBetaStack/MyFunction/Code when you are actually deploying to production.

Returns:

  • (String, nil)


180
181
182
# File 'ec2/init_file_asset_options.rb', line 180

def display_name
  @display_name
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)


135
136
137
# File 'ec2/init_file_asset_options.rb', line 135

def exclude
  @exclude
end
Note:

Default: SymlinkFollowMode.NEVER

A strategy for how to handle symlinks.

Returns:



140
141
142
# File 'ec2/init_file_asset_options.rb', line 140

def follow_symlinks
  @follow_symlinks
end

#groupString? (readonly)

Note:

Default: 'root'

The name of the owning group for this file.

Not supported for Windows systems.

Returns:

  • (String, nil)


69
70
71
# File 'ec2/init_file_asset_options.rb', line 69

def group
  @group
end

#ignore_modeAWSCDK::IgnoreMode? (readonly)

Note:

Default: IgnoreMode.GLOB

The ignore behavior to use for exclude patterns.

Returns:



145
146
147
# File 'ec2/init_file_asset_options.rb', line 145

def ignore_mode
  @ignore_mode
end

#modeString? (readonly)

Note:

Default: '000644'

A six-digit octal value representing the mode for this file.

Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644.

Not supported for Windows systems.

Returns:

  • (String, nil)


81
82
83
# File 'ec2/init_file_asset_options.rb', line 81

def mode
  @mode
end

#ownerString? (readonly)

Note:

Default: 'root'

The name of the owning user for this file.

Not supported for Windows systems.

Returns:

  • (String, nil)


88
89
90
# File 'ec2/init_file_asset_options.rb', line 88

def owner
  @owner
end

#readersArray<AWSCDK::IAM::IGrantable>? (readonly)

Note:

Default: - No principals that can read file asset.

A list of principals that should be able to read this asset from S3.

You can use asset.grantRead(principal) to grant read permissions later.

Returns:



187
188
189
# File 'ec2/init_file_asset_options.rb', line 187

def readers
  @readers
end

#service_restart_handlesArray<AWSCDK::EC2::InitServiceRestartHandle>? (readonly)

Note:

Default: - Do not restart any service

Restart the given service after this file has been written.

Returns:



93
94
95
# File 'ec2/init_file_asset_options.rb', line 93

def service_restart_handles
  @service_restart_handles
end

#source_kms_keyAWSCDK::Interfaces::AWSKMS::IKeyRef? (readonly)

Note:

Default: - the default server-side encryption with Amazon S3 managed keys(SSE-S3) key will be used.

The ARN of the KMS key used to encrypt the handler code.



192
193
194
# File 'ec2/init_file_asset_options.rb', line 192

def source_kms_key
  @source_kms_key
end

Class Method Details

.jsii_propertiesObject



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'ec2/init_file_asset_options.rb', line 194

def self.jsii_properties
  {
    :base64_encoded => "base64Encoded",
    :group => "group",
    :mode => "mode",
    :owner => "owner",
    :service_restart_handles => "serviceRestartHandles",
    :asset_hash => "assetHash",
    :asset_hash_type => "assetHashType",
    :bundling => "bundling",
    :exclude => "exclude",
    :follow_symlinks => "followSymlinks",
    :ignore_mode => "ignoreMode",
    :deploy_time => "deployTime",
    :display_name => "displayName",
    :readers => "readers",
    :source_kms_key => "sourceKMSKey",
  }
end

Instance Method Details

#to_jsiiObject



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'ec2/init_file_asset_options.rb', line 214

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "base64Encoded" => @base64_encoded,
    "group" => @group,
    "mode" => @mode,
    "owner" => @owner,
    "serviceRestartHandles" => @service_restart_handles,
    "assetHash" => @asset_hash,
    "assetHashType" => @asset_hash_type,
    "bundling" => @bundling,
    "exclude" => @exclude,
    "followSymlinks" => @follow_symlinks,
    "ignoreMode" => @ignore_mode,
    "deployTime" => @deploy_time,
    "displayName" => @display_name,
    "readers" => @readers,
    "sourceKMSKey" => @source_kms_key,
  })
  result.compact
end