turbot/aws_insights

Query: source_sqs_queues_for_api_gatewayv2_api

Usage

powerpipe query aws_insights.query.source_sqs_queues_for_api_gatewayv2_api

SQL

with filtered_api as (
select
api_id,
account_id,
region
from
aws_api_gatewayv2_api
where
api_id = $1
),
filtered_integration as (
select
request_parameters,
account_id,
region,
api_id
from
aws_api_gatewayv2_integration
where
integration_subtype like '%SQS-ReceiveMessage%'
and account_id = (select account_id from filtered_api)
and region = (select region from filtered_api)
and api_id = $1
),
filtered_sqs_queue as (
select
queue_arn,
queue_url
from
aws_sqs_queue
where
queue_url in (select request_parameters ->> 'QueueUrl' from filtered_integration)
and account_id = (select account_id from filtered_integration)
and region = (select region from filtered_integration)
)
select
q.queue_arn as queue_arn
from
filtered_integration i
join filtered_sqs_queue q on i.request_parameters ->> 'QueueUrl' = q.queue_url
join filtered_api a on a.api_id = i.api_id;