@scloud/cdk-patterns
Version: 
Serverless CDK patterns for common infrastructure needs
30 lines (29 loc) • 1.36 kB
TypeScript
import { Function } from 'aws-cdk-lib/aws-lambda';
import { Construct } from 'constructs';
import { Rule, Schedule } from 'aws-cdk-lib/aws-events';
import { ZipFunctionProps } from './ZipFunction';
import { ContainerFunctionProps } from './ContainerFunction';
/**
 *
 */
export interface ScheduledFunctionProps {
    lambda: Function;
    schedule: Schedule;
    description?: string;
}
/**
 * A Lambda function triggered by scheduled Cloudwatch events.
 *
 * The default schedule is Schedule.cron({ minute: '11', hour: '1' })
 * Which sets '11 1 * * ? *' (i.e. 1:11am every day)
 *
 * You can also pass an optional description for the rule for readability in the Cloudwatch view in the AWS console.
 */
export declare class ScheduledFunction extends Construct {
    lambda: Function;
    rule: Rule;
    constructor(scope: Construct, id: string, props: ScheduledFunctionProps);
    static node(scope: Construct, id: string, functionProps?: ZipFunctionProps, schedule?: Schedule, description?: string | undefined): ScheduledFunction;
    static python(scope: Construct, id: string, functionProps?: ZipFunctionProps, schedule?: Schedule, description?: string | undefined): ScheduledFunction;
    static container(scope: Construct, id: string, functionProps?: ContainerFunctionProps, schedule?: Schedule, description?: string | undefined): ScheduledFunction;
}