HttpEventBridgeIntegrationProps

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

Bases: object

Properties to initialize HttpEventBridgeIntegration.

Parameters:
  • 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. Default: - set Detail to $request.body.Detail, DetailType to $request.body.DetailType, and Source to $request.body.Source.

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

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
    )
)

Attributes

event_bus_ref

EventBridge event bus that integrates with API Gateway.

parameter_mapping

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.

Default:

  • set Detail to $request.body.Detail,

DetailType to $request.body.DetailType, and Source to $request.body.Source.

See:

https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-aws-services-reference.html

subtype

The subtype of the HTTP integration.

Only subtypes starting with EVENTBRIDGE_ can be specified.

Default:

HttpIntegrationSubtype.EVENTBRIDGE_PUT_EVENTS