trigger.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.eventarc.v1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/timestamp.proto";
  19. import "google/rpc/code.proto";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "TriggerProto";
  23. option java_package = "com.google.cloud.eventarc.v1";
  24. option (google.api.resource_definition) = {
  25. type: "cloudfunctions.googleapis.com/CloudFunction"
  26. pattern: "projects/{project}/locations/{location}/functions/{function}"
  27. };
  28. option (google.api.resource_definition) = {
  29. type: "iam.googleapis.com/ServiceAccount"
  30. pattern: "projects/{project}/serviceAccounts/{service_account}"
  31. };
  32. option (google.api.resource_definition) = {
  33. type: "run.googleapis.com/Service"
  34. pattern: "*"
  35. };
  36. option (google.api.resource_definition) = {
  37. type: "workflows.googleapis.com/Workflow"
  38. pattern: "projects/{project}/locations/{location}/workflows/{workflow}"
  39. };
  40. // A representation of the trigger resource.
  41. message Trigger {
  42. option (google.api.resource) = {
  43. type: "eventarc.googleapis.com/Trigger"
  44. pattern: "projects/{project}/locations/{location}/triggers/{trigger}"
  45. plural: "triggers"
  46. singular: "trigger"
  47. };
  48. // Required. The resource name of the trigger. Must be unique within the location of the
  49. // project and must be in
  50. // `projects/{project}/locations/{location}/triggers/{trigger}` format.
  51. string name = 1 [(google.api.field_behavior) = REQUIRED];
  52. // Output only. Server-assigned unique identifier for the trigger. The value is a UUID4
  53. // string and guaranteed to remain unchanged until the resource is deleted.
  54. string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  55. // Output only. The creation time.
  56. google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  57. // Output only. The last-modified time.
  58. google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  59. // Required. Unordered list. The list of filters that applies to event attributes. Only events that
  60. // match all the provided filters are sent to the destination.
  61. repeated EventFilter event_filters = 8 [
  62. (google.api.field_behavior) = UNORDERED_LIST,
  63. (google.api.field_behavior) = REQUIRED
  64. ];
  65. // Optional. The IAM service account email associated with the trigger. The
  66. // service account represents the identity of the trigger.
  67. //
  68. // The principal who calls this API must have the `iam.serviceAccounts.actAs`
  69. // permission in the service account. See
  70. // https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
  71. // for more information.
  72. //
  73. // For Cloud Run destinations, this service account is used to generate
  74. // identity tokens when invoking the service. See
  75. // https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
  76. // for information on how to invoke authenticated Cloud Run services.
  77. // To create Audit Log triggers, the service account should also
  78. // have the `roles/eventarc.eventReceiver` IAM role.
  79. string service_account = 9 [
  80. (google.api.field_behavior) = OPTIONAL,
  81. (google.api.resource_reference) = {
  82. type: "iam.googleapis.com/ServiceAccount"
  83. }
  84. ];
  85. // Required. Destination specifies where the events should be sent to.
  86. Destination destination = 10 [(google.api.field_behavior) = REQUIRED];
  87. // Optional. To deliver messages, Eventarc might use other GCP
  88. // products as a transport intermediary. This field contains a reference to
  89. // that transport intermediary. This information can be used for debugging
  90. // purposes.
  91. Transport transport = 11 [(google.api.field_behavior) = OPTIONAL];
  92. // Optional. User labels attached to the triggers that can be used to group resources.
  93. map<string, string> labels = 12 [(google.api.field_behavior) = OPTIONAL];
  94. // Optional. The name of the channel associated with the trigger in
  95. // `projects/{project}/locations/{location}/channels/{channel}` format.
  96. // You must provide a channel to receive events from Eventarc SaaS partners.
  97. string channel = 13 [(google.api.field_behavior) = OPTIONAL];
  98. // Output only. The reason(s) why a trigger is in FAILED state.
  99. map<string, StateCondition> conditions = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
  100. // Output only. This checksum is computed by the server based on the value of other
  101. // fields, and might be sent only on create requests to ensure that the
  102. // client has an up-to-date value before proceeding.
  103. string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY];
  104. }
  105. // Filters events based on exact matches on the CloudEvents attributes.
  106. message EventFilter {
  107. // Required. The name of a CloudEvents attribute. Currently, only a subset of attributes
  108. // are supported for filtering.
  109. //
  110. // All triggers MUST provide a filter for the 'type' attribute.
  111. string attribute = 1 [(google.api.field_behavior) = REQUIRED];
  112. // Required. The value for the attribute.
  113. string value = 2 [(google.api.field_behavior) = REQUIRED];
  114. // Optional. The operator used for matching the events with the value of the
  115. // filter. If not specified, only events that have an exact key-value pair
  116. // specified in the filter are matched. The only allowed value is
  117. // `match-path-pattern`.
  118. string operator = 3 [(google.api.field_behavior) = OPTIONAL];
  119. }
  120. // A condition that is part of the trigger state computation.
  121. message StateCondition {
  122. // The canonical code of the condition.
  123. google.rpc.Code code = 1;
  124. // Human-readable message.
  125. string message = 2;
  126. }
  127. // Represents a target of an invocation over HTTP.
  128. message Destination {
  129. oneof descriptor {
  130. // Cloud Run fully-managed resource that receives the events. The resource
  131. // should be in the same project as the trigger.
  132. CloudRun cloud_run = 1;
  133. // The Cloud Function resource name. Only Cloud Functions V2 is supported.
  134. // Format: `projects/{project}/locations/{location}/functions/{function}`
  135. string cloud_function = 2 [(google.api.resource_reference) = {
  136. type: "cloudfunctions.googleapis.com/CloudFunction"
  137. }];
  138. // A GKE service capable of receiving events. The service should be running
  139. // in the same project as the trigger.
  140. GKE gke = 3;
  141. // The resource name of the Workflow whose Executions are triggered by
  142. // the events. The Workflow resource should be deployed in the same project
  143. // as the trigger.
  144. // Format: `projects/{project}/locations/{location}/workflows/{workflow}`
  145. string workflow = 4 [(google.api.resource_reference) = {
  146. type: "workflows.googleapis.com/Workflow"
  147. }];
  148. }
  149. }
  150. // Represents the transport intermediaries created for the trigger to
  151. // deliver events.
  152. message Transport {
  153. oneof intermediary {
  154. // The Pub/Sub topic and subscription used by Eventarc as a transport
  155. // intermediary.
  156. Pubsub pubsub = 1;
  157. }
  158. }
  159. // Represents a Cloud Run destination.
  160. message CloudRun {
  161. // Required. The name of the Cloud Run service being addressed. See
  162. // https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
  163. //
  164. // Only services located in the same project as the trigger object
  165. // can be addressed.
  166. string service = 1 [
  167. (google.api.field_behavior) = REQUIRED,
  168. (google.api.resource_reference) = {
  169. type: "run.googleapis.com/Service"
  170. }
  171. ];
  172. // Optional. The relative path on the Cloud Run service the events should be sent to.
  173. //
  174. // The value must conform to the definition of a URI path segment (section 3.3
  175. // of RFC2396). Examples: "/route", "route", "route/subroute".
  176. string path = 2 [(google.api.field_behavior) = OPTIONAL];
  177. // Required. The region the Cloud Run service is deployed in.
  178. string region = 3 [(google.api.field_behavior) = REQUIRED];
  179. }
  180. // Represents a GKE destination.
  181. message GKE {
  182. // Required. The name of the cluster the GKE service is running in. The cluster must be
  183. // running in the same project as the trigger being created.
  184. string cluster = 1 [(google.api.field_behavior) = REQUIRED];
  185. // Required. The name of the Google Compute Engine in which the cluster resides, which
  186. // can either be compute zone (for example, us-central1-a) for the zonal
  187. // clusters or region (for example, us-central1) for regional clusters.
  188. string location = 2 [(google.api.field_behavior) = REQUIRED];
  189. // Required. The namespace the GKE service is running in.
  190. string namespace = 3 [(google.api.field_behavior) = REQUIRED];
  191. // Required. Name of the GKE service.
  192. string service = 4 [(google.api.field_behavior) = REQUIRED];
  193. // Optional. The relative path on the GKE service the events should be sent to.
  194. //
  195. // The value must conform to the definition of a URI path segment (section 3.3
  196. // of RFC2396). Examples: "/route", "route", "route/subroute".
  197. string path = 5 [(google.api.field_behavior) = OPTIONAL];
  198. }
  199. // Represents a Pub/Sub transport.
  200. message Pubsub {
  201. // Optional. The name of the Pub/Sub topic created and managed by Eventarc as
  202. // a transport for the event delivery. Format:
  203. // `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
  204. //
  205. // You can set an existing topic for triggers of the type
  206. // `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide
  207. // here is not deleted by Eventarc at trigger deletion.
  208. string topic = 1 [(google.api.field_behavior) = OPTIONAL];
  209. // Output only. The name of the Pub/Sub subscription created and managed by Eventarc
  210. // as a transport for the event delivery. Format:
  211. // `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
  212. string subscription = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  213. }