xref: /aosp_15_r20/external/googleapis/google/cloud/tasks/v2beta2/cloudtasks.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.cloud.tasks.v2beta2;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/httpbody.proto";
23import "google/api/resource.proto";
24import "google/cloud/tasks/v2beta2/queue.proto";
25import "google/cloud/tasks/v2beta2/task.proto";
26import "google/iam/v1/iam_policy.proto";
27import "google/iam/v1/policy.proto";
28import "google/protobuf/duration.proto";
29import "google/protobuf/empty.proto";
30import "google/protobuf/field_mask.proto";
31import "google/protobuf/timestamp.proto";
32
33option go_package = "cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb;cloudtaskspb";
34option java_multiple_files = true;
35option java_outer_classname = "CloudTasksProto";
36option java_package = "com.google.cloud.tasks.v2beta2";
37option objc_class_prefix = "TASKS";
38option (google.api.resource_definition) = {
39  type: "cloudtasks.googleapis.com/Location"
40  pattern: "projects/{project}/locations/{location}"
41};
42
43// Cloud Tasks allows developers to manage the execution of background
44// work in their applications.
45service CloudTasks {
46  option (google.api.default_host) = "cloudtasks.googleapis.com";
47  option (google.api.oauth_scopes) =
48      "https://www.googleapis.com/auth/cloud-platform";
49
50  // Lists queues.
51  //
52  // Queues are returned in lexicographical order.
53  rpc ListQueues(ListQueuesRequest) returns (ListQueuesResponse) {
54    option (google.api.http) = {
55      get: "/v2beta2/{parent=projects/*/locations/*}/queues"
56    };
57    option (google.api.method_signature) = "parent";
58  }
59
60  // Gets a queue.
61  rpc GetQueue(GetQueueRequest) returns (Queue) {
62    option (google.api.http) = {
63      get: "/v2beta2/{name=projects/*/locations/*/queues/*}"
64    };
65    option (google.api.method_signature) = "name";
66  }
67
68  // Creates a queue.
69  //
70  // Queues created with this method allow tasks to live for a maximum of 31
71  // days. After a task is 31 days old, the task will be deleted regardless of
72  // whether it was dispatched or not.
73  //
74  // WARNING: Using this method may have unintended side effects if you are
75  // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
76  // Read
77  // [Overview of Queue Management and
78  // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
79  // this method.
80  rpc CreateQueue(CreateQueueRequest) returns (Queue) {
81    option (google.api.http) = {
82      post: "/v2beta2/{parent=projects/*/locations/*}/queues"
83      body: "queue"
84    };
85    option (google.api.method_signature) = "parent,queue";
86  }
87
88  // Updates a queue.
89  //
90  // This method creates the queue if it does not exist and updates
91  // the queue if it does exist.
92  //
93  // Queues created with this method allow tasks to live for a maximum of 31
94  // days. After a task is 31 days old, the task will be deleted regardless of
95  // whether it was dispatched or not.
96  //
97  // WARNING: Using this method may have unintended side effects if you are
98  // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
99  // Read
100  // [Overview of Queue Management and
101  // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
102  // this method.
103  rpc UpdateQueue(UpdateQueueRequest) returns (Queue) {
104    option (google.api.http) = {
105      patch: "/v2beta2/{queue.name=projects/*/locations/*/queues/*}"
106      body: "queue"
107    };
108    option (google.api.method_signature) = "queue,update_mask";
109  }
110
111  // Deletes a queue.
112  //
113  // This command will delete the queue even if it has tasks in it.
114  //
115  // Note: If you delete a queue, a queue with the same name can't be created
116  // for 7 days.
117  //
118  // WARNING: Using this method may have unintended side effects if you are
119  // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
120  // Read
121  // [Overview of Queue Management and
122  // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
123  // this method.
124  rpc DeleteQueue(DeleteQueueRequest) returns (google.protobuf.Empty) {
125    option (google.api.http) = {
126      delete: "/v2beta2/{name=projects/*/locations/*/queues/*}"
127    };
128    option (google.api.method_signature) = "name";
129  }
130
131  // Purges a queue by deleting all of its tasks.
132  //
133  // All tasks created before this method is called are permanently deleted.
134  //
135  // Purge operations can take up to one minute to take effect. Tasks
136  // might be dispatched before the purge takes effect. A purge is irreversible.
137  rpc PurgeQueue(PurgeQueueRequest) returns (Queue) {
138    option (google.api.http) = {
139      post: "/v2beta2/{name=projects/*/locations/*/queues/*}:purge"
140      body: "*"
141    };
142    option (google.api.method_signature) = "name";
143  }
144
145  // Pauses the queue.
146  //
147  // If a queue is paused then the system will stop dispatching tasks
148  // until the queue is resumed via
149  // [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue]. Tasks can
150  // still be added when the queue is paused. A queue is paused if its
151  // [state][google.cloud.tasks.v2beta2.Queue.state] is
152  // [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED].
153  rpc PauseQueue(PauseQueueRequest) returns (Queue) {
154    option (google.api.http) = {
155      post: "/v2beta2/{name=projects/*/locations/*/queues/*}:pause"
156      body: "*"
157    };
158    option (google.api.method_signature) = "name";
159  }
160
161  // Resume a queue.
162  //
163  // This method resumes a queue after it has been
164  // [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED] or
165  // [DISABLED][google.cloud.tasks.v2beta2.Queue.State.DISABLED]. The state of a
166  // queue is stored in the queue's
167  // [state][google.cloud.tasks.v2beta2.Queue.state]; after calling this method
168  // it will be set to
169  // [RUNNING][google.cloud.tasks.v2beta2.Queue.State.RUNNING].
170  //
171  // WARNING: Resuming many high-QPS queues at the same time can
172  // lead to target overloading. If you are resuming high-QPS
173  // queues, follow the 500/50/5 pattern described in
174  // [Managing Cloud Tasks Scaling
175  // Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
176  rpc ResumeQueue(ResumeQueueRequest) returns (Queue) {
177    option (google.api.http) = {
178      post: "/v2beta2/{name=projects/*/locations/*/queues/*}:resume"
179      body: "*"
180    };
181    option (google.api.method_signature) = "name";
182  }
183
184  // Update queue list by uploading a queue.yaml file.
185  //
186  // The queue.yaml file is supplied in the request body as a YAML encoded
187  // string. This method was added to support gcloud clients versions before
188  // 322.0.0. New clients should use CreateQueue instead of this method.
189  rpc UploadQueueYaml(UploadQueueYamlRequest) returns (google.protobuf.Empty) {}
190
191  // Gets the access control policy for a
192  // [Queue][google.cloud.tasks.v2beta2.Queue]. Returns an empty policy if the
193  // resource exists and does not have a policy set.
194  //
195  // Authorization requires the following
196  // [Google IAM](https://cloud.google.com/iam) permission on the specified
197  // resource parent:
198  //
199  // * `cloudtasks.queues.getIamPolicy`
200  rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
201      returns (google.iam.v1.Policy) {
202    option (google.api.http) = {
203      post: "/v2beta2/{resource=projects/*/locations/*/queues/*}:getIamPolicy"
204      body: "*"
205    };
206    option (google.api.method_signature) = "resource";
207  }
208
209  // Sets the access control policy for a
210  // [Queue][google.cloud.tasks.v2beta2.Queue]. Replaces any existing policy.
211  //
212  // Note: The Cloud Console does not check queue-level IAM permissions yet.
213  // Project-level permissions are required to use the Cloud Console.
214  //
215  // Authorization requires the following
216  // [Google IAM](https://cloud.google.com/iam) permission on the specified
217  // resource parent:
218  //
219  // * `cloudtasks.queues.setIamPolicy`
220  rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
221      returns (google.iam.v1.Policy) {
222    option (google.api.http) = {
223      post: "/v2beta2/{resource=projects/*/locations/*/queues/*}:setIamPolicy"
224      body: "*"
225    };
226    option (google.api.method_signature) = "resource,policy";
227  }
228
229  // Returns permissions that a caller has on a
230  // [Queue][google.cloud.tasks.v2beta2.Queue]. If the resource does not exist,
231  // this will return an empty set of permissions, not a
232  // [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
233  //
234  // Note: This operation is designed to be used for building permission-aware
235  // UIs and command-line tools, not for authorization checking. This operation
236  // may "fail open" without warning.
237  rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
238      returns (google.iam.v1.TestIamPermissionsResponse) {
239    option (google.api.http) = {
240      post: "/v2beta2/{resource=projects/*/locations/*/queues/*}:testIamPermissions"
241      body: "*"
242    };
243    option (google.api.method_signature) = "resource,permissions";
244  }
245
246  // Lists the tasks in a queue.
247  //
248  // By default, only the [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]
249  // view is retrieved due to performance considerations;
250  // [response_view][google.cloud.tasks.v2beta2.ListTasksRequest.response_view]
251  // controls the subset of information which is returned.
252  //
253  // The tasks may be returned in any order. The ordering may change at any
254  // time.
255  rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) {
256    option (google.api.http) = {
257      get: "/v2beta2/{parent=projects/*/locations/*/queues/*}/tasks"
258    };
259    option (google.api.method_signature) = "parent";
260  }
261
262  // Gets a task.
263  rpc GetTask(GetTaskRequest) returns (Task) {
264    option (google.api.http) = {
265      get: "/v2beta2/{name=projects/*/locations/*/queues/*/tasks/*}"
266    };
267    option (google.api.method_signature) = "name";
268  }
269
270  // Creates a task and adds it to a queue.
271  //
272  // Tasks cannot be updated after creation; there is no UpdateTask command.
273  //
274  // * For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget],
275  // the maximum task size is
276  //   100KB.
277  // * For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum
278  // task size is 1MB.
279  rpc CreateTask(CreateTaskRequest) returns (Task) {
280    option (google.api.http) = {
281      post: "/v2beta2/{parent=projects/*/locations/*/queues/*}/tasks"
282      body: "*"
283    };
284    option (google.api.method_signature) = "parent,task";
285  }
286
287  // Deletes a task.
288  //
289  // A task can be deleted if it is scheduled or dispatched. A task
290  // cannot be deleted if it has completed successfully or permanently
291  // failed.
292  rpc DeleteTask(DeleteTaskRequest) returns (google.protobuf.Empty) {
293    option (google.api.http) = {
294      delete: "/v2beta2/{name=projects/*/locations/*/queues/*/tasks/*}"
295    };
296    option (google.api.method_signature) = "name";
297  }
298
299  // Leases tasks from a pull queue for
300  // [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
301  //
302  // This method is invoked by the worker to obtain a lease. The
303  // worker must acknowledge the task via
304  // [AcknowledgeTask][google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask]
305  // after they have performed the work associated with the task.
306  //
307  // The [payload][google.cloud.tasks.v2beta2.PullMessage.payload] is intended
308  // to store data that the worker needs to perform the work associated with the
309  // task. To return the payloads in the
310  // [response][google.cloud.tasks.v2beta2.LeaseTasksResponse], set
311  // [response_view][google.cloud.tasks.v2beta2.LeaseTasksRequest.response_view]
312  // to [FULL][google.cloud.tasks.v2beta2.Task.View.FULL].
313  //
314  // A maximum of 10 qps of
315  // [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] requests are
316  // allowed per queue. [RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]
317  // is returned when this limit is
318  // exceeded. [RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]
319  // is also returned when
320  // [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second]
321  // is exceeded.
322  rpc LeaseTasks(LeaseTasksRequest) returns (LeaseTasksResponse) {
323    option (google.api.http) = {
324      post: "/v2beta2/{parent=projects/*/locations/*/queues/*}/tasks:lease"
325      body: "*"
326    };
327    option (google.api.method_signature) = "parent,lease_duration";
328  }
329
330  // Acknowledges a pull task.
331  //
332  // The worker, that is, the entity that
333  // [leased][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] this task must
334  // call this method to indicate that the work associated with the task has
335  // finished.
336  //
337  // The worker must acknowledge a task within the
338  // [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration]
339  // or the lease will expire and the task will become available to be leased
340  // again. After the task is acknowledged, it will not be returned
341  // by a later [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks],
342  // [GetTask][google.cloud.tasks.v2beta2.CloudTasks.GetTask], or
343  // [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks].
344  rpc AcknowledgeTask(AcknowledgeTaskRequest) returns (google.protobuf.Empty) {
345    option (google.api.http) = {
346      post: "/v2beta2/{name=projects/*/locations/*/queues/*/tasks/*}:acknowledge"
347      body: "*"
348    };
349    option (google.api.method_signature) = "name,schedule_time";
350  }
351
352  // Renew the current lease of a pull task.
353  //
354  // The worker can use this method to extend the lease by a new
355  // duration, starting from now. The new task lease will be
356  // returned in the task's
357  // [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time].
358  rpc RenewLease(RenewLeaseRequest) returns (Task) {
359    option (google.api.http) = {
360      post: "/v2beta2/{name=projects/*/locations/*/queues/*/tasks/*}:renewLease"
361      body: "*"
362    };
363    option (google.api.method_signature) = "name,schedule_time,lease_duration";
364  }
365
366  // Cancel a pull task's lease.
367  //
368  // The worker can use this method to cancel a task's lease by
369  // setting its [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]
370  // to now. This will make the task available to be leased to the next caller
371  // of [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks].
372  rpc CancelLease(CancelLeaseRequest) returns (Task) {
373    option (google.api.http) = {
374      post: "/v2beta2/{name=projects/*/locations/*/queues/*/tasks/*}:cancelLease"
375      body: "*"
376    };
377    option (google.api.method_signature) = "name,schedule_time";
378  }
379
380  // Forces a task to run now.
381  //
382  // When this method is called, Cloud Tasks will dispatch the task, even if
383  // the task is already running, the queue has reached its
384  // [RateLimits][google.cloud.tasks.v2beta2.RateLimits] or is
385  // [PAUSED][google.cloud.tasks.v2beta2.Queue.State.PAUSED].
386  //
387  // This command is meant to be used for manual debugging. For
388  // example, [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] can be
389  // used to retry a failed task after a fix has been made or to manually force
390  // a task to be dispatched now.
391  //
392  // The dispatched task is returned. That is, the task that is returned
393  // contains the [status][google.cloud.tasks.v2beta2.Task.status] after the
394  // task is dispatched but before the task is received by its target.
395  //
396  // If Cloud Tasks receives a successful response from the task's
397  // target, then the task will be deleted; otherwise the task's
398  // [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] will be
399  // reset to the time that
400  // [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] was called plus
401  // the retry delay specified in the queue's
402  // [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig].
403  //
404  // [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] returns
405  // [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
406  // task that has already succeeded or permanently failed.
407  //
408  // [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask] cannot be called
409  // on a [pull task][google.cloud.tasks.v2beta2.PullMessage].
410  rpc RunTask(RunTaskRequest) returns (Task) {
411    option (google.api.http) = {
412      post: "/v2beta2/{name=projects/*/locations/*/queues/*/tasks/*}:run"
413      body: "*"
414    };
415    option (google.api.method_signature) = "name";
416  }
417}
418
419// Request message for
420// [ListQueues][google.cloud.tasks.v2beta2.CloudTasks.ListQueues].
421message ListQueuesRequest {
422  // Required. The location name.
423  // For example: `projects/PROJECT_ID/locations/LOCATION_ID`
424  string parent = 1 [
425    (google.api.field_behavior) = REQUIRED,
426    (google.api.resource_reference) = {
427      child_type: "cloudtasks.googleapis.com/Queue"
428    }
429  ];
430
431  // `filter` can be used to specify a subset of queues. Any
432  // [Queue][google.cloud.tasks.v2beta2.Queue] field can be used as a filter and
433  // several operators as supported. For example: `<=, <, >=, >, !=, =, :`. The
434  // filter syntax is the same as described in [Stackdriver's Advanced Logs
435  // Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
436  //
437  // Sample filter "app_engine_http_target: *".
438  //
439  // Note that using filters might cause fewer queues than the
440  // requested_page size to be returned.
441  string filter = 2;
442
443  // Requested page size.
444  //
445  // The maximum page size is 9800. If unspecified, the page size will
446  // be the maximum. Fewer queues than requested might be returned,
447  // even if more queues exist; use the
448  // [next_page_token][google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token]
449  // in the response to determine if more queues exist.
450  int32 page_size = 3;
451
452  // A token identifying the page of results to return.
453  //
454  // To request the first page results, page_token must be empty. To
455  // request the next page of results, page_token must be the value of
456  // [next_page_token][google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token]
457  // returned from the previous call to
458  // [ListQueues][google.cloud.tasks.v2beta2.CloudTasks.ListQueues] method. It
459  // is an error to switch the value of the
460  // [filter][google.cloud.tasks.v2beta2.ListQueuesRequest.filter] while
461  // iterating through pages.
462  string page_token = 4;
463
464  // Optional. Read mask is used for a more granular control over what the API
465  // returns. If the mask is not present all fields will be returned except
466  // [Queue.stats]. [Queue.stats] will be returned only if it was  explicitly
467  // specified in the mask.
468  google.protobuf.FieldMask read_mask = 5
469      [(google.api.field_behavior) = OPTIONAL];
470}
471
472// Response message for
473// [ListQueues][google.cloud.tasks.v2beta2.CloudTasks.ListQueues].
474message ListQueuesResponse {
475  // The list of queues.
476  repeated Queue queues = 1;
477
478  // A token to retrieve next page of results.
479  //
480  // To return the next page of results, call
481  // [ListQueues][google.cloud.tasks.v2beta2.CloudTasks.ListQueues] with this
482  // value as the
483  // [page_token][google.cloud.tasks.v2beta2.ListQueuesRequest.page_token].
484  //
485  // If the next_page_token is empty, there are no more results.
486  //
487  // The page token is valid for only 2 hours.
488  string next_page_token = 2;
489}
490
491// Request message for
492// [GetQueue][google.cloud.tasks.v2beta2.CloudTasks.GetQueue].
493message GetQueueRequest {
494  // Required. The resource name of the queue. For example:
495  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
496  string name = 1 [
497    (google.api.field_behavior) = REQUIRED,
498    (google.api.resource_reference) = {
499      type: "cloudtasks.googleapis.com/Queue"
500    }
501  ];
502
503  // Optional. Read mask is used for a more granular control over what the API
504  // returns. If the mask is not present all fields will be returned except
505  // [Queue.stats]. [Queue.stats] will be returned only if it was  explicitly
506  // specified in the mask.
507  google.protobuf.FieldMask read_mask = 2
508      [(google.api.field_behavior) = OPTIONAL];
509}
510
511// Request message for
512// [CreateQueue][google.cloud.tasks.v2beta2.CloudTasks.CreateQueue].
513message CreateQueueRequest {
514  // Required. The location name in which the queue will be created.
515  // For example: `projects/PROJECT_ID/locations/LOCATION_ID`
516  //
517  // The list of allowed locations can be obtained by calling Cloud
518  // Tasks' implementation of
519  // [ListLocations][google.cloud.location.Locations.ListLocations].
520  string parent = 1 [
521    (google.api.field_behavior) = REQUIRED,
522    (google.api.resource_reference) = {
523      child_type: "cloudtasks.googleapis.com/Queue"
524    }
525  ];
526
527  // Required. The queue to create.
528  //
529  // [Queue's name][google.cloud.tasks.v2beta2.Queue.name] cannot be the same as
530  // an existing queue.
531  Queue queue = 2 [(google.api.field_behavior) = REQUIRED];
532}
533
534// Request message for
535// [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue].
536message UpdateQueueRequest {
537  // Required. The queue to create or update.
538  //
539  // The queue's [name][google.cloud.tasks.v2beta2.Queue.name] must be
540  // specified.
541  //
542  // Output only fields cannot be modified using UpdateQueue.
543  // Any value specified for an output only field will be ignored.
544  // The queue's [name][google.cloud.tasks.v2beta2.Queue.name] cannot be
545  // changed.
546  Queue queue = 1 [(google.api.field_behavior) = REQUIRED];
547
548  // A mask used to specify which fields of the queue are being updated.
549  //
550  // If empty, then all fields will be updated.
551  google.protobuf.FieldMask update_mask = 2;
552}
553
554// Request message for
555// [DeleteQueue][google.cloud.tasks.v2beta2.CloudTasks.DeleteQueue].
556message DeleteQueueRequest {
557  // Required. The queue name. For example:
558  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
559  string name = 1 [
560    (google.api.field_behavior) = REQUIRED,
561    (google.api.resource_reference) = {
562      type: "cloudtasks.googleapis.com/Queue"
563    }
564  ];
565}
566
567// Request message for
568// [PurgeQueue][google.cloud.tasks.v2beta2.CloudTasks.PurgeQueue].
569message PurgeQueueRequest {
570  // Required. The queue name. For example:
571  // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
572  string name = 1 [
573    (google.api.field_behavior) = REQUIRED,
574    (google.api.resource_reference) = {
575      type: "cloudtasks.googleapis.com/Queue"
576    }
577  ];
578}
579
580// Request message for
581// [PauseQueue][google.cloud.tasks.v2beta2.CloudTasks.PauseQueue].
582message PauseQueueRequest {
583  // Required. The queue name. For example:
584  // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
585  string name = 1 [
586    (google.api.field_behavior) = REQUIRED,
587    (google.api.resource_reference) = {
588      type: "cloudtasks.googleapis.com/Queue"
589    }
590  ];
591}
592
593// Request message for
594// [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue].
595message ResumeQueueRequest {
596  // Required. The queue name. For example:
597  // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
598  string name = 1 [
599    (google.api.field_behavior) = REQUIRED,
600    (google.api.resource_reference) = {
601      type: "cloudtasks.googleapis.com/Queue"
602    }
603  ];
604}
605
606// Request message for
607// [UploadQueueYaml][google.cloud.tasks.v2beta2.CloudTasks.UploadQueueYaml].
608message UploadQueueYamlRequest {
609  // Required. The App ID is supplied as an HTTP parameter. Unlike internal
610  // usage of App ID, it does not include a region prefix. Rather, the App ID
611  // represents the Project ID against which to make the request.
612  string app_id = 1 [(google.api.field_behavior) = REQUIRED];
613
614  // The http body contains the queue.yaml file which used to update queue lists
615  optional google.api.HttpBody http_body = 2;
616}
617
618// Request message for listing tasks using
619// [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks].
620message ListTasksRequest {
621  // Required. The queue name. For example:
622  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
623  string parent = 1 [
624    (google.api.field_behavior) = REQUIRED,
625    (google.api.resource_reference) = {
626      child_type: "cloudtasks.googleapis.com/Task"
627    }
628  ];
629
630  // The response_view specifies which subset of the
631  // [Task][google.cloud.tasks.v2beta2.Task] will be returned.
632  //
633  // By default response_view is
634  // [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all information is
635  // retrieved by default because some data, such as payloads, might be
636  // desirable to return only when needed because of its large size or because
637  // of the sensitivity of data that it contains.
638  //
639  // Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]
640  // requires `cloudtasks.tasks.fullView` [Google
641  // IAM](https://cloud.google.com/iam/) permission on the
642  // [Task][google.cloud.tasks.v2beta2.Task] resource.
643  Task.View response_view = 2;
644
645  // Maximum page size.
646  //
647  // Fewer tasks than requested might be returned, even if more tasks exist; use
648  // [next_page_token][google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token]
649  // in the response to determine if more tasks exist.
650  //
651  // The maximum page size is 1000. If unspecified, the page size will be the
652  // maximum.
653  int32 page_size = 4;
654
655  // A token identifying the page of results to return.
656  //
657  // To request the first page results, page_token must be empty. To
658  // request the next page of results, page_token must be the value of
659  // [next_page_token][google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token]
660  // returned from the previous call to
661  // [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks] method.
662  //
663  // The page token is valid for only 2 hours.
664  string page_token = 5;
665}
666
667// Response message for listing tasks using
668// [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks].
669message ListTasksResponse {
670  // The list of tasks.
671  repeated Task tasks = 1;
672
673  // A token to retrieve next page of results.
674  //
675  // To return the next page of results, call
676  // [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks] with this
677  // value as the
678  // [page_token][google.cloud.tasks.v2beta2.ListTasksRequest.page_token].
679  //
680  // If the next_page_token is empty, there are no more results.
681  string next_page_token = 2;
682}
683
684// Request message for getting a task using
685// [GetTask][google.cloud.tasks.v2beta2.CloudTasks.GetTask].
686message GetTaskRequest {
687  // Required. The task name. For example:
688  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
689  string name = 1 [
690    (google.api.field_behavior) = REQUIRED,
691    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
692  ];
693
694  // The response_view specifies which subset of the
695  // [Task][google.cloud.tasks.v2beta2.Task] will be returned.
696  //
697  // By default response_view is
698  // [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all information is
699  // retrieved by default because some data, such as payloads, might be
700  // desirable to return only when needed because of its large size or because
701  // of the sensitivity of data that it contains.
702  //
703  // Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]
704  // requires `cloudtasks.tasks.fullView` [Google
705  // IAM](https://cloud.google.com/iam/) permission on the
706  // [Task][google.cloud.tasks.v2beta2.Task] resource.
707  Task.View response_view = 2;
708}
709
710// Request message for
711// [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
712message CreateTaskRequest {
713  // Required. The queue name. For example:
714  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
715  //
716  // The queue must already exist.
717  string parent = 1 [
718    (google.api.field_behavior) = REQUIRED,
719    (google.api.resource_reference) = {
720      child_type: "cloudtasks.googleapis.com/Task"
721    }
722  ];
723
724  // Required. The task to add.
725  //
726  // Task names have the following format:
727  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
728  // The user can optionally specify a task
729  // [name][google.cloud.tasks.v2beta2.Task.name]. If a name is not specified
730  // then the system will generate a random unique task id, which will be set in
731  // the task returned in the [response][google.cloud.tasks.v2beta2.Task.name].
732  //
733  // If [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] is not
734  // set or is in the past then Cloud Tasks will set it to the current time.
735  //
736  // Task De-duplication:
737  //
738  // Explicitly specifying a task ID enables task de-duplication.  If
739  // a task's ID is identical to that of an existing task or a task
740  // that was deleted or completed recently then the call will fail
741  // with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
742  // If the task's queue was created using Cloud Tasks, then another task with
743  // the same name can't be created for ~1 hour after the original task was
744  // deleted or completed. If the task's queue was created using queue.yaml or
745  // queue.xml, then another task with the same name can't be created
746  // for ~9 days after the original task was deleted or completed.
747  //
748  // Because there is an extra lookup cost to identify duplicate task
749  // names, these [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
750  // calls have significantly increased latency. Using hashed strings for the
751  // task id or for the prefix of the task id is recommended. Choosing task ids
752  // that are sequential or have sequential prefixes, for example using a
753  // timestamp, causes an increase in latency and error rates in all
754  // task commands. The infrastructure relies on an approximately
755  // uniform distribution of task ids to store and serve tasks
756  // efficiently.
757  Task task = 2 [(google.api.field_behavior) = REQUIRED];
758
759  // The response_view specifies which subset of the
760  // [Task][google.cloud.tasks.v2beta2.Task] will be returned.
761  //
762  // By default response_view is
763  // [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all information is
764  // retrieved by default because some data, such as payloads, might be
765  // desirable to return only when needed because of its large size or because
766  // of the sensitivity of data that it contains.
767  //
768  // Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]
769  // requires `cloudtasks.tasks.fullView` [Google
770  // IAM](https://cloud.google.com/iam/) permission on the
771  // [Task][google.cloud.tasks.v2beta2.Task] resource.
772  Task.View response_view = 3;
773}
774
775// Request message for deleting a task using
776// [DeleteTask][google.cloud.tasks.v2beta2.CloudTasks.DeleteTask].
777message DeleteTaskRequest {
778  // Required. The task name. For example:
779  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
780  string name = 1 [
781    (google.api.field_behavior) = REQUIRED,
782    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
783  ];
784}
785
786// Request message for leasing tasks using
787// [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks].
788message LeaseTasksRequest {
789  // Required. The queue name. For example:
790  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
791  string parent = 1 [
792    (google.api.field_behavior) = REQUIRED,
793    (google.api.resource_reference) = {
794      child_type: "cloudtasks.googleapis.com/Task"
795    }
796  ];
797
798  // The maximum number of tasks to lease.
799  //
800  // The system will make a best effort to return as close to as
801  // `max_tasks` as possible.
802  //
803  // The largest that `max_tasks` can be is 1000.
804  //
805  // The maximum total size of a [lease tasks
806  // response][google.cloud.tasks.v2beta2.LeaseTasksResponse] is 32 MB. If the
807  // sum of all task sizes requested reaches this limit, fewer tasks than
808  // requested are returned.
809  int32 max_tasks = 2;
810
811  // Required. The duration of the lease.
812  //
813  // Each task returned in the
814  // [response][google.cloud.tasks.v2beta2.LeaseTasksResponse] will have its
815  // [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] set to the
816  // current time plus the `lease_duration`. The task is leased until its
817  // [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]; thus, the
818  // task will not be returned to another
819  // [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] call before
820  // its [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time].
821  //
822  //
823  // After the worker has successfully finished the work associated
824  // with the task, the worker must call via
825  // [AcknowledgeTask][google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask]
826  // before the [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time].
827  // Otherwise the task will be returned to a later
828  // [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] call so that
829  // another worker can retry it.
830  //
831  // The maximum lease duration is 1 week.
832  // `lease_duration` will be truncated to the nearest second.
833  google.protobuf.Duration lease_duration = 3
834      [(google.api.field_behavior) = REQUIRED];
835
836  // The response_view specifies which subset of the
837  // [Task][google.cloud.tasks.v2beta2.Task] will be returned.
838  //
839  // By default response_view is
840  // [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all information is
841  // retrieved by default because some data, such as payloads, might be
842  // desirable to return only when needed because of its large size or because
843  // of the sensitivity of data that it contains.
844  //
845  // Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]
846  // requires `cloudtasks.tasks.fullView` [Google
847  // IAM](https://cloud.google.com/iam/) permission on the
848  // [Task][google.cloud.tasks.v2beta2.Task] resource.
849  Task.View response_view = 4;
850
851  // `filter` can be used to specify a subset of tasks to lease.
852  //
853  // When `filter` is set to `tag=<my-tag>` then the
854  // [response][google.cloud.tasks.v2beta2.LeaseTasksResponse] will contain only
855  // tasks whose [tag][google.cloud.tasks.v2beta2.PullMessage.tag] is equal to
856  // `<my-tag>`. `<my-tag>` must be less than 500 characters.
857  //
858  // When `filter` is set to `tag_function=oldest_tag()`, only tasks which have
859  // the same tag as the task with the oldest
860  // [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] will be
861  // returned.
862  //
863  // Grammar Syntax:
864  //
865  // * `filter = "tag=" tag | "tag_function=" function`
866  //
867  // * `tag = string`
868  //
869  // * `function = "oldest_tag()"`
870  //
871  // The `oldest_tag()` function returns tasks which have the same tag as the
872  // oldest task (ordered by schedule time).
873  //
874  // SDK compatibility: Although the SDK allows tags to be either
875  // string or
876  // [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
877  // only UTF-8 encoded tags can be used in Cloud Tasks. Tag which
878  // aren't UTF-8 encoded can't be used in the
879  // [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter] and the
880  // task's [tag][google.cloud.tasks.v2beta2.PullMessage.tag] will be displayed
881  // as empty in Cloud Tasks.
882  string filter = 5;
883}
884
885// Response message for leasing tasks using
886// [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks].
887message LeaseTasksResponse {
888  // The leased tasks.
889  repeated Task tasks = 1;
890}
891
892// Request message for acknowledging a task using
893// [AcknowledgeTask][google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask].
894message AcknowledgeTaskRequest {
895  // Required. The task name. For example:
896  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
897  string name = 1 [
898    (google.api.field_behavior) = REQUIRED,
899    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
900  ];
901
902  // Required. The task's current schedule time, available in the
903  // [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by
904  // [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or
905  // [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response.
906  // This restriction is to ensure that your worker currently holds the lease.
907  google.protobuf.Timestamp schedule_time = 2
908      [(google.api.field_behavior) = REQUIRED];
909}
910
911// Request message for renewing a lease using
912// [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease].
913message RenewLeaseRequest {
914  // Required. The task name. For example:
915  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
916  string name = 1 [
917    (google.api.field_behavior) = REQUIRED,
918    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
919  ];
920
921  // Required. The task's current schedule time, available in the
922  // [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by
923  // [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or
924  // [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response.
925  // This restriction is to ensure that your worker currently holds the lease.
926  google.protobuf.Timestamp schedule_time = 2
927      [(google.api.field_behavior) = REQUIRED];
928
929  // Required. The desired new lease duration, starting from now.
930  //
931  //
932  // The maximum lease duration is 1 week.
933  // `lease_duration` will be truncated to the nearest second.
934  google.protobuf.Duration lease_duration = 3
935      [(google.api.field_behavior) = REQUIRED];
936
937  // The response_view specifies which subset of the
938  // [Task][google.cloud.tasks.v2beta2.Task] will be returned.
939  //
940  // By default response_view is
941  // [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all information is
942  // retrieved by default because some data, such as payloads, might be
943  // desirable to return only when needed because of its large size or because
944  // of the sensitivity of data that it contains.
945  //
946  // Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]
947  // requires `cloudtasks.tasks.fullView` [Google
948  // IAM](https://cloud.google.com/iam/) permission on the
949  // [Task][google.cloud.tasks.v2beta2.Task] resource.
950  Task.View response_view = 4;
951}
952
953// Request message for canceling a lease using
954// [CancelLease][google.cloud.tasks.v2beta2.CloudTasks.CancelLease].
955message CancelLeaseRequest {
956  // Required. The task name. For example:
957  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
958  string name = 1 [
959    (google.api.field_behavior) = REQUIRED,
960    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
961  ];
962
963  // Required. The task's current schedule time, available in the
964  // [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by
965  // [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or
966  // [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response.
967  // This restriction is to ensure that your worker currently holds the lease.
968  google.protobuf.Timestamp schedule_time = 2
969      [(google.api.field_behavior) = REQUIRED];
970
971  // The response_view specifies which subset of the
972  // [Task][google.cloud.tasks.v2beta2.Task] will be returned.
973  //
974  // By default response_view is
975  // [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all information is
976  // retrieved by default because some data, such as payloads, might be
977  // desirable to return only when needed because of its large size or because
978  // of the sensitivity of data that it contains.
979  //
980  // Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]
981  // requires `cloudtasks.tasks.fullView` [Google
982  // IAM](https://cloud.google.com/iam/) permission on the
983  // [Task][google.cloud.tasks.v2beta2.Task] resource.
984  Task.View response_view = 3;
985}
986
987// Request message for forcing a task to run now using
988// [RunTask][google.cloud.tasks.v2beta2.CloudTasks.RunTask].
989message RunTaskRequest {
990  // Required. The task name. For example:
991  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
992  string name = 1 [
993    (google.api.field_behavior) = REQUIRED,
994    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
995  ];
996
997  // The response_view specifies which subset of the
998  // [Task][google.cloud.tasks.v2beta2.Task] will be returned.
999  //
1000  // By default response_view is
1001  // [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all information is
1002  // retrieved by default because some data, such as payloads, might be
1003  // desirable to return only when needed because of its large size or because
1004  // of the sensitivity of data that it contains.
1005  //
1006  // Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL]
1007  // requires `cloudtasks.tasks.fullView` [Google
1008  // IAM](https://cloud.google.com/iam/) permission on the
1009  // [Task][google.cloud.tasks.v2beta2.Task] resource.
1010  Task.View response_view = 2;
1011}
1012