turbot/aws_insights

Query: target_sqs_queues_for_api_gatewayv2_api

Usage

powerpipe query aws_insights.query.target_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,
api_id
from
aws_api_gatewayv2_integration
where
api_id = $1
and integration_subtype like '%SQS-SendMessage%'
and account_id = (select account_id from filtered_api)
and region = (select region from filtered_api)
),
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;