turbot/alicloud_insights

Query: vpc_vswitch_association

Usage

powerpipe query alicloud_insights.query.vpc_vswitch_association

SQL

-- ECS instances
select
i.title as "Title",
'alicloud_ecs_instance' as "Type",
i.arn as "ARN",
'/alicloud_insights.dashboard.ecs_instance_detail?input.instance_arn=' || arn as link
from
alicloud_ecs_instance as i
join alicloud_vpc_vswitch as s on s.vpc_id = i.vpc_id
where
s.vswitch_id = $1
-- RDS DB Instances
union all
select
title as "Title",
'alicloud_rds_instance' as "Type",
arn as "ARN",
'/alicloud_insights.dashboard.rds_instance_detail?input.db_instance_arn=' || arn as link
from
alicloud_rds_instance
where
vswitch_id = $1
-- Network ACLs
union all
select
a.title as "Title",
'alicloud_vpc_network_acl' as "Type",
v.network_acl_id as "ID",
null as link
from
alicloud_vpc_vswitch as v,
alicloud_vpc_network_acl as a
where
vswitch_id = $1
and v.network_acl_id is not null
and v.network_acl_id = a.network_acl_id
-- Route Tables
union all
select
title as "Title",
'alicloud_vpc_route_table' as "Type",
route_table_id as "ID",
null as link
from
alicloud_vpc_route_table,
jsonb_array_elements_text(vswitch_ids) as b
where
b = $1
and route_table_id is not null;

Dashboards

The query is used in the dashboards: