# ApiEventSource

Extends: ApiEventSource
Implements: IEventSource

- Source: [`aws-lambda-event-sources/lib/api.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-lambda-event-sources/lib/api.ts#L6)

## Example

```ts
// 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

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

## Methods

- `bind(target: IFunction): void` — Called by `lambda.addEventSource` to allow the event source to bind to this function.
