UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

99 lines (98 loc) 2.93 kB
import { IConstruct } from 'constructs'; import * as iam from '../../aws-iam'; import * as lambda from '../../aws-lambda'; /** * Deployment lifecycle stages where hooks can be executed */ export declare enum DeploymentLifecycleStage { /** * Execute during service reconciliation */ RECONCILE_SERVICE = "RECONCILE_SERVICE", /** * Execute before scaling up tasks */ PRE_SCALE_UP = "PRE_SCALE_UP", /** * Execute after scaling up tasks */ POST_SCALE_UP = "POST_SCALE_UP", /** * Execute during test traffic shift */ TEST_TRAFFIC_SHIFT = "TEST_TRAFFIC_SHIFT", /** * Execute after test traffic shift */ POST_TEST_TRAFFIC_SHIFT = "POST_TEST_TRAFFIC_SHIFT", /** * Execute during production traffic shift */ PRODUCTION_TRAFFIC_SHIFT = "PRODUCTION_TRAFFIC_SHIFT", /** * Execute after production traffic shift */ POST_PRODUCTION_TRAFFIC_SHIFT = "POST_PRODUCTION_TRAFFIC_SHIFT" } /** * Configuration for a deployment lifecycle hook target */ export interface DeploymentLifecycleHookTargetConfig { /** * The ARN of the target resource */ readonly targetArn: string; /** * The IAM role that grants permissions to invoke the target * @default - a role will be created automatically */ readonly role?: iam.IRole; /** * The lifecycle stages when this hook should be executed */ readonly lifecycleStages: DeploymentLifecycleStage[]; } /** * Interface for deployment lifecycle hook targets */ export interface IDeploymentLifecycleHookTarget { /** * Bind this target to a deployment lifecycle hook * * @param scope The construct scope * @param id A unique identifier for this binding */ bind(scope: IConstruct): DeploymentLifecycleHookTargetConfig; } /** * Configuration for a lambda deployment lifecycle hook */ export interface DeploymentLifecycleLambdaTargetProps { /** * The IAM role that grants permissions to invoke the lambda target * @default - A unique role will be generated for this lambda function. */ readonly role?: iam.IRole; /** * The lifecycle stages when this hook should be executed */ readonly lifecycleStages: DeploymentLifecycleStage[]; } /** * Use an AWS Lambda function as a deployment lifecycle hook target */ export declare class DeploymentLifecycleLambdaTarget implements IDeploymentLifecycleHookTarget { private readonly handler; private readonly id; private readonly props; private _role?; constructor(handler: lambda.IFunction, id: string, props: DeploymentLifecycleLambdaTargetProps); /** * The IAM role for the deployment lifecycle hook target */ get role(): iam.IRole; /** * Bind this target to a deployment lifecycle hook */ bind(scope: IConstruct): DeploymentLifecycleHookTargetConfig; }