Code Gatherer
Code Gatherer

Reputation: 63

Trigger eventarc event ONLY when a particular cloud datastore entry is committed

I am currently using Cloud Datastore with cloud functions using trigger set on cloud.datastore.v1.Commit. However, this requires that all writes are sent to the trigger, and I woudl like to be able to filter and send data only when a particularly entity or kind is edited.

I attempted to use the path pattern described in the public docs but am not able to specify it anywhere with the Commit trigger in the "Cloud Datastore" provider.

Upvotes: 0

Views: 209

Answers (1)

Patrick Costello
Patrick Costello

Reputation: 3626

If you use datastore today, you are (except for very special cases) using Cloud Firestore in Datastore Mode (more info). If you select the "Cloud Firestore" event provider in your eventarc trigger flow, you'll see the option for a google.cloud.datastore.entity.v1.updated event type. This event type will trigger for each entity changed in your google.datastore.v1.Datastore.Commit message and supports entity-path filtering.

You can still use the "Cloud Datastore" event provider for events based on audit logs (however these are generally far less useful when entities are written than the entity triggers defined above.

Upvotes: 1

Related Questions