GCP.Eventarc reference
Channel
Section titled “Channel”Source:
src/GCP/Eventarc/Channel.ts
An Eventarc channel representing a subscriber’s intent to receive events from an event provider. Published events are delivered over the transport Eventarc associates with the channel.
channelId, location, and provider are identity — changing any
of them replaces the channel. Labels and cryptoKeyName update in
place. A Google channel (no third-party provider) is valid; SaaS
partner channels stay PENDING until the partner activates them.
Channel: Creating a Channel
Section titled “Channel: Creating a Channel”Google channel
const channel = yield* GCP.Eventarc.Channel("events", { location: "us-central1", labels: { env: "prod" },});Third-party provider channel
const channel = yield* GCP.Eventarc.Channel("datadog", { channelId: "datadog-events", location: "us-central1", provider: "projects/my-project/locations/us-central1/providers/datadog",});Channel: Updating a Channel
Section titled “Channel: Updating a Channel”Re-declare the same logical id with changed props; the engine keeps the physical channel and patches it in place.
const channel = yield* GCP.Eventarc.Channel("events", { location: "us-central1", cryptoKeyName: "projects/my-project/locations/us-central1/keyRings/keys/cryptoKeys/events", labels: { env: "prod", role: "events" },});ChannelConnection
Section titled “ChannelConnection”Source:
src/GCP/Eventarc/ChannelConnection.ts
An Eventarc ChannelConnection that binds a third-party event provider to a subscriber Channel. Created in the provider project using the subscriber Channel’s activation token.
There is no patch API — channelConnectionId, location, channel,
and labels are all identity. Changing any of them replaces the
connection.
ChannelConnection: Creating a ChannelConnection
Section titled “ChannelConnection: Creating a ChannelConnection”const connection = yield* GCP.Eventarc.ChannelConnection("Partner", { location: "us-central1", channel: "projects/subscriber/locations/us-central1/channels/datadog", activationToken: channel.activationToken, labels: { env: "prod" },});Enrollment
Section titled “Enrollment”Source:
src/GCP/Eventarc/Enrollment.ts
An Eventarc Advanced enrollment that subscribes to messages on a MessageBus and delivers matches to a Pipeline.
enrollmentId, location, and messageBus are identity — changing
any of them replaces the enrollment. Destination, CEL match, display
name, labels, and annotations update in place.
Enrollment: Creating an Enrollment
Section titled “Enrollment: Creating an Enrollment”const bus = yield* GCP.Eventarc.MessageBus("Events", { location: "us-central1",});const pipeline = yield* GCP.Eventarc.Pipeline("Sink", { location: "us-central1", destinations: [{ topic: topic.name }],});const enrollment = yield* GCP.Eventarc.Enrollment("All", { location: "us-central1", messageBus: bus.name, destination: pipeline.name, celMatch: "true", labels: { env: "prod" },});Enrollment: Updating an Enrollment
Section titled “Enrollment: Updating an Enrollment”Re-declare the same logical id with changed props; the engine keeps the physical enrollment and patches it in place.
const enrollment = yield* GCP.Eventarc.Enrollment("All", { location: "us-central1", messageBus: bus.name, destination: pipeline.name, celMatch: "message.type == 'google.cloud.pubsub.topic.v1.messagePublished'", labels: { env: "prod", role: "enrollment" },});EventarcEventSource
Section titled “EventarcEventSource”Source:
src/GCP/Eventarc/EventSource.ts
Event source routing Eventarc events — Cloud Storage, Audit Log
(google.cloud.audit.log.v1.written, i.e. any Google API call),
Firestore, Pub/Sub, and partner channels — to the hosting compute.
The HTTP implementation is GCP.Run.EventarcEventSource for
GCP.Run.Service / GCP.Function and GCP.CloudFunctions.Function:
it creates an Eventarc trigger delivering to the host with the host’s
runtime service account as the trigger identity, grants that account
roles/eventarc.eventReceiver on the project and roles/run.invoker on
the host, and verifies the OIDC token on every delivery. The deploy
blocks until Eventarc reports the trigger healthy.
Consume it through consumeEvents.
EventarcEventSource: Consuming Eventarc events
Section titled “EventarcEventSource: Consuming Eventarc events”yield* GCP.Eventarc.consumeEvents( "Uploads", { eventFilters: [ { attribute: "type", value: "google.cloud.storage.object.v1.finalized" }, { attribute: "bucket", value: bucket.bucketName }, ], }, (event) => Effect.log(`${event.type} ${event.subject}`),);// …provided with Effect.provide(GCP.Run.EventarcEventSource)GoogleApiSource
Section titled “GoogleApiSource”Source:
src/GCP/Eventarc/GoogleApiSource.ts
An Eventarc Advanced GoogleApiSource that delivers first-party Google API events onto a MessageBus. One source is allowed per project per region.
googleApiSourceId and location are identity — changing either
replaces the source. Destination, display name, labels, annotations,
logging, CMEK, and subscription config update in place.
GoogleApiSource: Creating a GoogleApiSource
Section titled “GoogleApiSource: Creating a GoogleApiSource”const bus = yield* GCP.Eventarc.MessageBus("Events", { location: "us-central1",});const source = yield* GCP.Eventarc.GoogleApiSource("GoogleEvents", { location: "us-central1", destination: bus.name, labels: { env: "prod" },});GoogleApiSource: Updating a GoogleApiSource
Section titled “GoogleApiSource: Updating a GoogleApiSource”Re-declare the same logical id with changed props; the engine keeps the physical source and patches it in place.
const source = yield* GCP.Eventarc.GoogleApiSource("GoogleEvents", { location: "us-central1", destination: bus.name, displayName: "google events v2", labels: { env: "prod", role: "source" },});MessageBus
Section titled “MessageBus”Source:
src/GCP/Eventarc/MessageBus.ts
An Eventarc Advanced message bus that routes published events to enrollments. One bus may exist per project per region.
messageBusId and location are identity — changing either replaces
the bus. Display name, labels, annotations, logging, and CMEK update
in place.
MessageBus: Creating a MessageBus
Section titled “MessageBus: Creating a MessageBus”Generated name
const bus = yield* GCP.Eventarc.MessageBus("Events", { location: "us-central1", labels: { env: "prod" },});Named bus with logging
const bus = yield* GCP.Eventarc.MessageBus("Events", { messageBusId: "app-events", location: "us-central1", displayName: "app events", loggingConfig: { logSeverity: "INFO" },});MessageBus: Updating a MessageBus
Section titled “MessageBus: Updating a MessageBus”Re-declare the same logical id with changed props; the engine keeps the physical bus and patches it in place.
const bus = yield* GCP.Eventarc.MessageBus("Events", { location: "us-central1", displayName: "app events v2", labels: { env: "prod", role: "bus" },});Pipeline
Section titled “Pipeline”Source:
src/GCP/Eventarc/Pipeline.ts
An Eventarc Advanced pipeline that delivers matched enrollment messages to a destination (HTTP, Workflows, Pub/Sub, or another MessageBus), optionally transforming and retrying along the way.
pipelineId and location are identity — changing either replaces
the pipeline. Destinations, mediations, retry policy, logging, CMEK,
display name, labels, and annotations update in place.
Pipeline: Creating a Pipeline
Section titled “Pipeline: Creating a Pipeline”Publish to a Pub/Sub topic
const topic = yield* GCP.PubSub.Topic("Sink", {});const pipeline = yield* GCP.Eventarc.Pipeline("Forward", { location: "us-central1", destinations: [{ topic: topic.name }], labels: { env: "prod" },});HTTPS destination with OIDC
const pipeline = yield* GCP.Eventarc.Pipeline("HttpSink", { location: "us-central1", destinations: [{ httpEndpoint: { uri: "https://service-xyz-uc.a.run.app" }, authenticationConfig: { googleOidc: { serviceAccount: sa.email }, }, }],});Pipeline: Updating a Pipeline
Section titled “Pipeline: Updating a Pipeline”Re-declare the same logical id with changed props; the engine keeps the physical pipeline and patches it in place.
const pipeline = yield* GCP.Eventarc.Pipeline("Forward", { location: "us-central1", destinations: [{ topic: topic.name }], retryPolicy: { maxAttempts: 8 }, labels: { env: "prod", role: "pipeline" },});Trigger
Section titled “Trigger”Source:
src/GCP/Eventarc/Trigger.ts
An Eventarc trigger that routes events matching a set of CloudEvents filters to a Cloud Run service, GKE service, Workflow, or HTTP endpoint.
triggerId, location, eventFilters, channel, and
transport.pubsub.topic are identity — changing any of them replaces
the trigger. Destination, service account, content type, retry policy,
and labels update in place.
Trigger: Creating a Trigger
Section titled “Trigger: Creating a Trigger”Pub/Sub messages to a Workflow
const topic = yield* GCP.PubSub.Topic("events", {});const trigger = yield* GCP.Eventarc.Trigger("orders", { eventFilters: [ { attribute: "type", value: "google.cloud.pubsub.topic.v1.messagePublished", }, ], destination: { workflow: "projects/my-project/locations/us-central1/workflows/orders", }, transport: { pubsub: { topic: topic.name } },});Pub/Sub messages to Cloud Run
const trigger = yield* GCP.Eventarc.Trigger("orders", { triggerId: "order-events", location: "us-central1", eventFilters: [ { attribute: "type", value: "google.cloud.pubsub.topic.v1.messagePublished", }, ], destination: { cloudRun: { service: "order-handler", region: "us-central1" }, }, transport: { pubsub: { topic: topic.name } }, labels: { env: "prod" },});Trigger: Updating a Trigger
Section titled “Trigger: Updating a Trigger”Re-declare the same logical id with changed props; the engine keeps the physical trigger and patches it in place.
const trigger = yield* GCP.Eventarc.Trigger("orders", { eventFilters: [ { attribute: "type", value: "google.cloud.pubsub.topic.v1.messagePublished", }, ], destination: { workflow: "projects/my-project/locations/us-central1/workflows/orders", }, transport: { pubsub: { topic: topic.name } }, eventDataContentType: "application/json", labels: { env: "prod", role: "events" },});