Class Source
Specifies bucket deployment source.
Inheritance
Namespace: Amazon.CDK.AWS.S3.Deployment
Assembly: Amazon.CDK.AWS.S3.Deployment.dll
Syntax (csharp)
public class Source : DeputyBase
Syntax (vb)
Public Class Source
Inherits DeputyBase
Remarks
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 })
ExampleMetadata: infused
Examples
Bucket websiteBucket;
var deployment = new BucketDeployment(this, "DeployWebsite", new BucketDeploymentProps {
Sources = new [] { Source.Asset(Join(__dirname, "my-website")) },
DestinationBucket = websiteBucket
});
new ConstructThatReadsFromTheBucket(this, "Consumer", new Dictionary<string, IBucket> {
// Use 'deployment.deployedBucket' instead of 'websiteBucket' here
{ "bucket", deployment.DeployedBucket }
});
Synopsis
Constructors
Source(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Source(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
Asset(String, IAssetOptions) | Uses a local asset as the deployment source. |
Bucket(IBucket, String) | Uses a .zip file stored in an S3 bucket as the source for the destination bucket contents. |
Data(String, String) | Deploys an object with the specified string contents into the bucket. |
JsonData(String, Object) | Deploys an object with the specified JSON object into the bucket. |
Constructors
Source(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Source(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Source(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Source(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
Asset(String, IAssetOptions)
Uses a local asset as the deployment source.
public static ISource Asset(string path, IAssetOptions options = null)
Parameters
- path System.String
The path to a local .zip file or a directory.
- options IAssetOptions
The path to a local .zip file or a directory.
Returns
Remarks
If the local asset is a .zip archive, make sure you trust the producer of the archive.
Bucket(IBucket, String)
Uses a .zip file stored in an S3 bucket as the source for the destination bucket contents.
public static ISource Bucket(IBucket bucket, string zipObjectKey)
Parameters
- bucket IBucket
The S3 Bucket.
- zipObjectKey System.String
The S3 object key of the zip file with contents.
Returns
Remarks
Make sure you trust the producer of the archive.
Data(String, String)
Deploys an object with the specified string contents into the bucket.
public static ISource Data(string objectKey, string data)
Parameters
- objectKey System.String
The destination S3 object key (relative to the root of the S3 deployment).
- data System.String
The data to be stored in the object.
Returns
Remarks
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()
.
JsonData(String, Object)
Deploys an object with the specified JSON object into the bucket.
public static ISource JsonData(string objectKey, object obj)
Parameters
- objectKey System.String
The destination S3 object key (relative to the root of the S3 deployment).
- obj System.Object
A JSON object.
Returns
Remarks
The
object can include deploy-time values (such as snsTopic.topicArn
) that
will get resolved only during deployment.