Note: Eventarc Cloud IoT events is feature in preview. Only allow-listed projects can currently take advantage of it. Please contact eventarc@google.com to get your project allow-listed before attempting this sample.
In this sample, you'll see how to read Cloud IoT events directly (without having to go through Audit Logs).
These are the Cloud IoT events supported.
Device Events:
- google.api.cloud.iot.v1.deviceCreated
- google.api.cloud.iot.v1.deviceUpdated
- google.api.cloud.iot.v1.deviceDeleted
Registry Events:
- google.api.cloud.iot.v1.registryCreated
- google.api.cloud.iot.v1.registryUpdated
- google.api.cloud.iot.v1.registryDeleted
Make sure your project id is set in gcloud:
gcloud config set project PROJECT_IDRun ./setup.sh to enable required services, create a service account with the
right role, deploy a Cloud Run service to receive events and create a trigger
with the service account to route Cloud IoT device registry events to the Cloud
Run service.
Run ./test.sh to create a Cloud IoT device registry and see the received event
in Cloud Run service logs.