forked from turbot/steampipe-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin_versions_union_nodes_and_edges.sp
109 lines (99 loc) · 2.34 KB
/
plugin_versions_union_nodes_and_edges.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
dashboard "plugin_versions_tags_union_nodes_and_edges" {
tags = {
service = "v18 examples"
}
graph {
title = "plugin versions: union nodes and edges"
category "plugin" {
title = "plugin"
icon = "extension"
color = "darkred"
}
category "plugin_version" {
title = "version"
icon = "difference"
color = "darkred"
}
category "plugin_tag" {
title = "tag"
icon = "sell"
color = "black"
}
sql = <<EOQ
-- plugin nodes
select
name as id,
null as from_id,
null as to_id,
name as title,
'plugin' as category,
jsonb_build_object(
'name', name,
'created', create_time,
'updated', update_time
) as properties
from
steampipe_registry_plugin
where
name = 'turbot/ldap'
-- plugin version nodes
union all
select
digest as id,
null as from_id,
null as to_id,
left(split_part(digest,':',2),12) as title,
'plugin_version' as category,
jsonb_build_object(
'digest', digest,
'created', create_time,
'updated', update_time
) as properties
from
steampipe_registry_plugin_version
where
name = 'turbot/ldap'
-- plugin tag nodes
union all
select
concat(digest,':',tag) as id,
null as from_id,
null as to_id,
tag as title,
'plugin_tag' as category,
null as properties
from
steampipe_registry_plugin_version,
jsonb_array_elements_text(tags) as tag
where
name = 'turbot/ldap'
-- plugin version edges
union all
select
null as id,
name as from_id,
digest as to_id,
'version' as title,
null as category,
null as properties
from
steampipe_registry_plugin_version
where
name = 'turbot/ldap'
-- plugin tag edges
union all
select
null as id,
digest as from_id,
concat(digest,':',tag) as to_id,
'tag' as title,
null as category,
null as properties
from
steampipe_registry_plugin_version,
jsonb_array_elements_text(tags) as tag
where
name = 'turbot/ldap'
EOQ
}
}