cdk-s3-upload-presignedurl-api
Version:
API to get an S3 presigned url for file uploads
58 lines (57 loc) • 1.94 kB
TypeScript
import { RestApi, RestApiProps } from 'aws-cdk-lib/aws-apigateway';
import { UserPool, UserPoolClient } from 'aws-cdk-lib/aws-cognito';
import { RetentionDays } from 'aws-cdk-lib/aws-logs';
import { Bucket } from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
export interface IS3UploadSignedUrlApiProps {
/**
* Optional bucket where files should be uploaded to. Should contains the CORS properties
*
* @default - Default Bucket is created
*/
readonly existingBucketObj?: Bucket;
/**
* Optional Cognito User Pool to secure the API. You should have created a User Pool Client too.
*
* @default - Default User Pool (and User Pool Client) are created
*/
readonly existingUserPoolObj?: UserPool;
/**
* Optional CORS allowedOrigins.
* Should allow your domain(s) as allowed origin to request the API
*
* @default ['*']
*/
readonly allowedOrigins?: string[];
/**
* Optional expiration time in second. Time before the presigned url expires.
*
* @default 300
*/
readonly expiration?: number;
/**
* Optional user provided props to override the default props for the API Gateway.
*
* @default - Default props are used
*/
readonly apiGatewayProps?: RestApiProps | any;
/**
* Optional boolean to specify if the API is secured (with Cognito) or publicly open
*
* @default true
*/
readonly secured?: boolean;
/**
* Optional log retention time for Lambda and API Gateway
*
* @default one week
*/
readonly logRetention?: RetentionDays;
}
export declare class S3UploadPresignedUrlApi extends Construct {
readonly bucket: Bucket;
readonly restApi: RestApi;
readonly userPool?: UserPool | any;
readonly userPoolClient?: UserPoolClient | any;
constructor(scope: Construct, id: string, props?: IS3UploadSignedUrlApiProps);
}