-
Notifications
You must be signed in to change notification settings - Fork 8
/
clean.sh
16 lines (13 loc) · 828 Bytes
/
clean.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash
set -e
jq '
.panels[].targets[]? |= if .table? != null then .table = "" else . end |
.panels[].targets[]? |= if .project? != null then .project = "" else . end |
.templating.list[] |= if .name == "dataset" then (.options = [] | .current.text = "${VAR_DATASET}" | .current.value = "${VAR_DATASET}" | .query = "${VAR_DATASET}") else . end |
.panels[] |= if .id == 7 then .datasource = "${DS_BIGQUERY}" else . end |
.title = "Google Cloud Billing Costs" |
.__inputs |= . + [({} | .name = "VAR_DATASET" | .type = "constant" | .label = "Dataset containing billing export (Format: $project.$dataset)")] |
.version? |= .+1 |
del(.__inputs[]|select(.name == "DS_STACKDRIVER")) |
del(.__requires[]|select(.type == "datasource" and .id == "stackdriver"))' raw.json > dashboard.json
rm -f raw.json