-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·81 lines (67 loc) · 2.41 KB
/
setup.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
#!/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
if [ ! -d apis ]
then
echo "Cannot find apis directory"
exit 1
fi
# Debug - uncomment to debug
export DEBUG=" -V --insecure"
#export DEBUG="-D -V --insecure"
# 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 "Create Target Server"
curl -X POST \
-H 'Content-Type: application/json' \
-d '{ "name":"HTTPBin", "host":"'${BACKEND_HOST}'", "isEnabled":true, "port":'${BACKEND_PORT}' }' \
-u "${APIGEE_USERNAME}:${APIGEE_PASSWORD}" \
${APIGEE_HOST}/v1/organizations/${APIGEE_ORGANIZATION}/environments/${APIGEE_ENV}/targetservers
echo ""
echo "Deploy APIs"
echo "..."
apigeetool deployproxy -L ${APIGEE_HOST} -e ${APIGEE_ENV} ${DEBUG} \
-n Perf-OAuth -d apis/Perf-OAuth
echo "..."
apigeetool deployproxy -L ${APIGEE_HOST} -e ${APIGEE_ENV} ${DEBUG} \
-n Perf-NoTarget -d apis/Perf-NoTarget
echo "..."
apigeetool deployproxy -L ${APIGEE_HOST} -e ${APIGEE_ENV} ${DEBUG} \
-n Perf-EchoTarget -d apis/Perf-EchoTarget
echo "..."
apigeetool deployproxy -L ${APIGEE_HOST} -e ${APIGEE_ENV} ${DEBUG} \
-n Perf-TransformTarget -d apis/Perf-TransformTarget
echo ""
echo "Create API product"
apigeetool createProduct -L ${APIGEE_HOST} ${DEBUG} \
--productName "Perf Test" \
--productDesc="Perf Test on premises installation of Apigee" \
--approvalType auto --environments ${APIGEE_ENV} \
--proxies "Perf-OAuth,Perf-TransformTarget"
echo ""
echo "Create Developer"
apigeetool createdeveloper -L ${APIGEE_HOST} ${DEBUG} \
--firstName John --lastName Doe \
--userName [email protected] --email [email protected]
echo ""
echo "Create App"
apigeetool createapp -L ${APIGEE_HOST} ${DEBUG} \
--name "Perf Test" --apiProducts "Perf Test" \
--email [email protected]
echo ""
echo ""
echo "Done"