Class: AWSCDK::S3Deployment::BucketDeployment

Inherits:
Constructs::Construct
  • Object
show all
Defined in:
s3_deployment/bucket_deployment.rb

Overview

BucketDeployment populates an S3 bucket with the contents of .zip files from other S3 buckets or from local disk.

Direct Known Subclasses

DeployTimeSubstitutedFile

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ BucketDeployment

Returns a new instance of BucketDeployment.

Parameters:



11
12
13
14
15
16
17
# File 's3_deployment/bucket_deployment.rb', line 11

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::S3Deployment::BucketDeploymentProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczNfZGVwbG95bWVudC5CdWNrZXREZXBsb3ltZW50UHJvcHMifQ==")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.jsii_overridable_methodsObject



19
20
21
22
23
24
25
26
27
28
29
# File 's3_deployment/bucket_deployment.rb', line 19

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :deployed_bucket => { kind: :property, name: "deployedBucket", is_optional: false },
    :handler_role => { kind: :property, name: "handlerRole", is_optional: false },
    :object_keys => { kind: :property, name: "objectKeys", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :add_source => { kind: :method, name: "addSource", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


41
42
43
# File 's3_deployment/bucket_deployment.rb', line 41

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_s3_deployment.BucketDeployment", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_source(source) ⇒ void

This method returns an undefined value.

Add an additional source to the bucket deployment.

Examples:

website_bucket = nil # AWSCDK::S3::IBucket

deployment = AWSCDK::S3Deployment::BucketDeployment.new(self, "Deployment", {
    sources: [AWSCDK::S3Deployment::Source.asset("./website-dist")],
    destination_bucket: website_bucket,
})

deployment.add_source(AWSCDK::S3Deployment::Source.asset("./another-asset"))

Parameters:



119
120
121
122
# File 's3_deployment/bucket_deployment.rb', line 119

def add_source(source)
  Jsii::Type.check_type(source, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczNfZGVwbG95bWVudC5JU291cmNlIn0=")), "source")
  jsii_call_method("addSource", [source])
end

#deployed_bucketAWSCDK::S3::IBucket

The bucket after the deployment.

If you want to reference the destination bucket in another construct and make sure the bucket deployment has happened before the next operation is started, pass the other construct a reference to deployment.deployedBucket.

Note that this only returns an immutable reference to the destination bucket. If sequenced access to the original destination bucket is required, you may add a dependency on the bucket deployment instead: otherResource.node.addDependency(deployment)

Returns:



56
57
58
# File 's3_deployment/bucket_deployment.rb', line 56

def deployed_bucket()
  jsii_get_property("deployedBucket")
end

#handler_roleAWSCDK::IAM::IRole

Execution role of the Lambda function behind the custom CloudFormation resource of type Custom::CDKBucketDeployment.

Returns:



63
64
65
# File 's3_deployment/bucket_deployment.rb', line 63

def handler_role()
  jsii_get_property("handlerRole")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


34
35
36
# File 's3_deployment/bucket_deployment.rb', line 34

def node()
  jsii_get_property("node")
end

#object_keysArray<String>

The object keys for the sources deployed to the S3 bucket.

This returns a list of tokenized object keys for source files that are deployed to the bucket.

This can be useful when using BucketDeployment with extract set to false and you need to reference the object key that resides in the bucket for that zip source file somewhere else in your CDK application, such as in a CFN output.

For example, use Fn.select(0, myBucketDeployment.objectKeys) to reference the object key of the first source file in your bucket deployment.

Returns:

  • (Array<String>)


79
80
81
# File 's3_deployment/bucket_deployment.rb', line 79

def object_keys()
  jsii_get_property("objectKeys")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


86
87
88
# File 's3_deployment/bucket_deployment.rb', line 86

def to_string()
  jsii_call_method("toString", [])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



99
100
101
102
103
104
# File 's3_deployment/bucket_deployment.rb', line 99

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end