HttpSqsIntegration
- class aws_cdk.aws_apigatewayv2_integrations.HttpSqsIntegration(id, *, queue, parameter_mapping=None, subtype=None)
Bases:
HttpRouteIntegration
The Sqs integration resource for HTTP API.
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_sqs as sqs from aws_cdk.aws_apigatewayv2_integrations import HttpSqsIntegration # queue: sqs.IQueue # http_api: apigwv2.HttpApi # default integration (send message) http_api.add_routes( path="/default", methods=[apigwv2.HttpMethod.POST], integration=HttpSqsIntegration("defaultIntegration", queue=queue ) ) # send message integration http_api.add_routes( path="/send-message", methods=[apigwv2.HttpMethod.POST], integration=HttpSqsIntegration("sendMessageIntegration", queue=queue, subtype=apigwv2.HttpIntegrationSubtype.SQS_SEND_MESSAGE ) ) # receive message integration http_api.add_routes( path="/receive-message", methods=[apigwv2.HttpMethod.POST], integration=HttpSqsIntegration("receiveMessageIntegration", queue=queue, subtype=apigwv2.HttpIntegrationSubtype.SQS_RECEIVE_MESSAGE ) ) # delete message integration http_api.add_routes( path="/delete-message", methods=[apigwv2.HttpMethod.POST], integration=HttpSqsIntegration("deleteMessageIntegration", queue=queue, subtype=apigwv2.HttpIntegrationSubtype.SQS_DELETE_MESSAGE ) ) # purge queue integration http_api.add_routes( path="/purge-queue", methods=[apigwv2.HttpMethod.POST], integration=HttpSqsIntegration("purgeQueueIntegration", queue=queue, subtype=apigwv2.HttpIntegrationSubtype.SQS_PURGE_QUEUE ) )
- Parameters:
id (
str
) – id of the underlying integration construct.queue (
IQueue
) – SQS queue that Integrates with API Gateway.parameter_mapping (
Optional
[ParameterMapping
]) – Specifies how to transform HTTP requests before sending them to the backend. Default: - specifyQueueUrl
. Additionally, setMessageBody
to$request.body.MessageBody
forSQS_SEND_MESSAGE
subtype and setReceiptHandle
to$request.body.ReceiptHandle
forSQS_DELETE_MESSAGE
subtype.subtype (
Optional
[HttpIntegrationSubtype
]) – The subtype of the HTTP integration. Only subtypes starting with SQS_ can be specified. Default: HttpIntegrationSubtype.SQS_SEND_MESSAGE
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 theHttpRouteIntegration
being bound creates additional constructs, this will be used as their parent scope.
- Return type: