@@ -97,6 +97,31 @@ echo "Retrieving proxygen credentials"
9797# Retrieve the proxygen private key and client private key and cert from AWS Secrets Manager
9898proxygen_private_key_arn=$( aws cloudformation list-exports --query " Exports[?Name=='secrets:${PROXYGEN_PRIVATE_KEY_NAME} '].Value" --output text)
9999
100+ echo
101+ echo " Deploy the API instance using Proxygen proxy lambda"
102+ if [[ " ${DRY_RUN} " == " false" ]]; then
103+
104+ jq -n --argfile spec " ${SPEC_PATH} " \
105+ --arg apiName " ${apigee_api} " \
106+ --arg apiClient " ${apigee_client} " \
107+ --arg environment " ${APIGEE_ENVIRONMENT} " \
108+ --arg instance " ${instance} " \
109+ --arg kid " ${PROXYGEN_KID} " \
110+ --arg proxygenSecretName " ${proxygen_private_key_arn} " \
111+ ' {apiName: $apiName, apiClient: $apiClient, environment: $environment, specDefinition: $spec, instance: $instance, kid: $kid, proxygenSecretName: $proxygenSecretName}' > payload.json
112+
113+ aws lambda invoke --function-name " ${instance_put_lambda} " --cli-binary-format raw-in-base64-out --payload file://payload.json out.txt > response.json
114+
115+ if eval " cat response.json | jq -e '.FunctionError' >/dev/null" ; then
116+ echo ' Error calling lambda'
117+ cat out.txt
118+ exit 1
119+ fi
120+ echo " Instance deployed"
121+ else
122+ echo " Would call ${instance_put_lambda} "
123+ fi
124+
100125if [[ " ${ENABLE_MUTUAL_TLS} " == " true" ]]; then
101126 echo
102127 echo " Store the secret used for mutual TLS to AWS using Proxygen proxy lambda"
@@ -123,31 +148,6 @@ if [[ "${ENABLE_MUTUAL_TLS}" == "true" ]]; then
123148 fi
124149fi
125150
126- echo
127- echo " Deploy the API instance using Proxygen proxy lambda"
128- if [[ " ${DRY_RUN} " == " false" ]]; then
129-
130- jq -n --argfile spec " ${SPEC_PATH} " \
131- --arg apiName " ${apigee_api} " \
132- --arg apiClient " ${apigee_client} " \
133- --arg environment " ${APIGEE_ENVIRONMENT} " \
134- --arg instance " ${instance} " \
135- --arg kid " ${PROXYGEN_KID} " \
136- --arg proxygenSecretName " ${proxygen_private_key_arn} " \
137- ' {apiName: $apiName, apiClient: $apiClient, environment: $environment, specDefinition: $spec, instance: $instance, kid: $kid, proxygenSecretName: $proxygenSecretName}' > payload.json
138-
139- aws lambda invoke --function-name " ${instance_put_lambda} " --cli-binary-format raw-in-base64-out --payload file://payload.json out.txt > response.json
140-
141- if eval " cat response.json | jq -e '.FunctionError' >/dev/null" ; then
142- echo ' Error calling lambda'
143- cat out.txt
144- exit 1
145- fi
146- echo " Instance deployed"
147- else
148- echo " Would call ${instance_put_lambda} "
149- fi
150-
151151# if [[ "${APIGEE_ENVIRONMENT}" == "int" ]]; then
152152# echo
153153# echo "Deploy the API spec to prod catalogue as it is int environment"
0 commit comments