Debian Codegraph @

ansible_collections/google/cloud/extensions/audit/taxonomy.jq

raw
1 (
2 {
3 "google.cloud.gcp_bigquery_dataset": "Database",
4 "google.cloud.gcp_bigquery_table": "Database",
5 "google.cloud.gcp_compute_address": "Network",
6 "google.cloud.gcp_compute_disk": "Storage",
7 "google.cloud.gcp_compute_firewall": "Security & Identity",
8 "google.cloud.gcp_compute_instance": "Compute",
9 "google.cloud.gcp_compute_instance_group_manager": "Compute",
10 "google.cloud.gcp_compute_instance_template": "Compute",
11 "google.cloud.gcp_compute_network": "Network",
12 "google.cloud.gcp_compute_ssl_certificate": "Security & Identity",
13 "google.cloud.gcp_container_cluster": "Containers",
14 "google.cloud.gcp_container_node_pool": "Containers",
15 "google.cloud.gcp_dns_managed_zone": "Network",
16 "google.cloud.gcp_dns_resource_record_set": "Network",
17 "google.cloud.gcp_filestore_instance": "Storage",
18 "google.cloud.gcp_iam_role": "Security & Identity",
19 "google.cloud.gcp_iam_service_account": "Security & Identity",
20 "google.cloud.gcp_kms_key_ring": "Security & Identity",
21 "google.cloud.gcp_pubsub_subscription": "App Integration",
22 "google.cloud.gcp_pubsub_topic": "App Integration",
23 "google.cloud.gcp_resource_record_set": "Network",
24 "google.cloud.gcp_sourcerepo_repository": "Developer Tools",
25 "google.cloud.gcp_sql_instance": "Database",
26 "google.cloud.gcp_storage_bucket": "Storage",
27 } as $actions|
28 .[] |
29 (if has("results") then # if ran in a loop, flatten it
30 .results[] as $result |
31 . + $result |
32 del(.results)
33 else
34 .
35 end) as $data |
36 select($data.action | in($actions)) | # only select objects defined in the action mapping
37 ($data.id // $data.etag // $data.selfLink // $data.name) as $id | # not everything returns an ID
38 ($data.name // $id) as $name | # not everything returns a name
39 ($data.kind // "missing") as $kind | # not everything returns a kind
40 select($name != null and $id != null) |
41 {
42 name: $name,
43 canonical_facts: {
44 id: $id,
45 name: $name,
46 kind: $kind,
47 },
48 facts: {
49 infra_type: "PublicCloud",
50 infra_bucket: ($actions[$data.action] // "Unknown" | ascii_upcase),
51 device_type: $kind,
52 }
53 }
54 )