HttpEventBridgeIntegrationProps Struct
Properties to initialize HttpEventBridgeIntegration.
| Source | aws-apigatewayv2-integrations/lib/http/eventbridge.ts |
|---|---|
| Type last changed |
Example
ts
import * as events from 'aws-cdk-lib/aws-events';
import { HttpEventBridgeIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
declare const bus: events.IEventBus;
declare const httpApi: apigwv2.HttpApi;
// default integration (PutEvents)
httpApi.addRoutes({
path: '/default',
methods: [apigwv2.HttpMethod.POST],
integration: new HttpEventBridgeIntegration('DefaultEventBridgeIntegration', {
eventBusRef: bus.eventBusRef,
}),
});
// explicit subtype
httpApi.addRoutes({
path: '/put-events',
methods: [apigwv2.HttpMethod.POST],
integration: new HttpEventBridgeIntegration('ExplicitSubtypeIntegration', {
eventBusRef: bus.eventBusRef,
subtype: apigwv2.HttpIntegrationSubtype.EVENTBRIDGE_PUT_EVENTS,
}),
});
python
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
)
)
java
import software.amazon.awscdk.services.events.*;
import software.amazon.awscdk.aws_apigatewayv2_integrations.HttpEventBridgeIntegration;
IEventBus bus;
HttpApi httpApi;
// default integration (PutEvents)
httpApi.addRoutes(AddRoutesOptions.builder()
.path("/default")
.methods(List.of(HttpMethod.POST))
.integration(HttpEventBridgeIntegration.Builder.create("DefaultEventBridgeIntegration")
.eventBusRef(bus.getEventBusRef())
.build())
.build());
// explicit subtype
httpApi.addRoutes(AddRoutesOptions.builder()
.path("/put-events")
.methods(List.of(HttpMethod.POST))
.integration(HttpEventBridgeIntegration.Builder.create("ExplicitSubtypeIntegration")
.eventBusRef(bus.getEventBusRef())
.subtype(HttpIntegrationSubtype.EVENTBRIDGE_PUT_EVENTS)
.build())
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Events;
using Amazon.CDK.AwsApigatewayv2Integrations;
IEventBus bus;
HttpApi httpApi;
// default integration (PutEvents)
httpApi.AddRoutes(new AddRoutesOptions {
Path = "/default",
Methods = new [] { HttpMethod.POST },
Integration = new HttpEventBridgeIntegration("DefaultEventBridgeIntegration", new HttpEventBridgeIntegrationProps {
EventBusRef = bus.EventBusRef
})
});
// explicit subtype
httpApi.AddRoutes(new AddRoutesOptions {
Path = "/put-events",
Methods = new [] { HttpMethod.POST },
Integration = new HttpEventBridgeIntegration("ExplicitSubtypeIntegration", new HttpEventBridgeIntegrationProps {
EventBusRef = bus.EventBusRef,
Subtype = HttpIntegrationSubtype.EVENTBRIDGE_PUT_EVENTS
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import events "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var bus IEventBus
var httpApi HttpApi
// default integration (PutEvents)
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/default"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpEventBridgeIntegration(jsii.String("DefaultEventBridgeIntegration"), &HttpEventBridgeIntegrationProps{
EventBusRef: bus.EventBusRef,
}),
})
// explicit subtype
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/put-events"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpEventBridgeIntegration(jsii.String("ExplicitSubtypeIntegration"), &HttpEventBridgeIntegrationProps{
EventBusRef: bus.*EventBusRef,
Subtype: apigwv2.HttpIntegrationSubtype_EVENTBRIDGE_PUT_EVENTS,
}),
})
Properties
eventBusRefEventBusReferenceevent_bus_refEventBusReferenceeventBusRefEventBusReferenceEventBusRefEventBusReferenceEventBusRefEventBusReference required #EventBridge event bus that integrates with API Gateway.
parameterMappingoptionalParameterMappingparameter_mappingoptionalParameterMappingparameterMappingoptionalParameterMappingParameterMappingoptionalParameterMappingParameterMappingoptionalParameterMapping #Specifies how to transform HTTP requests before sending them to the backend.
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.
notes
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.
subtypeoptionalHttpIntegrationSubtypesubtypeoptionalHttpIntegrationSubtypesubtypeoptionalHttpIntegrationSubtypeSubtypeoptionalHttpIntegrationSubtypeSubtypeoptionalHttpIntegrationSubtype #The subtype of the HTTP integration.
Default: HttpIntegrationSubtype.EVENTBRIDGE_PUT_EVENTS
Only subtypes starting with EVENTBRIDGE_ can be specified.