This sample demonstrates how to use the Apigee Maven config plugin to publish configurations like API Docs and API Categories to Apigee Integrated Portal using Cloud Build
- Provision Apigee X
- Create a Developer portal
- Access to push configurations to Apigee (API Admin or Org Admin role), trigger Cloud Build
- Make sure the following tools are available in your terminal's $PATH (Cloud Shell has these pre-configured)
- gcloud SDK
- unzip
- curl
- jq
- Maven 3.x
Use the following GCP CloudShell tutorial, and follow the instructions.
- Clone the apigee-samples repo, and switch the publish-to-apigee-portal directory
git clone https://github.com/GoogleCloudPlatform/apigee-samples.git
cd apigee-samples/publish-to-apigee-portal
- Edit the
env.sh
and configure the ENV vars
PROJECT
the project where your Apigee organization is locatedAPIGEE_HOST
the externally reachable hostname of the Apigee environment group that contains APIGEE_ENV.APIGEE_ENV
the Apigee environment where the demo resources should be createdAPIGEE_PORTAL_SITE_ID
the name of the portal, in the form ORG_NAME-PORTAL_NAME, where ORG_NAME is the name of the organization PORTAL_NAME is the portal name converted to all lowercase and with spaces and dashes removed. For example, my-org-myportal.
Now source the env.sh
file
source ./env.sh
- Enable the Cloud Build API and assign Apigee Org admin role to the Cloud Build service account
gcloud services enable cloudbuild.googleapis.com
gcloud projects add-iam-policy-binding "$PROJECT" \
--member="serviceAccount:$CLOUD_BUILD_SA" \
--role="roles/apigee.admin"
- Trigger the build
gcloud builds submit --config cloudbuild.yaml . \
--substitutions="_APIGEE_HOST=$APIGEE_HOST,_APIGEE_TEST_ENV=$APIGEE_ENV,_APIGEE_PORTAL_SITE_ID=$APIGEE_PORTAL_SITE_ID"
To verify if the configurations were created, open your Integrated portal in a browser
- Click the "API" from the menu header, you should see
MockTarget
API created. - Click
MockTarget
to see the different paths of the API - Click the
/echo
path from the left menu and under theTry this API
section, click the "EXECUTE" button to see the response from Apigee - You can enable DEBUG in Apigee and make the calls from the portal to see the transaction in DEBUG
If you want to clean up the artifacts from this example in your Apigee Organization, first source your env.sh
script, and then run
./cleanup.sh