1// Copyright 2023 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/resource.proto"; 20import "google/cloud/tasks/v2beta3/target.proto"; 21import "google/protobuf/duration.proto"; 22import "google/protobuf/timestamp.proto"; 23import "google/rpc/status.proto"; 24 25option go_package = "cloud.google.com/go/cloudtasks/apiv2beta3/cloudtaskspb;cloudtaskspb"; 26option java_multiple_files = true; 27option java_outer_classname = "TaskProto"; 28option java_package = "com.google.cloud.tasks.v2beta3"; 29 30// A unit of scheduled work. 31message Task { 32 option (google.api.resource) = { 33 type: "cloudtasks.googleapis.com/Task" 34 pattern: "projects/{project}/locations/{location}/queues/{queue}/tasks/{task}" 35 }; 36 37 // The view specifies a subset of [Task][google.cloud.tasks.v2beta3.Task] 38 // data. 39 // 40 // When a task is returned in a response, not all 41 // information is retrieved by default because some data, such as 42 // payloads, might be desirable to return only when needed because 43 // of its large size or because of the sensitivity of data that it 44 // contains. 45 enum View { 46 // Unspecified. Defaults to BASIC. 47 VIEW_UNSPECIFIED = 0; 48 49 // The basic view omits fields which can be large or can contain 50 // sensitive data. 51 // 52 // This view does not include the 53 // [body in 54 // AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest.body]. 55 // Bodies are desirable to return only when needed, because they 56 // can be large and because of the sensitivity of the data that you 57 // choose to store in it. 58 BASIC = 1; 59 60 // All information is returned. 61 // 62 // Authorization for [FULL][google.cloud.tasks.v2beta3.Task.View.FULL] 63 // requires `cloudtasks.tasks.fullView` [Google 64 // IAM](https://cloud.google.com/iam/) permission on the 65 // [Queue][google.cloud.tasks.v2beta3.Queue] resource. 66 FULL = 2; 67 } 68 69 // Optionally caller-specified in 70 // [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. 71 // 72 // The task name. 73 // 74 // The task name must have the following format: 75 // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 76 // 77 // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 78 // hyphens (-), colons (:), or periods (.). 79 // For more information, see 80 // [Identifying 81 // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 82 // * `LOCATION_ID` is the canonical ID for the task's location. 83 // The list of available locations can be obtained by calling 84 // [ListLocations][google.cloud.location.Locations.ListLocations]. 85 // For more information, see https://cloud.google.com/about/locations/. 86 // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 87 // hyphens (-). The maximum length is 100 characters. 88 // * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 89 // hyphens (-), or underscores (_). The maximum length is 500 characters. 90 string name = 1; 91 92 // Required. The message to send to the worker. 93 oneof payload_type { 94 // HTTP request that is sent to the App Engine app handler. 95 // 96 // An App Engine task is a task that has 97 // [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] 98 // set. 99 AppEngineHttpRequest app_engine_http_request = 3; 100 101 // HTTP request that is sent to the task's target. 102 // 103 // An HTTP task is a task that has 104 // [HttpRequest][google.cloud.tasks.v2beta3.HttpRequest] set. 105 HttpRequest http_request = 11; 106 107 // Pull Message contained in a task in a 108 // [PULL][google.cloud.tasks.v2beta3.Queue.type] queue type. This payload 109 // type cannot be explicitly set through Cloud Tasks API. Its purpose, 110 // currently is to provide backward compatibility with App Engine Task Queue 111 // [pull](https://cloud.google.com/appengine/docs/standard/java/taskqueue/pull/) 112 // queues to provide a way to inspect contents of pull tasks through the 113 // [CloudTasks.GetTask][google.cloud.tasks.v2beta3.CloudTasks.GetTask]. 114 PullMessage pull_message = 13; 115 } 116 117 // The time when the task is scheduled to be attempted. 118 // 119 // For App Engine queues, this is when the task will be attempted or retried. 120 // 121 // `schedule_time` will be truncated to the nearest microsecond. 122 google.protobuf.Timestamp schedule_time = 4; 123 124 // Output only. The time that the task was created. 125 // 126 // `create_time` will be truncated to the nearest second. 127 google.protobuf.Timestamp create_time = 5; 128 129 // The deadline for requests sent to the worker. If the worker does not 130 // respond by this deadline then the request is cancelled and the attempt 131 // is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the 132 // task according to the 133 // [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig]. 134 // 135 // Note that when the request is cancelled, Cloud Tasks will stop listening 136 // for the response, but whether the worker stops processing depends on the 137 // worker. For example, if the worker is stuck, it may not react to cancelled 138 // requests. 139 // 140 // The default and maximum values depend on the type of request: 141 // 142 // * For [HTTP tasks][google.cloud.tasks.v2beta3.HttpRequest], the default is 143 // 10 minutes. The deadline 144 // must be in the interval [15 seconds, 30 minutes]. 145 // 146 // * For [App Engine tasks][google.cloud.tasks.v2beta3.AppEngineHttpRequest], 147 // 0 indicates that the 148 // request has the default deadline. The default deadline depends on the 149 // [scaling 150 // type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling) 151 // of the service: 10 minutes for standard apps with automatic scaling, 24 152 // hours for standard apps with manual and basic scaling, and 60 minutes for 153 // flex apps. If the request deadline is set, it must be in the interval [15 154 // seconds, 24 hours 15 seconds]. Regardless of the task's 155 // `dispatch_deadline`, the app handler will not run for longer than than 156 // the service's timeout. We recommend setting the `dispatch_deadline` to 157 // at most a few seconds more than the app handler's timeout. For more 158 // information see 159 // [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts). 160 // 161 // `dispatch_deadline` will be truncated to the nearest millisecond. The 162 // deadline is an approximate deadline. 163 google.protobuf.Duration dispatch_deadline = 12; 164 165 // Output only. The number of attempts dispatched. 166 // 167 // This count includes attempts which have been dispatched but haven't 168 // received a response. 169 int32 dispatch_count = 6; 170 171 // Output only. The number of attempts which have received a response. 172 int32 response_count = 7; 173 174 // Output only. The status of the task's first attempt. 175 // 176 // Only [dispatch_time][google.cloud.tasks.v2beta3.Attempt.dispatch_time] will 177 // be set. The other [Attempt][google.cloud.tasks.v2beta3.Attempt] information 178 // is not retained by Cloud Tasks. 179 Attempt first_attempt = 8; 180 181 // Output only. The status of the task's last attempt. 182 Attempt last_attempt = 9; 183 184 // Output only. The view specifies which subset of the 185 // [Task][google.cloud.tasks.v2beta3.Task] has been returned. 186 View view = 10; 187} 188 189// The status of a task attempt. 190message Attempt { 191 // Output only. The time that this attempt was scheduled. 192 // 193 // `schedule_time` will be truncated to the nearest microsecond. 194 google.protobuf.Timestamp schedule_time = 1; 195 196 // Output only. The time that this attempt was dispatched. 197 // 198 // `dispatch_time` will be truncated to the nearest microsecond. 199 google.protobuf.Timestamp dispatch_time = 2; 200 201 // Output only. The time that this attempt response was received. 202 // 203 // `response_time` will be truncated to the nearest microsecond. 204 google.protobuf.Timestamp response_time = 3; 205 206 // Output only. The response from the worker for this attempt. 207 // 208 // If `response_time` is unset, then the task has not been attempted or is 209 // currently running and the `response_status` field is meaningless. 210 google.rpc.Status response_status = 4; 211} 212