-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload
executable file
·43 lines (37 loc) · 915 Bytes
/
upload
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
#!/bin/bash
DMM_API_KEY="xxx"
function uploadAll() {
foldername=$1
files="./$foldername/*.yaml"
for f in $files
do
id=$(yq .id $f)
json=$(yq -o json $f)
curl -X 'PUT' \
"https://app.datamesh-manager.com/api/$foldername/$id" \
-H "accept: */*" \
-H "x-api-key: $DMM_API_KEY" \
-H "Content-Type: application/json" \
-d "$json"
done
}
function approveAllDataUsageAgreements() {
files="./datausageagreements/*.yaml"
for f in $files
do
id=$(yq .info.id $f)
json=$(yq -o json $f)
curl -X 'POST' \
"https://app.datamesh-manager.com/api/datausageagreements/$id/approve" \
-H "accept: */*" \
-H "x-api-key: $DMM_API_KEY"
done
}
uploadAll "teams"
uploadAll "sourcesystems"
uploadAll "definitions"
uploadAll "datacontracts"
uploadAll "dataproducts"
uploadAll "datausageagreements"
approveAllDataUsageAgreements
uploadAll "checks"