Publish events from Google sources

You can enable or disable the collecting of events from Google sources for a specific bus.

Events from Google sources are directly triggered by an unmediated event such as the creation of a Cloud Run function or a status change to a Dataflow job. For more information, see Google event types supported by Eventarc.

Enable events from Google sources

You can enable the publishing of Google source events in the Google Cloud console or by using the Google Cloud CLI.

Console

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

    Go to Bus

  2. You can create a bus or, if you are updating a bus, click Edit.

  3. On the Edit bus page, to add a message source, click Add source.

    1. In the Add message source pane, for the Google API message provider, accept the default of google-api-source or enter a different source name.
    2. Click Create.

      Note that only events from resources in the same Google Cloud project as the bus are published.

  4. Click Save.

gcloud

  1. Open a terminal.

  2. You can enable events from Google sources by using the gcloud beta eventarc google-api-sources create command:

    gcloud beta eventarc google-api-source create GOOGLE_API_SOURCE_NAME \
        --destination-message-bus=BUS_NAME \
        --destination-message-bus-project=PROJECT_ID

    Note that only events from resources in the same Google Cloud project as the bus are published.

    Replace the following:

    • GOOGLE_API_SOURCE_NAME: the ID or fully qualified identifier of your GoogleApiSource resource which represents a subscription to Google API events for a particular bus
    • BUS_NAME: the ID or fully qualified identifier of the bus for which you want to subscribe to Google API events
    • PROJECT_ID: the Google Cloud project ID for the bus

    Optional: You can also use the following flags:

    • --async to return from the command immediately, without waiting for the operation in progress to complete.
    • --crypto-key to specify the fully qualified name of a customer-managed encryption key; if unspecified, Google-owned and managed keys are used.
    • --logging-config to configure the logging level which must be one of the following: NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY.

Disable events from Google sources

You can disable the publishing of Google source events in the Google Cloud console or by using the gcloud CLI.

Console

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

    Go to Bus

  2. Click the name of the bus that you want to edit.

    The Bus details page opens.

  3. Click Edit.

  4. On the Edit bus page, to delete the Google API message provider, click Delete resource for the google-api-source message source (or the name you have given it).

  5. At the Delete resource prompt, click Confirm.

    Google source events from resources in the same Google Cloud project as the bus are no longer collected and published.

  6. Click Save.

gcloud

  1. Open a terminal.

  2. You can disable events from Google sources by using the gcloud beta eventarc google-api-sources delete command:

    gcloud beta eventarc google-api-source delete GOOGLE_API_SOURCE_NAME \
        --location=REGION

    Replace the following:

    • GOOGLE_API_SOURCE_NAME: the ID or fully qualified identifier of your GoogleApiSource resource which represents a subscription to Google API events for a particular bus
    • REGION: a supported location for the bus

      Alternatively, you can set the Google Cloud CLI location property:

      gcloud config set eventarc/location REGION
      

    Google source events from resources in the same Google Cloud project as the bus are no longer collected and published.

What's next