Configure Eventarc trigger

This page applies to Apigee and Apigee hybrid.

API hub supports Eventarc triggers. By using this feature, you can trigger executions based on the events occurring in API hub. For example, you can execute a Cloud Run service when an API is created in API hub.

This quickstart shows you how to configure an Eventarc trigger that executes a Cloud Run service when an API is updated in API hub.

Before you begin

  1. API hub must be provisioned in a Google Cloud project to which you have access. See Provision API hub.
  2. In the Google Cloud console, on the project selector page, select the project in which API hub is provisioned.

    Go to project selector
  3. You must have a valid Cloud Run service running. You will use the Cloud Run service details when configuring the Eventarc trigger. This is the service that will be executed when the configured event occurs.

Create an Eventarc trigger

  1. In the Google Cloud console, go to the Eventarc Triggers page.

    Go to Triggers

  2. Click Create trigger.
  3. Enter a Trigger name. For example, cloudrun-trigger-1.
  4. In the Trigger type list, select Google sources.

    This filters events sent from Google Cloud providers (directly or through Cloud Audit Logs entries), or providers using Pub/Sub messages.

  5. In the Event provider list, select API hub.
  6. In the Event type list, select google.cloud.apihub.v1.updated.
  7. In the Event content data type list, select either JSON or Protobuf.
  8. Select a Region.
  9. Optionally, Add filters to select the APIs that match your criteria. For example, if you filter the APIs by a specific name, the event is triggered only if the APIs matching the filter criteria are updated.
  10. If prompted, grant the following:
    • iam.serviceAccountTokenCreator role to Pub/Sub service account
    • pubsub.publisher role to Cloud Storage service account
  11. Use the Default compute service account as the service account that invokes your service.
  12. In the Event destination list, select Cloud Run.
  13. Select a Cloud Run service that should be executed when the google.cloud.apihub.v1.updated event occurs in API hub.
  14. Optionally, enter the Service URL path.
  15. Click Create.