-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanup.sh
executable file
·87 lines (68 loc) · 2.26 KB
/
cleanup.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# Sanity
if [ -z "${APIGEE_USERNAME}" -o -z "${APIGEE_HOST}" -o -z "${APIGEE_ORGANIZATION}" -o -z "${APIGEE_ENV}" ]
then
echo "Set using the env file Apigee User, Password, Host, Org, Env to continue"
exit 1
fi
# Debug - uncomment to debug
#export DEBUG=-D
export VERBOSE=-V
# Summary
echo "#####################################################"
echo APIGEE_USERNAME ${APIGEE_USERNAME}
echo APIGEE_HOST ${APIGEE_HOST}
echo APIGEE_ORGANIZATION ${APIGEE_ORGANIZATION}
echo APIGEE_ENV ${APIGEE_ENV}
echo "#####################################################"
echo ""
echo ""
# APIGEE_ORGANIZATION, APIGEE_USERNAME, APIGEE_PASSWORD
# are picked by apigeetool directly from the environment
# -u ${APIGEE_USERNAME} -p ${APIGEE_PASSWORD} -o ${APIGEE_ORGANIZATION}
echo "Delete App"
apigeetool deleteapp -L ${APIGEE_HOST} ${DEBUG} ${VERBOSE} \
--name "Perf Test" --email [email protected]
echo ""
echo "Delete Developer"
apigeetool deletedeveloper -L ${APIGEE_HOST} ${DEBUG} ${VERBOSE} \
--email [email protected]
echo ""
echo "Delete API product"
apigeetool deleteProduct -L ${APIGEE_HOST} ${DEBUG} ${VERBOSE} \
--productName "Perf Test"
echo "Undeploy APIs"
echo "..."
apigeetool undeploy -L ${APIGEE_HOST} -e ${APIGEE_ENV} ${DEBUG} ${VERBOSE} \
-n Perf-OAuth
echo "..."
apigeetool undeploy -L ${APIGEE_HOST} -e ${APIGEE_ENV} ${DEBUG} ${VERBOSE} \
-n Perf-NoTarget
echo "..."
apigeetool undeploy -L ${APIGEE_HOST} -e ${APIGEE_ENV} ${DEBUG} ${VERBOSE} \
-n Perf-EchoTarget
echo "..."
apigeetool undeploy -L ${APIGEE_HOST} -e ${APIGEE_ENV} ${DEBUG} ${VERBOSE} \
-n Perf-TransformTarget
echo "Delete APIs"
echo "..."
apigeetool delete -L ${APIGEE_HOST} ${DEBUG} ${VERBOSE} \
-n Perf-OAuth
echo "..."
apigeetool delete -L ${APIGEE_HOST} ${DEBUG} ${VERBOSE} \
-n Perf-NoTarget
echo "..."
apigeetool delete -L ${APIGEE_HOST} ${DEBUG} ${VERBOSE} \
-n Perf-EchoTarget
echo "..."
apigeetool delete -L ${APIGEE_HOST} ${DEBUG} ${VERBOSE} \
-n Perf-TransformTarget
echo ""
echo "Delete Target Server"
curl -X DELETE \
-u "${APIGEE_USERNAME}:${APIGEE_PASSWORD}" \
${APIGEE_HOST}/v1/organizations/${APIGEE_ORGANIZATION}/environments/${APIGEE_ENV}/targetservers/HTTPBin
echo ""
echo ""
echo ""
echo "Done"