HttpEventBridgeIntegration

class aws_cdk.aws_apigatewayv2_integrations.HttpEventBridgeIntegration(id, *, event_bus_ref, parameter_mapping=None, subtype=None)

Bases: HttpRouteIntegration

The EventBridge PutEvents integration resource for HTTP API.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_events as events
from aws_cdk.aws_apigatewayv2_integrations import HttpEventBridgeIntegration

# bus: events.IEventBus
# http_api: apigwv2.HttpApi


# default integration (PutEvents)
http_api.add_routes(
    path="/default",
    methods=[apigwv2.HttpMethod.POST],
    integration=HttpEventBridgeIntegration("DefaultEventBridgeIntegration",
        event_bus_ref=bus.event_bus_ref
    )
)

# explicit subtype
http_api.add_routes(
    path="/put-events",
    methods=[apigwv2.HttpMethod.POST],
    integration=HttpEventBridgeIntegration("ExplicitSubtypeIntegration",
        event_bus_ref=bus.event_bus_ref,
        subtype=apigwv2.HttpIntegrationSubtype.EVENTBRIDGE_PUT_EVENTS
    )
)
Parameters:
  • id (str) – id of the underlying integration construct.

  • event_bus_ref (Union[EventBusReference, Dict[str, Any]]) – EventBridge event bus that integrates with API Gateway.

  • parameter_mapping (Optional[ParameterMapping]) – Specifies how to transform HTTP requests before sending them to the backend. When not provided, a default mapping will be used that expects the incoming request body to contain the fields Detail, DetailType, and Source. The EventBusName is automatically included from eventBusRef in all cases, even when a custom parameterMapping is provided (unless explicitly overridden). This ensures consistency and eliminates redundant configuration. Default: - set Detail to $request.body.Detail, DetailType to $request.body.DetailType, Source to $request.body.Source, and EventBusName to the event bus name from eventBusRef.

  • subtype (Optional[HttpIntegrationSubtype]) – The subtype of the HTTP integration. Only subtypes starting with EVENTBRIDGE_ can be specified. Default: HttpIntegrationSubtype.EVENTBRIDGE_PUT_EVENTS

Methods

bind(*, route, scope)

Bind this integration to the route.

Parameters:
  • route (IHttpRoute) – The route to which this is being bound.

  • scope (Construct) – The current scope in which the bind is occurring. If the HttpRouteIntegration being bound creates additional constructs, this will be used as their parent scope.

Return type:

HttpRouteIntegrationConfig