xref: /aosp_15_r20/external/googleapis/google/cloud/tasks/v2/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.v2;
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/v2/queue.proto";
24import "google/cloud/tasks/v2/task.proto";
25import "google/iam/v1/iam_policy.proto";
26import "google/iam/v1/policy.proto";
27import "google/protobuf/empty.proto";
28import "google/protobuf/field_mask.proto";
29
30option go_package = "cloud.google.com/go/cloudtasks/apiv2/cloudtaskspb;cloudtaskspb";
31option java_multiple_files = true;
32option java_outer_classname = "CloudTasksProto";
33option java_package = "com.google.cloud.tasks.v2";
34option objc_class_prefix = "TASKS";
35
36// Cloud Tasks allows developers to manage the execution of background
37// work in their applications.
38service CloudTasks {
39  option (google.api.default_host) = "cloudtasks.googleapis.com";
40  option (google.api.oauth_scopes) =
41      "https://www.googleapis.com/auth/cloud-platform";
42
43  // Lists queues.
44  //
45  // Queues are returned in lexicographical order.
46  rpc ListQueues(ListQueuesRequest) returns (ListQueuesResponse) {
47    option (google.api.http) = {
48      get: "/v2/{parent=projects/*/locations/*}/queues"
49    };
50    option (google.api.method_signature) = "parent";
51  }
52
53  // Gets a queue.
54  rpc GetQueue(GetQueueRequest) returns (Queue) {
55    option (google.api.http) = {
56      get: "/v2/{name=projects/*/locations/*/queues/*}"
57    };
58    option (google.api.method_signature) = "name";
59  }
60
61  // Creates a queue.
62  //
63  // Queues created with this method allow tasks to live for a maximum of 31
64  // days. After a task is 31 days old, the task will be deleted regardless of
65  // whether it was dispatched or not.
66  //
67  // WARNING: Using this method may have unintended side effects if you are
68  // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
69  // Read
70  // [Overview of Queue Management and
71  // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
72  // this method.
73  rpc CreateQueue(CreateQueueRequest) returns (Queue) {
74    option (google.api.http) = {
75      post: "/v2/{parent=projects/*/locations/*}/queues"
76      body: "queue"
77    };
78    option (google.api.method_signature) = "parent,queue";
79  }
80
81  // Updates a queue.
82  //
83  // This method creates the queue if it does not exist and updates
84  // the queue if it does exist.
85  //
86  // Queues created with this method allow tasks to live for a maximum of 31
87  // days. After a task is 31 days old, the task will be deleted regardless of
88  // whether it was dispatched or not.
89  //
90  // WARNING: Using this method may have unintended side effects if you are
91  // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
92  // Read
93  // [Overview of Queue Management and
94  // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
95  // this method.
96  rpc UpdateQueue(UpdateQueueRequest) returns (Queue) {
97    option (google.api.http) = {
98      patch: "/v2/{queue.name=projects/*/locations/*/queues/*}"
99      body: "queue"
100    };
101    option (google.api.method_signature) = "queue,update_mask";
102  }
103
104  // Deletes a queue.
105  //
106  // This command will delete the queue even if it has tasks in it.
107  //
108  // Note: If you delete a queue, a queue with the same name can't be created
109  // for 7 days.
110  //
111  // WARNING: Using this method may have unintended side effects if you are
112  // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues.
113  // Read
114  // [Overview of Queue Management and
115  // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using
116  // this method.
117  rpc DeleteQueue(DeleteQueueRequest) returns (google.protobuf.Empty) {
118    option (google.api.http) = {
119      delete: "/v2/{name=projects/*/locations/*/queues/*}"
120    };
121    option (google.api.method_signature) = "name";
122  }
123
124  // Purges a queue by deleting all of its tasks.
125  //
126  // All tasks created before this method is called are permanently deleted.
127  //
128  // Purge operations can take up to one minute to take effect. Tasks
129  // might be dispatched before the purge takes effect. A purge is irreversible.
130  rpc PurgeQueue(PurgeQueueRequest) returns (Queue) {
131    option (google.api.http) = {
132      post: "/v2/{name=projects/*/locations/*/queues/*}:purge"
133      body: "*"
134    };
135    option (google.api.method_signature) = "name";
136  }
137
138  // Pauses the queue.
139  //
140  // If a queue is paused then the system will stop dispatching tasks
141  // until the queue is resumed via
142  // [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can
143  // still be added when the queue is paused. A queue is paused if its
144  // [state][google.cloud.tasks.v2.Queue.state] is
145  // [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
146  rpc PauseQueue(PauseQueueRequest) returns (Queue) {
147    option (google.api.http) = {
148      post: "/v2/{name=projects/*/locations/*/queues/*}:pause"
149      body: "*"
150    };
151    option (google.api.method_signature) = "name";
152  }
153
154  // Resume a queue.
155  //
156  // This method resumes a queue after it has been
157  // [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or
158  // [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a
159  // queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state];
160  // after calling this method it will be set to
161  // [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING].
162  //
163  // WARNING: Resuming many high-QPS queues at the same time can
164  // lead to target overloading. If you are resuming high-QPS
165  // queues, follow the 500/50/5 pattern described in
166  // [Managing Cloud Tasks Scaling
167  // Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
168  rpc ResumeQueue(ResumeQueueRequest) returns (Queue) {
169    option (google.api.http) = {
170      post: "/v2/{name=projects/*/locations/*/queues/*}:resume"
171      body: "*"
172    };
173    option (google.api.method_signature) = "name";
174  }
175
176  // Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
177  // Returns an empty policy if the resource exists and does not have a policy
178  // set.
179  //
180  // Authorization requires the following
181  // [Google IAM](https://cloud.google.com/iam) permission on the specified
182  // resource parent:
183  //
184  // * `cloudtasks.queues.getIamPolicy`
185  rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
186      returns (google.iam.v1.Policy) {
187    option (google.api.http) = {
188      post: "/v2/{resource=projects/*/locations/*/queues/*}:getIamPolicy"
189      body: "*"
190    };
191    option (google.api.method_signature) = "resource";
192  }
193
194  // Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue].
195  // Replaces any existing policy.
196  //
197  // Note: The Cloud Console does not check queue-level IAM permissions yet.
198  // Project-level permissions are required to use the Cloud Console.
199  //
200  // Authorization requires the following
201  // [Google IAM](https://cloud.google.com/iam) permission on the specified
202  // resource parent:
203  //
204  // * `cloudtasks.queues.setIamPolicy`
205  rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
206      returns (google.iam.v1.Policy) {
207    option (google.api.http) = {
208      post: "/v2/{resource=projects/*/locations/*/queues/*}:setIamPolicy"
209      body: "*"
210    };
211    option (google.api.method_signature) = "resource,policy";
212  }
213
214  // Returns permissions that a caller has on a
215  // [Queue][google.cloud.tasks.v2.Queue]. If the resource does not exist, this
216  // will return an empty set of permissions, not a
217  // [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.
218  //
219  // Note: This operation is designed to be used for building permission-aware
220  // UIs and command-line tools, not for authorization checking. This operation
221  // may "fail open" without warning.
222  rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
223      returns (google.iam.v1.TestIamPermissionsResponse) {
224    option (google.api.http) = {
225      post: "/v2/{resource=projects/*/locations/*/queues/*}:testIamPermissions"
226      body: "*"
227    };
228    option (google.api.method_signature) = "resource,permissions";
229  }
230
231  // Lists the tasks in a queue.
232  //
233  // By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is
234  // retrieved due to performance considerations;
235  // [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view]
236  // controls the subset of information which is returned.
237  //
238  // The tasks may be returned in any order. The ordering may change at any
239  // time.
240  rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) {
241    option (google.api.http) = {
242      get: "/v2/{parent=projects/*/locations/*/queues/*}/tasks"
243    };
244    option (google.api.method_signature) = "parent";
245  }
246
247  // Gets a task.
248  rpc GetTask(GetTaskRequest) returns (Task) {
249    option (google.api.http) = {
250      get: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}"
251    };
252    option (google.api.method_signature) = "name";
253  }
254
255  // Creates a task and adds it to a queue.
256  //
257  // Tasks cannot be updated after creation; there is no UpdateTask command.
258  //
259  // * The maximum task size is 100KB.
260  rpc CreateTask(CreateTaskRequest) returns (Task) {
261    option (google.api.http) = {
262      post: "/v2/{parent=projects/*/locations/*/queues/*}/tasks"
263      body: "*"
264    };
265    option (google.api.method_signature) = "parent,task";
266  }
267
268  // Deletes a task.
269  //
270  // A task can be deleted if it is scheduled or dispatched. A task
271  // cannot be deleted if it has executed successfully or permanently
272  // failed.
273  rpc DeleteTask(DeleteTaskRequest) returns (google.protobuf.Empty) {
274    option (google.api.http) = {
275      delete: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}"
276    };
277    option (google.api.method_signature) = "name";
278  }
279
280  // Forces a task to run now.
281  //
282  // When this method is called, Cloud Tasks will dispatch the task, even if
283  // the task is already running, the queue has reached its
284  // [RateLimits][google.cloud.tasks.v2.RateLimits] or is
285  // [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].
286  //
287  // This command is meant to be used for manual debugging. For
288  // example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to
289  // retry a failed task after a fix has been made or to manually force a task
290  // to be dispatched now.
291  //
292  // The dispatched task is returned. That is, the task that is returned
293  // contains the [status][Task.status] after the task is dispatched but
294  // before the task is received by its target.
295  //
296  // If Cloud Tasks receives a successful response from the task's
297  // target, then the task will be deleted; otherwise the task's
298  // [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to
299  // the time that [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was
300  // called plus the retry delay specified in the queue's
301  // [RetryConfig][google.cloud.tasks.v2.RetryConfig].
302  //
303  // [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns
304  // [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a
305  // task that has already succeeded or permanently failed.
306  rpc RunTask(RunTaskRequest) returns (Task) {
307    option (google.api.http) = {
308      post: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}:run"
309      body: "*"
310    };
311    option (google.api.method_signature) = "name";
312  }
313}
314
315// Request message for
316// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
317message ListQueuesRequest {
318  // Required. The location name.
319  // For example: `projects/PROJECT_ID/locations/LOCATION_ID`
320  string parent = 1 [
321    (google.api.field_behavior) = REQUIRED,
322    (google.api.resource_reference) = {
323      child_type: "cloudtasks.googleapis.com/Queue"
324    }
325  ];
326
327  // `filter` can be used to specify a subset of queues. Any
328  // [Queue][google.cloud.tasks.v2.Queue] field can be used as a filter and
329  // several operators as supported. For example: `<=, <, >=, >, !=, =, :`. The
330  // filter syntax is the same as described in [Stackdriver's Advanced Logs
331  // Filters](https://cloud.google.com/logging/docs/view/advanced_filters).
332  //
333  // Sample filter "state: PAUSED".
334  //
335  // Note that using filters might cause fewer queues than the
336  // requested page_size to be returned.
337  string filter = 2;
338
339  // Requested page size.
340  //
341  // The maximum page size is 9800. If unspecified, the page size will
342  // be the maximum. Fewer queues than requested might be returned,
343  // even if more queues exist; use the
344  // [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token]
345  // in the response to determine if more queues exist.
346  int32 page_size = 3;
347
348  // A token identifying the page of results to return.
349  //
350  // To request the first page results, page_token must be empty. To
351  // request the next page of results, page_token must be the value of
352  // [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token]
353  // returned from the previous call to
354  // [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] method. It is an
355  // error to switch the value of the
356  // [filter][google.cloud.tasks.v2.ListQueuesRequest.filter] while iterating
357  // through pages.
358  string page_token = 4;
359}
360
361// Response message for
362// [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues].
363message ListQueuesResponse {
364  // The list of queues.
365  repeated Queue queues = 1;
366
367  // A token to retrieve next page of results.
368  //
369  // To return the next page of results, call
370  // [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] with this value
371  // as the [page_token][google.cloud.tasks.v2.ListQueuesRequest.page_token].
372  //
373  // If the next_page_token is empty, there are no more results.
374  //
375  // The page token is valid for only 2 hours.
376  string next_page_token = 2;
377}
378
379// Request message for [GetQueue][google.cloud.tasks.v2.CloudTasks.GetQueue].
380message GetQueueRequest {
381  // Required. The resource name of the queue. For example:
382  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
383  string name = 1 [
384    (google.api.field_behavior) = REQUIRED,
385    (google.api.resource_reference) = {
386      type: "cloudtasks.googleapis.com/Queue"
387    }
388  ];
389}
390
391// Request message for
392// [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue].
393message CreateQueueRequest {
394  // Required. The location name in which the queue will be created.
395  // For example: `projects/PROJECT_ID/locations/LOCATION_ID`
396  //
397  // The list of allowed locations can be obtained by calling Cloud
398  // Tasks' implementation of
399  // [ListLocations][google.cloud.location.Locations.ListLocations].
400  string parent = 1 [
401    (google.api.field_behavior) = REQUIRED,
402    (google.api.resource_reference) = {
403      child_type: "cloudtasks.googleapis.com/Queue"
404    }
405  ];
406
407  // Required. The queue to create.
408  //
409  // [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an
410  // existing queue.
411  Queue queue = 2 [(google.api.field_behavior) = REQUIRED];
412}
413
414// Request message for
415// [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue].
416message UpdateQueueRequest {
417  // Required. The queue to create or update.
418  //
419  // The queue's [name][google.cloud.tasks.v2.Queue.name] must be specified.
420  //
421  // Output only fields cannot be modified using UpdateQueue.
422  // Any value specified for an output only field will be ignored.
423  // The queue's [name][google.cloud.tasks.v2.Queue.name] cannot be changed.
424  Queue queue = 1 [(google.api.field_behavior) = REQUIRED];
425
426  // A mask used to specify which fields of the queue are being updated.
427  //
428  // If empty, then all fields will be updated.
429  google.protobuf.FieldMask update_mask = 2;
430}
431
432// Request message for
433// [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue].
434message DeleteQueueRequest {
435  // Required. The queue name. For example:
436  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
437  string name = 1 [
438    (google.api.field_behavior) = REQUIRED,
439    (google.api.resource_reference) = {
440      type: "cloudtasks.googleapis.com/Queue"
441    }
442  ];
443}
444
445// Request message for
446// [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue].
447message PurgeQueueRequest {
448  // Required. The queue name. For example:
449  // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
450  string name = 1 [
451    (google.api.field_behavior) = REQUIRED,
452    (google.api.resource_reference) = {
453      type: "cloudtasks.googleapis.com/Queue"
454    }
455  ];
456}
457
458// Request message for
459// [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue].
460message PauseQueueRequest {
461  // Required. The queue name. For example:
462  // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
463  string name = 1 [
464    (google.api.field_behavior) = REQUIRED,
465    (google.api.resource_reference) = {
466      type: "cloudtasks.googleapis.com/Queue"
467    }
468  ];
469}
470
471// Request message for
472// [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue].
473message ResumeQueueRequest {
474  // Required. The queue name. For example:
475  // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
476  string name = 1 [
477    (google.api.field_behavior) = REQUIRED,
478    (google.api.resource_reference) = {
479      type: "cloudtasks.googleapis.com/Queue"
480    }
481  ];
482}
483
484// Request message for listing tasks using
485// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
486message ListTasksRequest {
487  // Required. The queue name. For example:
488  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
489  string parent = 1 [
490    (google.api.field_behavior) = REQUIRED,
491    (google.api.resource_reference) = {
492      child_type: "cloudtasks.googleapis.com/Task"
493    }
494  ];
495
496  // The response_view specifies which subset of the
497  // [Task][google.cloud.tasks.v2.Task] will be returned.
498  //
499  // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
500  // not all information is retrieved by default because some data, such as
501  // payloads, might be desirable to return only when needed because
502  // of its large size or because of the sensitivity of data that it
503  // contains.
504  //
505  // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
506  // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
507  // permission on the [Task][google.cloud.tasks.v2.Task] resource.
508  Task.View response_view = 2;
509
510  // Maximum page size.
511  //
512  // Fewer tasks than requested might be returned, even if more tasks exist; use
513  // [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token]
514  // in the response to determine if more tasks exist.
515  //
516  // The maximum page size is 1000. If unspecified, the page size will be the
517  // maximum.
518  int32 page_size = 3;
519
520  // A token identifying the page of results to return.
521  //
522  // To request the first page results, page_token must be empty. To
523  // request the next page of results, page_token must be the value of
524  // [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token]
525  // returned from the previous call to
526  // [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] method.
527  //
528  // The page token is valid for only 2 hours.
529  string page_token = 4;
530}
531
532// Response message for listing tasks using
533// [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks].
534message ListTasksResponse {
535  // The list of tasks.
536  repeated Task tasks = 1;
537
538  // A token to retrieve next page of results.
539  //
540  // To return the next page of results, call
541  // [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] with this value as
542  // the [page_token][google.cloud.tasks.v2.ListTasksRequest.page_token].
543  //
544  // If the next_page_token is empty, there are no more results.
545  string next_page_token = 2;
546}
547
548// Request message for getting a task using
549// [GetTask][google.cloud.tasks.v2.CloudTasks.GetTask].
550message GetTaskRequest {
551  // Required. The task name. For example:
552  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
553  string name = 1 [
554    (google.api.field_behavior) = REQUIRED,
555    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
556  ];
557
558  // The response_view specifies which subset of the
559  // [Task][google.cloud.tasks.v2.Task] will be returned.
560  //
561  // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
562  // not all information is retrieved by default because some data, such as
563  // payloads, might be desirable to return only when needed because
564  // of its large size or because of the sensitivity of data that it
565  // contains.
566  //
567  // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
568  // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
569  // permission on the [Task][google.cloud.tasks.v2.Task] resource.
570  Task.View response_view = 2;
571}
572
573// Request message for
574// [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask].
575message CreateTaskRequest {
576  // Required. The queue name. For example:
577  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
578  //
579  // The queue must already exist.
580  string parent = 1 [
581    (google.api.field_behavior) = REQUIRED,
582    (google.api.resource_reference) = {
583      child_type: "cloudtasks.googleapis.com/Task"
584    }
585  ];
586
587  // Required. The task to add.
588  //
589  // Task names have the following format:
590  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
591  // The user can optionally specify a task
592  // [name][google.cloud.tasks.v2.Task.name]. If a name is not specified then
593  // the system will generate a random unique task id, which will be set in the
594  // task returned in the [response][google.cloud.tasks.v2.Task.name].
595  //
596  // If [schedule_time][google.cloud.tasks.v2.Task.schedule_time] is not set or
597  // is in the past then Cloud Tasks will set it to the current time.
598  //
599  // Task De-duplication:
600  //
601  // Explicitly specifying a task ID enables task de-duplication.  If
602  // a task's ID is identical to that of an existing task or a task
603  // that was deleted or executed recently then the call will fail
604  // with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS].
605  // If the task's queue was created using Cloud Tasks, then another task with
606  // the same name can't be created for ~1hour after the original task was
607  // deleted or executed. If the task's queue was created using queue.yaml or
608  // queue.xml, then another task with the same name can't be created
609  // for ~9days after the original task was deleted or executed.
610  //
611  // Because there is an extra lookup cost to identify duplicate task
612  // names, these [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask]
613  // calls have significantly increased latency. Using hashed strings for the
614  // task id or for the prefix of the task id is recommended. Choosing task ids
615  // that are sequential or have sequential prefixes, for example using a
616  // timestamp, causes an increase in latency and error rates in all
617  // task commands. The infrastructure relies on an approximately
618  // uniform distribution of task ids to store and serve tasks
619  // efficiently.
620  Task task = 2 [(google.api.field_behavior) = REQUIRED];
621
622  // The response_view specifies which subset of the
623  // [Task][google.cloud.tasks.v2.Task] will be returned.
624  //
625  // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
626  // not all information is retrieved by default because some data, such as
627  // payloads, might be desirable to return only when needed because
628  // of its large size or because of the sensitivity of data that it
629  // contains.
630  //
631  // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
632  // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
633  // permission on the [Task][google.cloud.tasks.v2.Task] resource.
634  Task.View response_view = 3;
635}
636
637// Request message for deleting a task using
638// [DeleteTask][google.cloud.tasks.v2.CloudTasks.DeleteTask].
639message DeleteTaskRequest {
640  // Required. The task name. For example:
641  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
642  string name = 1 [
643    (google.api.field_behavior) = REQUIRED,
644    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
645  ];
646}
647
648// Request message for forcing a task to run now using
649// [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask].
650message RunTaskRequest {
651  // Required. The task name. For example:
652  // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
653  string name = 1 [
654    (google.api.field_behavior) = REQUIRED,
655    (google.api.resource_reference) = { type: "cloudtasks.googleapis.com/Task" }
656  ];
657
658  // The response_view specifies which subset of the
659  // [Task][google.cloud.tasks.v2.Task] will be returned.
660  //
661  // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC];
662  // not all information is retrieved by default because some data, such as
663  // payloads, might be desirable to return only when needed because
664  // of its large size or because of the sensitivity of data that it
665  // contains.
666  //
667  // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires
668  // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
669  // permission on the [Task][google.cloud.tasks.v2.Task] resource.
670  Task.View response_view = 2;
671}
672