constructor()

in source/aws-bootstrap-kit/lib/validate-email-provider.ts [55:95]


  constructor(scope: Construct, id: string, props: ValidateEmailProviderProps) {
    super(scope, id);

    const code = lambda.Code.fromAsset(
      path.join(__dirname, "validate-email-handler")
    );

    const onEventHandler = new lambda.Function(this, "OnEventHandler", {
      code,
      runtime: lambda.Runtime.NODEJS_14_X,
      handler: "index.onEventHandler",
      timeout: Duration.minutes(5)
    });

    onEventHandler.addToRolePolicy(
      new iam.PolicyStatement({
        actions: ["ses:verifyEmailIdentity"],
        resources: ["*"]
      })
    );

    const isCompleteHandler = new lambda.Function(this, "IsCompleteHandler", {
      code,
      runtime: lambda.Runtime.NODEJS_14_X,
      handler: "index.isCompleteHandler",
      timeout: props.timeout ? props.timeout : Duration.minutes(10)
    });

    isCompleteHandler.addToRolePolicy(
      new iam.PolicyStatement({
        actions: ["ses:getIdentityVerificationAttributes"],
        resources: ["*"]
      })
    );

    this.provider = new Provider(this, "EmailValidationProvider", {
      onEventHandler: onEventHandler,
      isCompleteHandler: isCompleteHandler,
      queryInterval: Duration.seconds(10)
    });
  }