Class: AWSCDK::BedrockAgentCore::CodeAssetOptions
- Inherits:
-
S3Assets::AssetOptions
- Object
- S3Assets::AssetOptions
- AWSCDK::BedrockAgentCore::CodeAssetOptions
- Defined in:
- bedrock_agent_core/code_asset_options.rb
Overview
Options for configuring an S3 code asset from local files for agent runtime artifact.
Instance Attribute Summary collapse
-
#asset_hash ⇒ String?
readonly
Specify a custom hash for this asset.
-
#asset_hash_type ⇒ AWSCDK::AssetHashType?
readonly
Specifies the type of hash to calculate for this asset.
-
#bundling ⇒ AWSCDK::BundlingOptions?
readonly
Bundle the asset by executing a command in a Docker container or a custom bundling provider.
-
#deploy_time ⇒ Boolean?
readonly
Whether or not the asset needs to exist beyond deployment time;.
-
#display_name ⇒ String?
readonly
A display name for this asset.
-
#entrypoint ⇒ Array<String>
readonly
The entry point for the code execution, specifying the function or method that should be invoked when the code runs.
-
#exclude ⇒ Array<String>?
readonly
File paths matching the patterns will be excluded.
-
#follow_symlinks ⇒ AWSCDK::SymlinkFollowMode?
readonly
A strategy for how to handle symlinks.
-
#ignore_mode ⇒ AWSCDK::IgnoreMode?
readonly
The ignore behavior to use for
excludepatterns. -
#path ⇒ String
readonly
The file path to the code asset.
-
#readers ⇒ Array<AWSCDK::IAM::IGrantable>?
readonly
A list of principals that should be able to read this asset from S3.
-
#runtime ⇒ AWSCDK::BedrockAgentCore::AgentCoreRuntime
readonly
The runtime environment for executing the code.
-
#source_kms_key ⇒ AWSCDK::Interfaces::AWSKMS::IKeyRef?
readonly
The ARN of the KMS key used to encrypt the handler code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(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, entrypoint:, path:, runtime:) ⇒ CodeAssetOptions
constructor
A new instance of CodeAssetOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(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, entrypoint:, path:, runtime:) ⇒ CodeAssetOptions
Returns a new instance of CodeAssetOptions.
20 21 22 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 |
# File 'bedrock_agent_core/code_asset_options.rb', line 20 def initialize(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, entrypoint:, path:, runtime:) @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? @entrypoint = entrypoint Jsii::Type.check_type(@entrypoint, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "entrypoint") @path = path Jsii::Type.check_type(@path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") @runtime = runtime Jsii::Type.check_type(@runtime, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5BZ2VudENvcmVSdW50aW1lIn0=")), "runtime") end |
Instance Attribute Details
#asset_hash ⇒ String? (readonly)
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.
64 65 66 |
# File 'bedrock_agent_core/code_asset_options.rb', line 64 def asset_hash @asset_hash end |
#asset_hash_type ⇒ AWSCDK::AssetHashType? (readonly)
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.
72 73 74 |
# File 'bedrock_agent_core/code_asset_options.rb', line 72 def asset_hash_type @asset_hash_type end |
#bundling ⇒ AWSCDK::BundlingOptions? (readonly)
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.
82 83 84 |
# File 'bedrock_agent_core/code_asset_options.rb', line 82 def bundling @bundling end |
#deploy_time ⇒ Boolean? (readonly)
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.
115 116 117 |
# File 'bedrock_agent_core/code_asset_options.rb', line 115 def deploy_time @deploy_time end |
#display_name ⇒ String? (readonly)
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.
135 136 137 |
# File 'bedrock_agent_core/code_asset_options.rb', line 135 def display_name @display_name end |
#entrypoint ⇒ Array<String> (readonly)
The entry point for the code execution, specifying the function or method that should be invoked when the code runs.
151 152 153 |
# File 'bedrock_agent_core/code_asset_options.rb', line 151 def entrypoint @entrypoint end |
#exclude ⇒ Array<String>? (readonly)
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.
90 91 92 |
# File 'bedrock_agent_core/code_asset_options.rb', line 90 def exclude @exclude end |
#follow_symlinks ⇒ AWSCDK::SymlinkFollowMode? (readonly)
Default: SymlinkFollowMode.NEVER
A strategy for how to handle symlinks.
95 96 97 |
# File 'bedrock_agent_core/code_asset_options.rb', line 95 def follow_symlinks @follow_symlinks end |
#ignore_mode ⇒ AWSCDK::IgnoreMode? (readonly)
Default: IgnoreMode.GLOB
The ignore behavior to use for exclude patterns.
100 101 102 |
# File 'bedrock_agent_core/code_asset_options.rb', line 100 def ignore_mode @ignore_mode end |
#path ⇒ String (readonly)
The file path to the code asset.
155 156 157 |
# File 'bedrock_agent_core/code_asset_options.rb', line 155 def path @path end |
#readers ⇒ Array<AWSCDK::IAM::IGrantable>? (readonly)
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.
142 143 144 |
# File 'bedrock_agent_core/code_asset_options.rb', line 142 def readers @readers end |
#runtime ⇒ AWSCDK::BedrockAgentCore::AgentCoreRuntime (readonly)
The runtime environment for executing the code.
159 160 161 |
# File 'bedrock_agent_core/code_asset_options.rb', line 159 def runtime @runtime end |
#source_kms_key ⇒ AWSCDK::Interfaces::AWSKMS::IKeyRef? (readonly)
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.
147 148 149 |
# File 'bedrock_agent_core/code_asset_options.rb', line 147 def source_kms_key @source_kms_key end |
Class Method Details
.jsii_properties ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'bedrock_agent_core/code_asset_options.rb', line 161 def self.jsii_properties { :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", :entrypoint => "entrypoint", :path => "path", :runtime => "runtime", } end |
Instance Method Details
#to_jsii ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'bedrock_agent_core/code_asset_options.rb', line 179 def to_jsii result = {} result.merge!(super) result.merge!({ "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, "entrypoint" => @entrypoint, "path" => @path, "runtime" => @runtime, }) result.compact end |