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