Class: AWSCDK::S3Deployment::Source
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::S3Deployment::Source
- Defined in:
- s3_deployment/source.rb
Overview
Specifies bucket deployment source.
Usage:
Source.bucket(bucket, key)
Source.asset('/local/path/to/directory')
Source.asset('/local/path/to/a/file.zip')
Source.data('hello/world/file.txt', 'Hello, world!')
Source.jsonData('config.json', { baz: topic.topicArn })
Source.yamlData('config.yaml', { baz: topic.topicArn })
Class Method Summary collapse
-
.asset(path, options = nil) ⇒ AWSCDK::S3Deployment::ISource
Uses a local asset as the deployment source.
-
.bucket(bucket, zip_object_key) ⇒ AWSCDK::S3Deployment::ISource
Uses a .zip file stored in an S3 bucket as the source for the destination bucket contents.
-
.data(object_key, data, markers_config = nil) ⇒ AWSCDK::S3Deployment::ISource
Deploys an object with the specified string contents into the bucket.
- .jsii_overridable_methods ⇒ Object
-
.json_data(object_key, obj, json_processing_options = nil) ⇒ AWSCDK::S3Deployment::ISource
Deploys an object with the specified JSON object into the bucket.
-
.yaml_data(object_key, obj) ⇒ AWSCDK::S3Deployment::ISource
Deploys an object with the specified JSON object formatted as YAML into the bucket.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Source
constructor
A new instance of Source.
Constructor Details
#initialize(*args) ⇒ Source
Returns a new instance of Source.
19 20 21 |
# File 's3_deployment/source.rb', line 19 def initialize(*args) raise NoMethodError, "aws-cdk-lib.aws_s3_deployment.Source does not have a visible constructor; use the provided factory methods" end |
Class Method Details
.asset(path, options = nil) ⇒ AWSCDK::S3Deployment::ISource
Uses a local asset as the deployment source.
If the local asset is a .zip archive, make sure you trust the producer of the archive.
36 37 38 39 40 41 |
# File 's3_deployment/source.rb', line 36 def self.asset(path, = nil) Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") = .is_a?(Hash) ? ::AWSCDK::S3Assets::AssetOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczNfYXNzZXRzLkFzc2V0T3B0aW9ucyJ9")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3_deployment.Source", "asset", [path, ]) end |
.bucket(bucket, zip_object_key) ⇒ AWSCDK::S3Deployment::ISource
Uses a .zip file stored in an S3 bucket as the source for the destination bucket contents.
Make sure you trust the producer of the archive.
If the bucket parameter is an "out-of-app" reference "imported" via static methods such
as s3.Bucket.fromBucketName, be cautious about the bucket's encryption key. In general,
CDK does not query for additional properties of imported constructs at synthesis time.
For example, for a bucket created from s3.Bucket.fromBucketName, CDK does not know
its IBucket.encryptionKey property, and therefore will NOT give KMS permissions to the
Lambda execution role of the BucketDeployment construct. If you want the
kms:Decrypt and kms:DescribeKey permissions on the bucket's encryption key
to be added automatically, reference the imported bucket via s3.Bucket.fromBucketAttributes
and pass in the encryption_key attribute explicitly.
71 72 73 74 75 |
# File 's3_deployment/source.rb', line 71 def self.bucket(bucket, zip_object_key) Jsii::Type.check_type(bucket, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldCJ9")), "bucket") Jsii::Type.check_type(zip_object_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "zipObjectKey") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3_deployment.Source", "bucket", [bucket, zip_object_key]) end |
.data(object_key, data, markers_config = nil) ⇒ AWSCDK::S3Deployment::ISource
Deploys an object with the specified string contents into the bucket.
The
content can include deploy-time values (such as snsTopic.topicArn) that
will get resolved only during deployment.
To store a JSON object use Source.jsonData().
To store YAML content use Source.yamlData().
90 91 92 93 94 95 96 |
# File 's3_deployment/source.rb', line 90 def self.data(object_key, data, markers_config = nil) Jsii::Type.check_type(object_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectKey") Jsii::Type.check_type(data, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "data") markers_config = markers_config.is_a?(Hash) ? ::AWSCDK::S3Deployment::MarkersConfig.new(**markers_config.transform_keys(&:to_sym)) : markers_config Jsii::Type.check_type(markers_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczNfZGVwbG95bWVudC5NYXJrZXJzQ29uZmlnIn0=")), "markersConfig") unless markers_config.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3_deployment.Source", "data", [object_key, data, markers_config]) end |
.jsii_overridable_methods ⇒ Object
23 24 25 26 |
# File 's3_deployment/source.rb', line 23 def self.jsii_overridable_methods { } end |
.json_data(object_key, obj, json_processing_options = nil) ⇒ AWSCDK::S3Deployment::ISource
Deploys an object with the specified JSON object into the bucket.
The
object can include deploy-time values (such as snsTopic.topicArn) that
will get resolved only during deployment.
108 109 110 111 112 113 114 |
# File 's3_deployment/source.rb', line 108 def self.json_data(object_key, obj, = nil) Jsii::Type.check_type(object_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectKey") Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj") = .is_a?(Hash) ? ::AWSCDK::S3Deployment::JsonProcessingOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczNfZGVwbG95bWVudC5Kc29uUHJvY2Vzc2luZ09wdGlvbnMifQ==")), "jsonProcessingOptions") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3_deployment.Source", "jsonData", [object_key, obj, ]) end |
.yaml_data(object_key, obj) ⇒ AWSCDK::S3Deployment::ISource
Deploys an object with the specified JSON object formatted as YAML into the bucket.
The object can include deploy-time values (such as snsTopic.topicArn) that
will get resolved only during deployment.
124 125 126 127 128 |
# File 's3_deployment/source.rb', line 124 def self.yaml_data(object_key, obj) Jsii::Type.check_type(object_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectKey") Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3_deployment.Source", "yamlData", [object_key, obj]) end |