forked from npateriya/meraki-openapi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
delete.sh
executable file
·30 lines (21 loc) · 1.12 KB
/
delete.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
#! /bin/bash
set -ex
source ./env.sh
host=${host:-https://devnet-testing.cisco.com}
if [ -z "$1" ]; then
echo please specify the service/org keyword that you want to delete
exit
fi
org="$1"
host=https://devnet-testing.cisco.com
# service=bbc
# printf -v payload '{ "organization_id": "xxx", "product_tag": "Book Shop", "name_id": "%s", "title": "demo %s", "description": "%s API", "contact": {} }' "$service" "$service" "$service"
# apiregistryctl -H "$host" service create --data "$payload" --debug || true
# service=abc
# printf -v payload '{ "organization_id": "xxx", "product_tag": "Book Shop", "name_id": "%s", "title": "demo %s", "description": "%s API", "contact": {} }' "$service" "$service" "$service"
# apiregistryctl -H "$host" service create --data "$payload" --debug || true
apiregistryctl -H "$host" service list
apiregistryctl -H "$host" service list | grep "$org"
apiregistryctl -H "$host" service list | grep "$org" | awk '{print $2}'
apiregistryctl -H "$host" service list | grep "$org" | awk '{print $2}' | xargs -I {} apiregistryctl service delete --debug {}
apiregistryctl -H "$host" service list | grep "$org"