task.proto 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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/resource.proto";
  17. import "google/cloud/tasks/v2beta2/target.proto";
  18. import "google/protobuf/timestamp.proto";
  19. import "google/rpc/status.proto";
  20. import "google/api/annotations.proto";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2;tasks";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "TaskProto";
  24. option java_package = "com.google.cloud.tasks.v2beta2";
  25. // A unit of scheduled work.
  26. message Task {
  27. option (google.api.resource) = {
  28. type: "cloudtasks.googleapis.com/Task"
  29. pattern: "projects/{project}/locations/{location}/queues/{queue}/tasks/{task}"
  30. };
  31. // The view specifies a subset of [Task][google.cloud.tasks.v2beta2.Task] data.
  32. //
  33. // When a task is returned in a response, not all
  34. // information is retrieved by default because some data, such as
  35. // payloads, might be desirable to return only when needed because
  36. // of its large size or because of the sensitivity of data that it
  37. // contains.
  38. enum View {
  39. // Unspecified. Defaults to BASIC.
  40. VIEW_UNSPECIFIED = 0;
  41. // The basic view omits fields which can be large or can contain
  42. // sensitive data.
  43. //
  44. // This view does not include the
  45. // ([payload in AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] and
  46. // [payload in PullMessage][google.cloud.tasks.v2beta2.PullMessage.payload]). These payloads are
  47. // desirable to return only when needed, because they can be large
  48. // and because of the sensitivity of the data that you choose to
  49. // store in it.
  50. BASIC = 1;
  51. // All information is returned.
  52. //
  53. // Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires
  54. // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
  55. // permission on the [Queue][google.cloud.tasks.v2beta2.Queue] resource.
  56. FULL = 2;
  57. }
  58. // Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
  59. //
  60. // The task name.
  61. //
  62. // The task name must have the following format:
  63. // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
  64. //
  65. // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
  66. // hyphens (-), colons (:), or periods (.).
  67. // For more information, see
  68. // [Identifying
  69. // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
  70. // * `LOCATION_ID` is the canonical ID for the task's location.
  71. // The list of available locations can be obtained by calling
  72. // [ListLocations][google.cloud.location.Locations.ListLocations].
  73. // For more information, see https://cloud.google.com/about/locations/.
  74. // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
  75. // hyphens (-). The maximum length is 100 characters.
  76. // * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
  77. // hyphens (-), or underscores (_). The maximum length is 500 characters.
  78. string name = 1;
  79. // Required.
  80. //
  81. // The task's payload is used by the task's target to process the task.
  82. // A payload is valid only if it is compatible with the queue's target.
  83. oneof payload_type {
  84. // App Engine HTTP request that is sent to the task's target. Can
  85. // be set only if
  86. // [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
  87. // on the queue.
  88. //
  89. // An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
  90. AppEngineHttpRequest app_engine_http_request = 3;
  91. // [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
  92. // set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
  93. //
  94. // A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
  95. PullMessage pull_message = 4;
  96. }
  97. // The time when the task is scheduled to be attempted.
  98. //
  99. // For App Engine queues, this is when the task will be attempted or retried.
  100. //
  101. // For pull queues, this is the time when the task is available to
  102. // be leased; if a task is currently leased, this is the time when
  103. // the current lease expires, that is, the time that the task was
  104. // leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
  105. //
  106. // `schedule_time` will be truncated to the nearest microsecond.
  107. google.protobuf.Timestamp schedule_time = 5;
  108. // Output only. The time that the task was created.
  109. //
  110. // `create_time` will be truncated to the nearest second.
  111. google.protobuf.Timestamp create_time = 6;
  112. // Output only. The task status.
  113. TaskStatus status = 7;
  114. // Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has
  115. // been returned.
  116. View view = 8;
  117. }
  118. // Status of the task.
  119. message TaskStatus {
  120. // Output only. The number of attempts dispatched.
  121. //
  122. // This count includes attempts which have been dispatched but haven't
  123. // received a response.
  124. int32 attempt_dispatch_count = 1;
  125. // Output only. The number of attempts which have received a response.
  126. //
  127. // This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage].
  128. int32 attempt_response_count = 2;
  129. // Output only. The status of the task's first attempt.
  130. //
  131. // Only [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time] will be set.
  132. // The other [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is not retained by Cloud Tasks.
  133. //
  134. // This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage].
  135. AttemptStatus first_attempt_status = 3;
  136. // Output only. The status of the task's last attempt.
  137. //
  138. // This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage].
  139. AttemptStatus last_attempt_status = 4;
  140. }
  141. // The status of a task attempt.
  142. message AttemptStatus {
  143. // Output only. The time that this attempt was scheduled.
  144. //
  145. // `schedule_time` will be truncated to the nearest microsecond.
  146. google.protobuf.Timestamp schedule_time = 1;
  147. // Output only. The time that this attempt was dispatched.
  148. //
  149. // `dispatch_time` will be truncated to the nearest microsecond.
  150. google.protobuf.Timestamp dispatch_time = 2;
  151. // Output only. The time that this attempt response was received.
  152. //
  153. // `response_time` will be truncated to the nearest microsecond.
  154. google.protobuf.Timestamp response_time = 3;
  155. // Output only. The response from the target for this attempt.
  156. //
  157. // If the task has not been attempted or the task is currently running
  158. // then the response status is unset.
  159. google.rpc.Status response_status = 4;
  160. }