# IEventApi

Interface for Event API.

Extends: [IApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.IApi.html)
Implemented by: [EventApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.EventApi.html), [EventApiBase](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.EventApiBase.html)
Obtainable from: [EventApi.fromEventApiAttributes](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.EventApi.html#fromeventapiattributes)

- Source: [`aws-appsync/lib/eventapi.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-appsync/lib/eventapi.ts#L134)
- Type last changed: v2.193.0 · 30 Apr 2025

## Properties

- `apiArn`: string — The ARN of the AWS AppSync Api.

- `apiId`: string — The unique identifier for the AWS AppSync Api generated by the service.

- `apiRef`: [ApiReference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_appsync.ApiReference.html) — A reference to a Api resource.

- `authProviderTypes`: [AppSyncAuthorizationType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncAuthorizationType.html)[] — The Authorization Types for this Event Api.

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `httpDns`: string — The domain name of the Api's HTTP endpoint.

- `node`: [Node](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `realtimeDns`: string — The domain name of the Api's real-time endpoint.

- `stack`: [Stack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `addChannelNamespace(id: string, options?: ChannelNamespaceOptions): ChannelNamespace` — add a new channel namespace.

  **Parameters**

  - `id` — the id of the channel namespace.
  - `options` — the options for the channel namespace.

  **Returns:** the channel namespace

- `addDynamoDbDataSource(id: string, table: ITable, options?: AppSyncDataSourceOptions): AppSyncDynamoDbDataSource` — Add a new DynamoDB data source to this API.

  **Parameters**

  - `id` — The data source's id.
  - `table` — The DynamoDB table backing this data source.
  - `options` — The optional configuration for this data source.

- `addEventBridgeDataSource(id: string, eventBus: IEventBus, options?: AppSyncDataSourceOptions): AppSyncEventBridgeDataSource` — Add an EventBridge data source to this api.

  **Parameters**

  - `id` — The data source's id.
  - `eventBus` — The EventBridge EventBus on which to put events.
  - `options` — The optional configuration for this data source.

- `addHttpDataSource(id: string, endpoint: string, options?: AppSyncHttpDataSourceOptions): AppSyncHttpDataSource` — add a new http data source to this API.

  **Parameters**

  - `id` — The data source's id.
  - `endpoint` — The http endpoint.
  - `options` — The optional configuration for this data source.

- `addLambdaDataSource(id: string, lambdaFunction: IFunction, options?: AppSyncDataSourceOptions): AppSyncLambdaDataSource` — add a new Lambda data source to this API.

  **Parameters**

  - `id` — The data source's id.
  - `lambdaFunction` — The Lambda function to call to interact with this data source.
  - `options` — The optional configuration for this data source.

- `addOpenSearchDataSource(id: string, domain: IDomain, options?: AppSyncDataSourceOptions): AppSyncOpenSearchDataSource` — Add a new OpenSearch data source to this API.

  **Parameters**

  - `id` — The data source's id.
  - `domain` — The OpenSearch domain for this data source.
  - `options` — The optional configuration for this data source.

- `addRdsDataSource(id: string, serverlessCluster: IDatabaseCluster | IServerlessCluster, secretStore: ISecret, databaseName?: string, options?: AppSyncDataSourceOptions): AppSyncRdsDataSource` — add a new Rds data source to this API.

  **Parameters**

  - `id` — The data source's id.
  - `serverlessCluster` — The database cluster to interact with this data source.
  - `secretStore` — The secret store that contains the username and password for the database cluster.
  - `databaseName` — The optional name of the database to use within the cluster.
  - `options` — The optional configuration for this data source.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `grant(grantee: IGrantable, resources: AppSyncEventResource, ...actions: string[]): Grant` — Adds an IAM policy statement associated with this Event API to an IAM principal's policy.

  **Parameters**

  - `grantee` — The principal.
  - `resources` — The set of resources to allow (i.e. ...:[region]:[accountId]:apis/EventApiId/...).
  - `actions` — The actions that should be granted to the principal (i.e. appsync:EventPublish ).

- `grantConnect(grantee: IGrantable): Grant` — Adds an IAM policy statement for EventConnect access to this EventApi to an IAM principal's policy.

  **Parameters**

  - `grantee` — The principal.

- `grantPublish(grantee: IGrantable): Grant` — Adds an IAM policy statement for EventPublish access to this EventApi to an IAM principal's policy.

  **Parameters**

  - `grantee` — The principal.

- `grantPublishAndSubscribe(grantee: IGrantable): Grant` — Adds an IAM policy statement to publish and subscribe to this API for an IAM principal's policy.

  **Parameters**

  - `grantee` — The principal.

- `grantSubscribe(grantee: IGrantable): Grant` — Adds an IAM policy statement for EventSubscribe access to this EventApi to an IAM principal's policy.

  **Parameters**

  - `grantee` — The principal.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
