java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.s3.deployment.Source
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:45.560Z") @Stability(Stable) public class Source extends software.amazon.jsii.JsiiObject
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.data('config.json', { baz: topic.topicArn })
 

Example:

 Bucket websiteBucket;
 BucketDeployment deployment = BucketDeployment.Builder.create(this, "DeployWebsite")
         .sources(List.of(Source.asset(join(__dirname, "my-website"))))
         .destinationBucket(websiteBucket)
         .build();
 new ConstructThatReadsFromTheBucket(this, "Consumer", Map.of(
         // Use 'deployment.deployedBucket' instead of 'websiteBucket' here
         "bucket", deployment.getDeployedBucket()));
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Source(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Source(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static ISource
    asset(String path)
    Uses a local asset as the deployment source.
    static ISource
    asset(String path, AssetOptions options)
    Uses a local asset as the deployment source.
    static ISource
    bucket(IBucket bucket, String zipObjectKey)
    Uses a .zip file stored in an S3 bucket as the source for the destination bucket contents.
    static ISource
    data(String objectKey, String data)
    Deploys an object with the specified string contents into the bucket.
    static ISource
    jsonData(String objectKey, Object obj)
    Deploys an object with the specified JSON object into the bucket.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Source

      protected Source(software.amazon.jsii.JsiiObjectRef objRef)
    • Source

      protected Source(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • asset

      @Stability(Stable) @NotNull public static ISource asset(@NotNull String path, @Nullable AssetOptions options)
      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.

      Parameters:
      path - The path to a local .zip file or a directory. This parameter is required.
      options -
    • asset

      @Stability(Stable) @NotNull public static ISource asset(@NotNull String path)
      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.

      Parameters:
      path - The path to a local .zip file or a directory. This parameter is required.
    • bucket

      @Stability(Stable) @NotNull public static ISource bucket(@NotNull IBucket bucket, @NotNull String zipObjectKey)
      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.

      Parameters:
      bucket - The S3 Bucket. This parameter is required.
      zipObjectKey - The S3 object key of the zip file with contents. This parameter is required.
    • data

      @Stability(Stable) @NotNull public static ISource data(@NotNull String objectKey, @NotNull String data)
      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().

      Parameters:
      objectKey - The destination S3 object key (relative to the root of the S3 deployment). This parameter is required.
      data - The data to be stored in the object. This parameter is required.
    • jsonData

      @Stability(Stable) @NotNull public static ISource jsonData(@NotNull String objectKey, @NotNull Object obj)
      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.

      Parameters:
      objectKey - The destination S3 object key (relative to the root of the S3 deployment). This parameter is required.
      obj - A JSON object. This parameter is required.