trigger.proto 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. // Copyright 2021 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/annotations.proto";
  17. import "google/api/field_behavior.proto";
  18. import "google/api/resource.proto";
  19. import "google/protobuf/timestamp.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. // A representation of the trigger resource.
  37. message Trigger {
  38. option (google.api.resource) = {
  39. type: "eventarc.googleapis.com/Trigger"
  40. pattern: "projects/{project}/locations/{location}/triggers/{trigger}"
  41. plural: "triggers"
  42. singular: "trigger"
  43. };
  44. // Required. The resource name of the trigger. Must be unique within the
  45. // location on the project and must be in
  46. // `projects/{project}/locations/{location}/triggers/{trigger}` format.
  47. string name = 1 [(google.api.field_behavior) = REQUIRED];
  48. // Output only. Server assigned unique identifier for the trigger. The value
  49. // is a UUID4 string and guaranteed to remain unchanged until the resource is
  50. // deleted.
  51. string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  52. // Output only. The creation time.
  53. google.protobuf.Timestamp create_time = 5
  54. [(google.api.field_behavior) = OUTPUT_ONLY];
  55. // Output only. The last-modified time.
  56. google.protobuf.Timestamp update_time = 6
  57. [(google.api.field_behavior) = OUTPUT_ONLY];
  58. // Required. null The list of filters that applies to event attributes. Only
  59. // events that match all the provided filters will be sent to the destination.
  60. repeated EventFilter event_filters = 8 [
  61. (google.api.field_behavior) = UNORDERED_LIST,
  62. (google.api.field_behavior) = REQUIRED
  63. ];
  64. // Optional. The IAM service account email associated with the trigger. The
  65. // service account represents the identity of the trigger.
  66. //
  67. // The principal who calls this API must have `iam.serviceAccounts.actAs`
  68. // permission in the service account. See
  69. // https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
  70. // for more information.
  71. //
  72. // For Cloud Run destinations, this service account is used to generate
  73. // identity tokens when invoking the service. See
  74. // https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
  75. // for information on how to invoke authenticated Cloud Run services.
  76. // In order to create Audit Log triggers, the service account should also
  77. // have `roles/eventarc.eventReceiver` IAM role.
  78. string service_account = 9 [
  79. (google.api.field_behavior) = OPTIONAL,
  80. (google.api.resource_reference) = {
  81. type: "iam.googleapis.com/ServiceAccount"
  82. }
  83. ];
  84. // Required. Destination specifies where the events should be sent to.
  85. Destination destination = 10 [(google.api.field_behavior) = REQUIRED];
  86. // Optional. In order to deliver messages, Eventarc may use other GCP
  87. // products as transport intermediary. This field contains a reference to that
  88. // transport intermediary. This information can be used for debugging
  89. // purposes.
  90. Transport transport = 11 [(google.api.field_behavior) = OPTIONAL];
  91. // Optional. User labels attached to the triggers that can be used to group
  92. // resources.
  93. map<string, string> labels = 12 [(google.api.field_behavior) = OPTIONAL];
  94. // Output only. This checksum is computed by the server based on the value of
  95. // other fields, and may be sent only on create requests to ensure the client
  96. // has an up-to-date value before proceeding.
  97. string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY];
  98. }
  99. // Filters events based on exact matches on the CloudEvents attributes.
  100. message EventFilter {
  101. // Required. The name of a CloudEvents attribute. Currently, only a subset of
  102. // attributes are supported for filtering.
  103. //
  104. // All triggers MUST provide a filter for the 'type' attribute.
  105. string attribute = 1 [(google.api.field_behavior) = REQUIRED];
  106. // Required. The value for the attribute.
  107. string value = 2 [(google.api.field_behavior) = REQUIRED];
  108. }
  109. // Represents a target of an invocation over HTTP.
  110. message Destination {
  111. oneof descriptor {
  112. // Cloud Run fully-managed service that receives the events. The service
  113. // should be running in the same project of the trigger.
  114. CloudRun cloud_run = 1;
  115. }
  116. }
  117. // Represents the transport intermediaries created for the trigger in order to
  118. // deliver events.
  119. message Transport {
  120. oneof intermediary {
  121. // The Pub/Sub topic and subscription used by Eventarc as delivery
  122. // intermediary.
  123. Pubsub pubsub = 1;
  124. }
  125. }
  126. // Represents a Cloud Run destination.
  127. message CloudRun {
  128. // Required. The name of the Cloud Run service being addressed. See
  129. // https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
  130. //
  131. // Only services located in the same project of the trigger object
  132. // can be addressed.
  133. string service = 1 [
  134. (google.api.field_behavior) = REQUIRED,
  135. (google.api.resource_reference) = { type: "run.googleapis.com/Service" }
  136. ];
  137. // Optional. The relative path on the Cloud Run service the events should be
  138. // sent to.
  139. //
  140. // The value must conform to the definition of URI path segment (section 3.3
  141. // of RFC2396). Examples: "/route", "route", "route/subroute".
  142. string path = 2 [(google.api.field_behavior) = OPTIONAL];
  143. // Required. The region the Cloud Run service is deployed in.
  144. string region = 3 [(google.api.field_behavior) = REQUIRED];
  145. }
  146. // Represents a Pub/Sub transport.
  147. message Pubsub {
  148. // Optional. The name of the Pub/Sub topic created and managed by Eventarc
  149. // system as a transport for the event delivery. Format:
  150. // `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
  151. //
  152. // You may set an existing topic for triggers of the type
  153. // `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
  154. // here will not be deleted by Eventarc at trigger deletion.
  155. string topic = 1 [(google.api.field_behavior) = OPTIONAL];
  156. // Output only. The name of the Pub/Sub subscription created and managed by
  157. // Eventarc system as a transport for the event delivery. Format:
  158. // `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
  159. string subscription = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  160. }