@capraconsulting/webapp-deploy-lambda
Version:
CDK construct for deploying a webapp release to S3 and CloudFront
59 lines (58 loc) • 1.62 kB
TypeScript
import * as constructs from "constructs";
import * as iam from "aws-cdk-lib/aws-iam";
import * as s3 from "aws-cdk-lib/aws-s3";
import * as s3Assets from "aws-cdk-lib/aws-s3-assets";
export interface SourceConfig {
/**
* The source bucket to deploy from.
*/
readonly bucket: s3.IBucket;
/**
* An S3 object key in the source bucket that points to a zip file.
*/
readonly zipObjectKey: string;
}
/**
* Bind context for ISources
*/
export interface SourceContext {
/**
* The role for the handler
*
* @default - no policy is modified
*/
readonly handlerRole?: iam.IRole;
}
/**
* Represents a source for bucket deployments.
*/
export interface ISource {
/**
* Binds the source to a bucket deployment.
*/
bind(scope: constructs.Construct, context?: SourceContext): SourceConfig;
}
/**
* Specifies bucket deployment source.
*
* Usage:
*
* Source.bucket(bucket, key)
* Source.asset('/local/path/to/directory')
* Source.asset('/local/path/to/a/file.zip')
*
*/
export declare class Source {
/**
* Uses a .zip file stored in an S3 bucket as the source for the destination bucket contents.
* @param bucket The S3 Bucket
* @param zipObjectKey The S3 object key of the zip file with contents
*/
static bucket(bucket: s3.IBucket, zipObjectKey: string): ISource;
/**
* Uses a local asset as the deployment source.
* @param path The path to a local .zip file or a directory
*/
static asset(path: string, options?: s3Assets.AssetOptions): ISource;
private constructor();
}