task.proto 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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.v2beta3;
  16. import "google/api/resource.proto";
  17. import "google/cloud/tasks/v2beta3/target.proto";
  18. import "google/protobuf/duration.proto";
  19. import "google/protobuf/timestamp.proto";
  20. import "google/rpc/status.proto";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "TaskProto";
  24. option java_package = "com.google.cloud.tasks.v2beta3";
  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.v2beta3.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. // [body in AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest.body].
  46. // Bodies are desirable to return only when needed, because they
  47. // can be large and because of the sensitivity of the data that you
  48. // choose to store in it.
  49. BASIC = 1;
  50. // All information is returned.
  51. //
  52. // Authorization for [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] requires
  53. // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
  54. // permission on the [Queue][google.cloud.tasks.v2beta3.Queue] resource.
  55. FULL = 2;
  56. }
  57. // Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta3.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. The message to send to the worker.
  79. oneof payload_type {
  80. // HTTP request that is sent to the App Engine app handler.
  81. //
  82. // An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] set.
  83. AppEngineHttpRequest app_engine_http_request = 3;
  84. // HTTP request that is sent to the task's target.
  85. //
  86. // An HTTP task is a task that has [HttpRequest][google.cloud.tasks.v2beta3.HttpRequest] set.
  87. HttpRequest http_request = 11;
  88. // Pull Message contained in a task in a [PULL][google.cloud.tasks.v2beta3.Queue.type] queue type. This
  89. // payload type cannot be explicitly set through Cloud Tasks API. Its
  90. // purpose, currently is to provide backward compatibility with App Engine
  91. // Task Queue
  92. // [pull](https://cloud.google.com/appengine/docs/standard/java/taskqueue/pull/)
  93. // queues to provide a way to inspect contents of pull tasks through the
  94. // [CloudTasks.GetTask][google.cloud.tasks.v2beta3.CloudTasks.GetTask].
  95. PullMessage pull_message = 13;
  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. // `schedule_time` will be truncated to the nearest microsecond.
  102. google.protobuf.Timestamp schedule_time = 4;
  103. // Output only. The time that the task was created.
  104. //
  105. // `create_time` will be truncated to the nearest second.
  106. google.protobuf.Timestamp create_time = 5;
  107. // The deadline for requests sent to the worker. If the worker does not
  108. // respond by this deadline then the request is cancelled and the attempt
  109. // is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the
  110. // task according to the [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig].
  111. //
  112. // Note that when the request is cancelled, Cloud Tasks will stop listening
  113. // for the response, but whether the worker stops processing depends on the
  114. // worker. For example, if the worker is stuck, it may not react to cancelled
  115. // requests.
  116. //
  117. // The default and maximum values depend on the type of request:
  118. //
  119. // * For [HTTP tasks][google.cloud.tasks.v2beta3.HttpRequest], the default is 10 minutes. The deadline
  120. // must be in the interval [15 seconds, 30 minutes].
  121. //
  122. // * For [App Engine tasks][google.cloud.tasks.v2beta3.AppEngineHttpRequest], 0 indicates that the
  123. // request has the default deadline. The default deadline depends on the
  124. // [scaling
  125. // type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling)
  126. // of the service: 10 minutes for standard apps with automatic scaling, 24
  127. // hours for standard apps with manual and basic scaling, and 60 minutes for
  128. // flex apps. If the request deadline is set, it must be in the interval [15
  129. // seconds, 24 hours 15 seconds]. Regardless of the task's
  130. // `dispatch_deadline`, the app handler will not run for longer than than
  131. // the service's timeout. We recommend setting the `dispatch_deadline` to
  132. // at most a few seconds more than the app handler's timeout. For more
  133. // information see
  134. // [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts).
  135. //
  136. // `dispatch_deadline` will be truncated to the nearest millisecond. The
  137. // deadline is an approximate deadline.
  138. google.protobuf.Duration dispatch_deadline = 12;
  139. // Output only. The number of attempts dispatched.
  140. //
  141. // This count includes attempts which have been dispatched but haven't
  142. // received a response.
  143. int32 dispatch_count = 6;
  144. // Output only. The number of attempts which have received a response.
  145. int32 response_count = 7;
  146. // Output only. The status of the task's first attempt.
  147. //
  148. // Only [dispatch_time][google.cloud.tasks.v2beta3.Attempt.dispatch_time] will be set.
  149. // The other [Attempt][google.cloud.tasks.v2beta3.Attempt] information is not retained by Cloud Tasks.
  150. Attempt first_attempt = 8;
  151. // Output only. The status of the task's last attempt.
  152. Attempt last_attempt = 9;
  153. // Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta3.Task] has
  154. // been returned.
  155. View view = 10;
  156. }
  157. // The status of a task attempt.
  158. message Attempt {
  159. // Output only. The time that this attempt was scheduled.
  160. //
  161. // `schedule_time` will be truncated to the nearest microsecond.
  162. google.protobuf.Timestamp schedule_time = 1;
  163. // Output only. The time that this attempt was dispatched.
  164. //
  165. // `dispatch_time` will be truncated to the nearest microsecond.
  166. google.protobuf.Timestamp dispatch_time = 2;
  167. // Output only. The time that this attempt response was received.
  168. //
  169. // `response_time` will be truncated to the nearest microsecond.
  170. google.protobuf.Timestamp response_time = 3;
  171. // Output only. The response from the worker for this attempt.
  172. //
  173. // If `response_time` is unset, then the task has not been attempted or is
  174. // currently running and the `response_status` field is meaningless.
  175. google.rpc.Status response_status = 4;
  176. }