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