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