aws-cdk-lib.aws_lambda_event_sources.ApiEventSource

class ApiEventSource

LanguageType name
.NETAmazon.CDK.AWS.Lambda.EventSources.ApiEventSource
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambdaeventsources#ApiEventSource
Javasoftware.amazon.awscdk.services.lambda.eventsources.ApiEventSource
Pythonaws_cdk.aws_lambda_event_sources.ApiEventSource
TypeScript (source)aws-cdk-lib » aws_lambda_event_sources » ApiEventSource

Implements IEventSource

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigateway as apigateway } from 'aws-cdk-lib';
import { aws_lambda_event_sources as lambda_event_sources } from 'aws-cdk-lib';

declare const authorizer: apigateway.Authorizer;
declare const model: apigateway.Model;
declare const requestValidator: apigateway.RequestValidator;
const apiEventSource = new lambda_event_sources.ApiEventSource('method', 'path', /* all optional props */ {
  apiKeyRequired: false,
  authorizationScopes: ['authorizationScopes'],
  authorizationType: apigateway.AuthorizationType.NONE,
  authorizer: authorizer,
  methodResponses: [{
    statusCode: 'statusCode',

    // the properties below are optional
    responseModels: {
      responseModelsKey: model,
    },
    responseParameters: {
      responseParametersKey: false,
    },
  }],
  operationName: 'operationName',
  requestModels: {
    requestModelsKey: model,
  },
  requestParameters: {
    requestParametersKey: false,
  },
  requestValidator: requestValidator,
  requestValidatorOptions: {
    requestValidatorName: 'requestValidatorName',
    validateRequestBody: false,
    validateRequestParameters: false,
  },
});

Initializer

new ApiEventSource(method: string, path: string, options?: MethodOptions)

Parameters

  • method string
  • path string
  • options MethodOptions

Methods

NameDescription
bind(target)Called by lambda.addEventSource to allow the event source to bind to this function.

bind(target)

public bind(target: IFunction): void

Parameters

  • target IFunction

Called by lambda.addEventSource to allow the event source to bind to this function.