cloudtasks.proto 39 KB

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