-
Notifications
You must be signed in to change notification settings - Fork 2
/
flow_import-rules_prod.sh
executable file
·57 lines (42 loc) · 1.87 KB
/
flow_import-rules_prod.sh
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
#!/bin/bash
CURL='/usr/bin/curl'
CREDENTIALS='deploy@trifacta.local:deploy'
HOST='http://prod_env_server:3005'
#HOST='http://localhost:3005'
time=$(date +"%d-%m-%y %T")
echo
# ------------- Define Deployments Value/Object Import Rules ---------------
if [ -z "$1" ]
then
echo "Please call '$0 <deploy_id>' to run this command"
echi
exit 1
else
deploy_id=$1
fi
echo "Deployment ID : "$deploy_id
#-------------- FileLocation -----------------
ENDPOINT="/v4/deployments/$deploy_id/valueImportRules"
# PATCH : Json array object with mappings
# [ {
# "type": "fileLocation",
# "on": "//development//",
# "with": "/production/"
# } ]
#[ {"type": "fileLocation","on": "//development//","with": "/production/"} ]
echo
echo $CURL --user $CREDENTIALS $HOST$ENDPOINT --request PATCH -H "Content-type: application/json" -d '[ {"type": "fileLocation","on": "//development//","with": "/production/"} ]'
echo
output=$( $CURL --user $CREDENTIALS $HOST$ENDPOINT -X PATCH -H "Content-type: application/json" -d '[ {"type": "fileLocation","on": "//development//","with": "/production/"} ]')
echo
echo "Import File Locatiopn Rules result => $output"
#------------------- Connections -----------------
ENDPOINT="/v4/deployments/$deploy_id/objectImportRules"
#[{"tableName":"connections","onCondition":{"uuid":"2d7c1650-7daa-11e9-b9eb-0fd11bed75ab"},"withCondition":{"id":11}}]
echo
echo $CURL --user $CREDENTIALS $HOST$ENDPOINT --request PATCH -H "Content-type: application/json" -d '[{"tableName":"connections","onCondition":{"uuid":"2d7c1650-7daa-11e9-b9eb-0fd11bed75ab"},"withCondition":{"id":11}}]'
echo
output=$( $CURL --user $CREDENTIALS $HOST$ENDPOINT -X PATCH -H "Content-type: application/json" -d '[{"tableName":"connections","onCondition":{"uuid":"2d7c1650-7daa-11e9-b9eb-0fd11bed75ab"},"withCondition":{"id":11}}]')
echo
echo "Import Connections Rules result => $output"
echo