forked from npateriya/meraki-openapi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreset-sockshop.sh
executable file
·48 lines (38 loc) · 1.79 KB
/
reset-sockshop.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
#! /bin/bash
set -x
source ./env.sh
host=${host:-https://devnet-testing.cisco.com}
# If demo/test in other branch (like demo) other master
# git push origin --delete demo
# git branch -d demo
# git checkout -b demo
# git branch -u origin/demo
# TODO: cart or carts
services=( "cart" "catalogue" "payment" "user" "order")
product_tag="DevRel Store"
echo "## Prepare services"
for service in ${services[*]}; do
# upper case first char
service_title="$(tr '[:lower:]' '[:upper:]' <<< ${service:0:1})${service:1}"
echo delete "$service"
apiregistryctl -H "$host" service delete "$service" --debug || true
echo create "$service"
printf -v payload '{ "organization_id": "DevNet", "product_tag": "%s", "name_id": "%s", "title": "%s Demo API", "description": "%s microservice for %s demo application", "contact": {"name": "Engineering Team", "email": "[email protected]", "url": "https://app-8081-apiregistry1.devenv-int.ap-ne-1.devnetcloud.com/"}, "analyzers_configs": {"drift": {"service_name_id": "%s.sock-shop"}} }' "$product_tag" "$service" "$service_title" "$service_title" "$product_tag" "$service"
apiregistryctl -H "$host" service create --data "$payload" || true
done
apiregistryctl -H "$host" service list
echo "## Upload the v0.0-rev1 specs which are the base raw specs"
for service in ${services[*]}; do
echo updateload spec for "$service"
apiregistryctl -H "$host" service uploadspec v0.0-rev1/"$service".json -s "$service" --version v0.0 --revision 1
sleep 1
done
sleep 35
echo "## Upload the v0.0-rev2 specs which are the perfect specs"
for service in ${services[*]}; do
echo updateload spec for "$service"
apiregistryctl -H "$host" service uploadspec v0.0-rev2/"$service".json -s "$service" --version v0.0 --revision 2
sleep 1
done
sleep 30
echo "## Finished prepare works"