[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eCloudEvents is a CNCF specification for describing event data in a common format, delivered to event receivers via HTTP requests.\u003c/p\u003e\n"],["\u003cp\u003eEventarc formats events to the JSON Event Format for CloudEvents version 1.0.1, including attributes like \u003ccode\u003edata\u003c/code\u003e, \u003ccode\u003edatacontenttype\u003c/code\u003e, \u003ccode\u003eid\u003c/code\u003e, \u003ccode\u003esource\u003c/code\u003e, \u003ccode\u003especversion\u003c/code\u003e, \u003ccode\u003etype\u003c/code\u003e, and \u003ccode\u003etime\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eEventarc handles events from Cloud Audit Logs, Cloud Storage, and Pub/Sub, with each event type having a specific JSON format and structure, including envelope and data messages.\u003c/p\u003e\n"],["\u003cp\u003eThe structure of HTTP bodies for all events and related resources like Google Protocol Buffers, JSON schemas, and client libraries are available on the CloudEvents GitHub repository.\u003c/p\u003e\n"],["\u003cp\u003eProtocol Buffers (protobufs) represent the data within events, and there is an envelope message and a data message for each event type, simplifying data handling and consumption.\u003c/p\u003e\n"]]],[],null,["# CloudEvents - JSON event format\n\n[Advanced](/eventarc/advanced/docs/overview) [Standard](/eventarc/standard/docs/overview)\n\nCloudEvents ([cloudevents.io](http://cloudevents.io)) is a specification for\ndescribing event data in a common way. The specification is under the Cloud\nNative Computing Foundation (CNCF) and is organized by the CNCF's Serverless\nWorking Group.\n\nEventarc delivers events to the event receiver in the CloudEvents\nformat through an HTTP request. The destination target---for example, the\nWorkflows service---converts the event to a JSON object (following the\nCloudEvents specification) and passes the event into the\nworkflow execution as a workflow runtime argument.\n\nJSON payload format\n-------------------\n\nThe destination service receives events from event routers and formats\nthe events to the\n[JSON Event Format for CloudEvents version 1.0.1](https://github.com/cloudevents/spec/blob/v1.0.1/json-format.md#json-event-format-for-cloudevents---version-101)\nwith the following CloudEvents attributes:\n\nDepending on the event type, the payload format is as follows: \n\n### Cloud Audit Logs\n\nThe runtime argument is a JSON object detailing the Cloud Audit Logs\nevent. In this document, see the [Common events example](/eventarc/docs/cloudevents-json#common-events).\nIn the JSON object, you can find the `resourceName`, `serviceName`,\nand `methodName` values. For more information, see\n[Determine event filters for Cloud Audit Logs](/eventarc/docs/determining-filters-cal).\n\nEvents of type `google.cloud.audit.log.v1.written` have the following format: \n\n```json\n{\n \"data\":{ EVENT_DATA },\n \"datacontenttype\": \"application/json; charset=utf-8\",\n \"id\": \"\u003cvar translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e\",\n \"source\": \"//cloudaudit.googleapis.com/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/logs/data_access\",\n \"specversion\": \"1.0\",\n \"type\": \"google.cloud.audit.log.v1.written\",\n \"time\": \"\u003cvar translate=\"no\"\u003eEVENT_GENERATION_TIME\u003c/var\u003e\",\n \"dataschema\": \"https://googleapis.github.io/google-cloudevents/jsonschema/google/events/cloud/audit/v1/LogEntryData.json\",\n \"methodName\": \"jobservice.jobcompleted\",\n \"resourceName\": \"projects/my-project/jobs/bqjob_r3ac45813612fa2d6_0000017d591922c9_1\",\n \"serviceName\": \"bigquery.googleapis.com\",\n \"subject\": \"bigquery.googleapis.com/projects/my-project/jobs/bqjob_r3ac45813612fa2d6_0000017d591922c9_1\"\n}\n```\n\n- \u003cvar translate=\"no\"\u003eEVENT_DATA\u003c/var\u003e: the decoded message content in JSON format. For more information, in this document, see [Common events](#common-events).\n- \u003cvar translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e, \u003cvar translate=\"no\"\u003eEVENT_GENERATION_TIME\u003c/var\u003e: system-generated.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: your Google Cloud project ID.\n- `dataschema`, `methodName`, `resourceName`, `serviceName`, `subject`: attributes specific to the event type.\n\n### Cloud Storage\n\nThe runtime arguments are changes to Cloud Storage. In the `data` field\nyou can find the change in the Cloud Storage bucket. In this\ndocument, see the\n[Common events example](/eventarc/docs/cloudevents-json#common-events).\n\nEvents of type `google.cloud.storage.object.v1.finalized` have the following\nformat: \n\n```json\n{\n \"data\":{ EVENT_DATA },\n \"datacontenttype\": \"application/json\",\n \"id\": \"\u003cvar translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e\",\n \"source\": \"//storage.googleapis.com/projects/_/buckets/\u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e\",\n \"specversion\": \"1.0\",\n \"type\": \"google.cloud.storage.object.v1.finalized\",\n \"time\": \"\u003cvar translate=\"no\"\u003eEVENT_GENERATION_TIME\u003c/var\u003e\",\n \"subject\": \"objects/my-file.txt\"\n}\n```\n\n- \u003cvar translate=\"no\"\u003eEVENT_DATA\u003c/var\u003e: the decoded message content in JSON format. For more information, in this document, see [Common events](#common-events).\n- \u003cvar translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e, \u003cvar translate=\"no\"\u003eEVENT_GENERATION_TIME\u003c/var\u003e: system-generated.\n- \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e: the name of the Cloud Storage bucket that gets updated.\n- `subject`: attribute specific to the event type.\n\n### Pub/Sub\n\nThe runtime argument is a Pub/Sub push message. In the `data`\nfield you can find the message as a Base64-encoded string. In this document,\nsee the\n[Common events example](/eventarc/docs/cloudevents-json#common-events).\n\nEvents of type `google.cloud.pubsub.topic.v1.messagePublished` have the\nfollowing format: \n\n```json\n{\n \"data\":{ EVENT_DATA },\n \"datacontenttype\": \"application/json; charset=utf-8\",\n \"id\": \"\u003cvar translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e\",\n \"source\": \"//pubsub.googleapis.com/\u003cvar translate=\"no\"\u003eTOPIC_NAME\u003c/var\u003e\",\n \"specversion\": \"1.0\",\n \"type\": \"google.cloud.pubsub.topic.v1.messagePublished\",\n \"time\": \"\u003cvar translate=\"no\"\u003eEVENT_GENERATION_TIME\u003c/var\u003e\"\n}\n```\n\n- \u003cvar translate=\"no\"\u003eEVENT_DATA\u003c/var\u003e: the decoded message content in JSON format. For more information, in this document, see [Common events](#common-events).\n- \u003cvar translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e, \u003cvar translate=\"no\"\u003eEVENT_GENERATION_TIME\u003c/var\u003e: system-generated.\n- \u003cvar translate=\"no\"\u003eTOPIC_NAME\u003c/var\u003e: the Pub/Sub topic name to which the event was published to.\n\n\nOpen source repository\n----------------------\n\nThe structure of the HTTP body for all events are available on the\n[CloudEvents GitHub repository](https://github.com/googleapis/google-cloudevents).\n\n\nThe repository contains the following to help you understand and use CloudEvents\ndata in your programming language:\n\n- Google Protocol Buffers for CloudEvents data payloads\n- Generated JSON schemas\n- A public JSON schema catalog\n\n\nLinks to client libraries are also included.\n\n\u003cbr /\u003e\n\n\nCommon events\n-------------\n\nProtocol Buffers (or protobufs) represent the data within events that are\ngenerated by Eventarc. Protocol Buffers for CloudEvents are\nprovided as machine-readable schemas, allowing libraries of data types to be\ncreated and making it easier to consume events.\n\n\nThere are two protobuf messages that are relevant for any given CloudEvent type:\n\n- The *envelope* message that represents the complete CloudEvent, including any extension attributes; for example, `AuditLogWrittenEvent`.\n- The *data* message; for example, `LogEntryData` or `StorageObjectData`.\n\nMany CloudEvent types can use the same data message. For example, every event associated with a Cloud Storage object uses `StorageObjectData` as the data message. Each envelope message specifies the CloudEvent type that it is associated with through a proto annotation. For more information, see [Relationship between protobuf messages and CloudEvent types](https://github.com/googleapis/google-cloudevents/blob/main/proto/README.md#relationship-between-protobuf-messages-and-cloudevent-types).\n\n\nThe following tables detail the components of some common events:\n\n### Cloud Audit Logs\n\n### Cloud Storage\n\n### Firestore\n\n### Pub/Sub\n\n\u003cbr /\u003e"]]