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