HttpEventBridgeIntegration Class
The EventBridge PutEvents integration resource for HTTP API.
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,
}),
})
Initializer
ts
new HttpEventBridgeIntegration(id: string, props: HttpEventBridgeIntegrationProps)
python
HttpEventBridgeIntegration(id: str, props: HttpEventBridgeIntegrationProps)
java
new HttpEventBridgeIntegration(String id, HttpEventBridgeIntegrationProps props)
csharp
new HttpEventBridgeIntegration(string id, HttpEventBridgeIntegrationProps props)
go
NewHttpEventBridgeIntegration(Id *string, Props HttpEventBridgeIntegrationProps)
Methods
bind(options: HttpRouteIntegrationBindOptions): HttpRouteIntegrationConfigdef bind(self, options: HttpRouteIntegrationBindOptions) -> HttpRouteIntegrationConfigpublic HttpRouteIntegrationConfig bind(HttpRouteIntegrationBindOptions options)public HttpRouteIntegrationConfig Bind(HttpRouteIntegrationBindOptions options)func Bind(Options HttpRouteIntegrationBindOptions) HttpRouteIntegrationConfig#Bind this integration to the route.