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