task.proto 7.2 KB

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