xref: /aosp_15_r20/external/googleapis/google/cloud/tasks/v2/task.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 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.tasks.v2;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/resource.proto";
20*d5c09012SAndroid Build Coastguard Workerimport "google/cloud/tasks/v2/target.proto";
21*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/duration.proto";
22*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/timestamp.proto";
23*d5c09012SAndroid Build Coastguard Workerimport "google/rpc/status.proto";
24*d5c09012SAndroid Build Coastguard Worker
25*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/cloudtasks/apiv2/cloudtaskspb;cloudtaskspb";
26*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
27*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "TaskProto";
28*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.cloud.tasks.v2";
29*d5c09012SAndroid Build Coastguard Worker
30*d5c09012SAndroid Build Coastguard Worker// A unit of scheduled work.
31*d5c09012SAndroid Build Coastguard Workermessage Task {
32*d5c09012SAndroid Build Coastguard Worker  option (google.api.resource) = {
33*d5c09012SAndroid Build Coastguard Worker    type: "cloudtasks.googleapis.com/Task"
34*d5c09012SAndroid Build Coastguard Worker    pattern: "projects/{project}/locations/{location}/queues/{queue}/tasks/{task}"
35*d5c09012SAndroid Build Coastguard Worker  };
36*d5c09012SAndroid Build Coastguard Worker
37*d5c09012SAndroid Build Coastguard Worker  // The view specifies a subset of [Task][google.cloud.tasks.v2.Task] data.
38*d5c09012SAndroid Build Coastguard Worker  //
39*d5c09012SAndroid Build Coastguard Worker  // When a task is returned in a response, not all
40*d5c09012SAndroid Build Coastguard Worker  // information is retrieved by default because some data, such as
41*d5c09012SAndroid Build Coastguard Worker  // payloads, might be desirable to return only when needed because
42*d5c09012SAndroid Build Coastguard Worker  // of its large size or because of the sensitivity of data that it
43*d5c09012SAndroid Build Coastguard Worker  // contains.
44*d5c09012SAndroid Build Coastguard Worker  enum View {
45*d5c09012SAndroid Build Coastguard Worker    // Unspecified. Defaults to BASIC.
46*d5c09012SAndroid Build Coastguard Worker    VIEW_UNSPECIFIED = 0;
47*d5c09012SAndroid Build Coastguard Worker
48*d5c09012SAndroid Build Coastguard Worker    // The basic view omits fields which can be large or can contain
49*d5c09012SAndroid Build Coastguard Worker    // sensitive data.
50*d5c09012SAndroid Build Coastguard Worker    //
51*d5c09012SAndroid Build Coastguard Worker    // This view does not include the
52*d5c09012SAndroid Build Coastguard Worker    // [body in
53*d5c09012SAndroid Build Coastguard Worker    // AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest.body].
54*d5c09012SAndroid Build Coastguard Worker    // Bodies are desirable to return only when needed, because they
55*d5c09012SAndroid Build Coastguard Worker    // can be large and because of the sensitivity of the data that you
56*d5c09012SAndroid Build Coastguard Worker    // choose to store in it.
57*d5c09012SAndroid Build Coastguard Worker    BASIC = 1;
58*d5c09012SAndroid Build Coastguard Worker
59*d5c09012SAndroid Build Coastguard Worker    // All information is returned.
60*d5c09012SAndroid Build Coastguard Worker    //
61*d5c09012SAndroid Build Coastguard Worker    // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
62*d5c09012SAndroid Build Coastguard Worker    // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
63*d5c09012SAndroid Build Coastguard Worker    // permission on the [Queue][google.cloud.tasks.v2.Queue] resource.
64*d5c09012SAndroid Build Coastguard Worker    FULL = 2;
65*d5c09012SAndroid Build Coastguard Worker  }
66*d5c09012SAndroid Build Coastguard Worker
67*d5c09012SAndroid Build Coastguard Worker  // Optionally caller-specified in
68*d5c09012SAndroid Build Coastguard Worker  // [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask].
69*d5c09012SAndroid Build Coastguard Worker  //
70*d5c09012SAndroid Build Coastguard Worker  // The task name.
71*d5c09012SAndroid Build Coastguard Worker  //
72*d5c09012SAndroid Build Coastguard Worker  // The task name must have the following format:
73*d5c09012SAndroid Build Coastguard Worker  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
74*d5c09012SAndroid Build Coastguard Worker  //
75*d5c09012SAndroid Build Coastguard Worker  // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
76*d5c09012SAndroid Build Coastguard Worker  //    hyphens (-), colons (:), or periods (.).
77*d5c09012SAndroid Build Coastguard Worker  //    For more information, see
78*d5c09012SAndroid Build Coastguard Worker  //    [Identifying
79*d5c09012SAndroid Build Coastguard Worker  //    projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
80*d5c09012SAndroid Build Coastguard Worker  // * `LOCATION_ID` is the canonical ID for the task's location.
81*d5c09012SAndroid Build Coastguard Worker  //    The list of available locations can be obtained by calling
82*d5c09012SAndroid Build Coastguard Worker  //    [ListLocations][google.cloud.location.Locations.ListLocations].
83*d5c09012SAndroid Build Coastguard Worker  //    For more information, see https://cloud.google.com/about/locations/.
84*d5c09012SAndroid Build Coastguard Worker  // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
85*d5c09012SAndroid Build Coastguard Worker  //   hyphens (-). The maximum length is 100 characters.
86*d5c09012SAndroid Build Coastguard Worker  // * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
87*d5c09012SAndroid Build Coastguard Worker  //   hyphens (-), or underscores (_). The maximum length is 500 characters.
88*d5c09012SAndroid Build Coastguard Worker  string name = 1;
89*d5c09012SAndroid Build Coastguard Worker
90*d5c09012SAndroid Build Coastguard Worker  // Required. The message to send to the worker.
91*d5c09012SAndroid Build Coastguard Worker  oneof message_type {
92*d5c09012SAndroid Build Coastguard Worker    // HTTP request that is sent to the App Engine app handler.
93*d5c09012SAndroid Build Coastguard Worker    //
94*d5c09012SAndroid Build Coastguard Worker    // An App Engine task is a task that has
95*d5c09012SAndroid Build Coastguard Worker    // [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] set.
96*d5c09012SAndroid Build Coastguard Worker    AppEngineHttpRequest app_engine_http_request = 2;
97*d5c09012SAndroid Build Coastguard Worker
98*d5c09012SAndroid Build Coastguard Worker    // HTTP request that is sent to the worker.
99*d5c09012SAndroid Build Coastguard Worker    //
100*d5c09012SAndroid Build Coastguard Worker    // An HTTP task is a task that has
101*d5c09012SAndroid Build Coastguard Worker    // [HttpRequest][google.cloud.tasks.v2.HttpRequest] set.
102*d5c09012SAndroid Build Coastguard Worker    HttpRequest http_request = 3;
103*d5c09012SAndroid Build Coastguard Worker  }
104*d5c09012SAndroid Build Coastguard Worker
105*d5c09012SAndroid Build Coastguard Worker  // The time when the task is scheduled to be attempted or retried.
106*d5c09012SAndroid Build Coastguard Worker  //
107*d5c09012SAndroid Build Coastguard Worker  // `schedule_time` will be truncated to the nearest microsecond.
108*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp schedule_time = 4;
109*d5c09012SAndroid Build Coastguard Worker
110*d5c09012SAndroid Build Coastguard Worker  // Output only. The time that the task was created.
111*d5c09012SAndroid Build Coastguard Worker  //
112*d5c09012SAndroid Build Coastguard Worker  // `create_time` will be truncated to the nearest second.
113*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp create_time = 5;
114*d5c09012SAndroid Build Coastguard Worker
115*d5c09012SAndroid Build Coastguard Worker  // The deadline for requests sent to the worker. If the worker does not
116*d5c09012SAndroid Build Coastguard Worker  // respond by this deadline then the request is cancelled and the attempt
117*d5c09012SAndroid Build Coastguard Worker  // is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the
118*d5c09012SAndroid Build Coastguard Worker  // task according to the [RetryConfig][google.cloud.tasks.v2.RetryConfig].
119*d5c09012SAndroid Build Coastguard Worker  //
120*d5c09012SAndroid Build Coastguard Worker  // Note that when the request is cancelled, Cloud Tasks will stop listening
121*d5c09012SAndroid Build Coastguard Worker  // for the response, but whether the worker stops processing depends on the
122*d5c09012SAndroid Build Coastguard Worker  // worker. For example, if the worker is stuck, it may not react to cancelled
123*d5c09012SAndroid Build Coastguard Worker  // requests.
124*d5c09012SAndroid Build Coastguard Worker  //
125*d5c09012SAndroid Build Coastguard Worker  // The default and maximum values depend on the type of request:
126*d5c09012SAndroid Build Coastguard Worker  //
127*d5c09012SAndroid Build Coastguard Worker  // * For [HTTP tasks][google.cloud.tasks.v2.HttpRequest], the default is 10
128*d5c09012SAndroid Build Coastguard Worker  // minutes. The deadline
129*d5c09012SAndroid Build Coastguard Worker  //   must be in the interval [15 seconds, 30 minutes].
130*d5c09012SAndroid Build Coastguard Worker  //
131*d5c09012SAndroid Build Coastguard Worker  // * For [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest], 0
132*d5c09012SAndroid Build Coastguard Worker  // indicates that the
133*d5c09012SAndroid Build Coastguard Worker  //   request has the default deadline. The default deadline depends on the
134*d5c09012SAndroid Build Coastguard Worker  //   [scaling
135*d5c09012SAndroid Build Coastguard Worker  //   type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling)
136*d5c09012SAndroid Build Coastguard Worker  //   of the service: 10 minutes for standard apps with automatic scaling, 24
137*d5c09012SAndroid Build Coastguard Worker  //   hours for standard apps with manual and basic scaling, and 60 minutes for
138*d5c09012SAndroid Build Coastguard Worker  //   flex apps. If the request deadline is set, it must be in the interval [15
139*d5c09012SAndroid Build Coastguard Worker  //   seconds, 24 hours 15 seconds]. Regardless of the task's
140*d5c09012SAndroid Build Coastguard Worker  //   `dispatch_deadline`, the app handler will not run for longer than than
141*d5c09012SAndroid Build Coastguard Worker  //   the service's timeout. We recommend setting the `dispatch_deadline` to
142*d5c09012SAndroid Build Coastguard Worker  //   at most a few seconds more than the app handler's timeout. For more
143*d5c09012SAndroid Build Coastguard Worker  //   information see
144*d5c09012SAndroid Build Coastguard Worker  //   [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts).
145*d5c09012SAndroid Build Coastguard Worker  //
146*d5c09012SAndroid Build Coastguard Worker  // `dispatch_deadline` will be truncated to the nearest millisecond. The
147*d5c09012SAndroid Build Coastguard Worker  // deadline is an approximate deadline.
148*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Duration dispatch_deadline = 6;
149*d5c09012SAndroid Build Coastguard Worker
150*d5c09012SAndroid Build Coastguard Worker  // Output only. The number of attempts dispatched.
151*d5c09012SAndroid Build Coastguard Worker  //
152*d5c09012SAndroid Build Coastguard Worker  // This count includes attempts which have been dispatched but haven't
153*d5c09012SAndroid Build Coastguard Worker  // received a response.
154*d5c09012SAndroid Build Coastguard Worker  int32 dispatch_count = 7;
155*d5c09012SAndroid Build Coastguard Worker
156*d5c09012SAndroid Build Coastguard Worker  // Output only. The number of attempts which have received a response.
157*d5c09012SAndroid Build Coastguard Worker  int32 response_count = 8;
158*d5c09012SAndroid Build Coastguard Worker
159*d5c09012SAndroid Build Coastguard Worker  // Output only. The status of the task's first attempt.
160*d5c09012SAndroid Build Coastguard Worker  //
161*d5c09012SAndroid Build Coastguard Worker  // Only [dispatch_time][google.cloud.tasks.v2.Attempt.dispatch_time] will be
162*d5c09012SAndroid Build Coastguard Worker  // set. The other [Attempt][google.cloud.tasks.v2.Attempt] information is not
163*d5c09012SAndroid Build Coastguard Worker  // retained by Cloud Tasks.
164*d5c09012SAndroid Build Coastguard Worker  Attempt first_attempt = 9;
165*d5c09012SAndroid Build Coastguard Worker
166*d5c09012SAndroid Build Coastguard Worker  // Output only. The status of the task's last attempt.
167*d5c09012SAndroid Build Coastguard Worker  Attempt last_attempt = 10;
168*d5c09012SAndroid Build Coastguard Worker
169*d5c09012SAndroid Build Coastguard Worker  // Output only. The view specifies which subset of the
170*d5c09012SAndroid Build Coastguard Worker  // [Task][google.cloud.tasks.v2.Task] has been returned.
171*d5c09012SAndroid Build Coastguard Worker  View view = 11;
172*d5c09012SAndroid Build Coastguard Worker}
173*d5c09012SAndroid Build Coastguard Worker
174*d5c09012SAndroid Build Coastguard Worker// The status of a task attempt.
175*d5c09012SAndroid Build Coastguard Workermessage Attempt {
176*d5c09012SAndroid Build Coastguard Worker  // Output only. The time that this attempt was scheduled.
177*d5c09012SAndroid Build Coastguard Worker  //
178*d5c09012SAndroid Build Coastguard Worker  // `schedule_time` will be truncated to the nearest microsecond.
179*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp schedule_time = 1;
180*d5c09012SAndroid Build Coastguard Worker
181*d5c09012SAndroid Build Coastguard Worker  // Output only. The time that this attempt was dispatched.
182*d5c09012SAndroid Build Coastguard Worker  //
183*d5c09012SAndroid Build Coastguard Worker  // `dispatch_time` will be truncated to the nearest microsecond.
184*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp dispatch_time = 2;
185*d5c09012SAndroid Build Coastguard Worker
186*d5c09012SAndroid Build Coastguard Worker  // Output only. The time that this attempt response was received.
187*d5c09012SAndroid Build Coastguard Worker  //
188*d5c09012SAndroid Build Coastguard Worker  // `response_time` will be truncated to the nearest microsecond.
189*d5c09012SAndroid Build Coastguard Worker  google.protobuf.Timestamp response_time = 3;
190*d5c09012SAndroid Build Coastguard Worker
191*d5c09012SAndroid Build Coastguard Worker  // Output only. The response from the worker for this attempt.
192*d5c09012SAndroid Build Coastguard Worker  //
193*d5c09012SAndroid Build Coastguard Worker  // If `response_time` is unset, then the task has not been attempted or is
194*d5c09012SAndroid Build Coastguard Worker  // currently running and the `response_status` field is meaningless.
195*d5c09012SAndroid Build Coastguard Worker  google.rpc.Status response_status = 4;
196*d5c09012SAndroid Build Coastguard Worker}
197