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.run.v2; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/run/v2/condition.proto"; 24import "google/cloud/run/v2/k8s.min.proto"; 25import "google/cloud/run/v2/vendor_settings.proto"; 26import "google/protobuf/duration.proto"; 27import "google/protobuf/timestamp.proto"; 28import "google/rpc/status.proto"; 29 30option go_package = "cloud.google.com/go/run/apiv2/runpb;runpb"; 31option java_multiple_files = true; 32option java_outer_classname = "TaskProto"; 33option java_package = "com.google.cloud.run.v2"; 34 35// Cloud Run Task Control Plane API. 36service Tasks { 37 option (google.api.default_host) = "run.googleapis.com"; 38 option (google.api.oauth_scopes) = 39 "https://www.googleapis.com/auth/cloud-platform"; 40 41 // Gets information about a Task. 42 rpc GetTask(GetTaskRequest) returns (Task) { 43 option (google.api.http) = { 44 get: "/v2/{name=projects/*/locations/*/jobs/*/executions/*/tasks/*}" 45 }; 46 option (google.api.method_signature) = "name"; 47 } 48 49 // Lists Tasks from an Execution of a Job. 50 rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) { 51 option (google.api.http) = { 52 get: "/v2/{parent=projects/*/locations/*/jobs/*/executions/*}/tasks" 53 }; 54 option (google.api.method_signature) = "parent"; 55 } 56} 57 58// Request message for obtaining a Task by its full name. 59message GetTaskRequest { 60 // Required. The full name of the Task. 61 // Format: 62 // projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task} 63 string name = 1 [ 64 (google.api.field_behavior) = REQUIRED, 65 (google.api.resource_reference) = { type: "run.googleapis.com/Task" } 66 ]; 67} 68 69// Request message for retrieving a list of Tasks. 70message ListTasksRequest { 71 // Required. The Execution from which the Tasks should be listed. 72 // To list all Tasks across Executions of a Job, use "-" instead of Execution 73 // name. To list all Tasks across Jobs, use "-" instead of Job name. Format: 74 // projects/{project}/locations/{location}/jobs/{job}/executions/{execution} 75 string parent = 1 [ 76 (google.api.field_behavior) = REQUIRED, 77 (google.api.resource_reference) = { child_type: "run.googleapis.com/Task" } 78 ]; 79 80 // Maximum number of Tasks to return in this call. 81 int32 page_size = 2; 82 83 // A page token received from a previous call to ListTasks. 84 // All other parameters must match. 85 string page_token = 3; 86 87 // If true, returns deleted (but unexpired) resources along with active ones. 88 bool show_deleted = 4; 89} 90 91// Response message containing a list of Tasks. 92message ListTasksResponse { 93 // The resulting list of Tasks. 94 repeated Task tasks = 1; 95 96 // A token indicating there are more items than page_size. Use it in the next 97 // ListTasks request to continue. 98 string next_page_token = 2; 99} 100 101// Task represents a single run of a container to completion. 102message Task { 103 option (google.api.resource) = { 104 type: "run.googleapis.com/Task" 105 pattern: "projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}" 106 style: DECLARATIVE_FRIENDLY 107 }; 108 109 // Output only. The unique name of this Task. 110 string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 111 112 // Output only. Server assigned unique identifier for the Task. The value is a 113 // UUID4 string and guaranteed to remain unchanged until the resource is 114 // deleted. 115 string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 116 117 // Output only. A number that monotonically increases every time the user 118 // modifies the desired state. 119 int64 generation = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 120 121 // Output only. Unstructured key value map that can be used to organize and 122 // categorize objects. User-provided labels are shared with Google's billing 123 // system, so they can be used to filter, or break down billing charges by 124 // team, component, environment, state, etc. For more information, visit 125 // https://cloud.google.com/resource-manager/docs/creating-managing-labels or 126 // https://cloud.google.com/run/docs/configuring/labels 127 map<string, string> labels = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 128 129 // Output only. Unstructured key value map that may 130 // be set by external tools to store and arbitrary metadata. 131 // They are not queryable and should be preserved 132 // when modifying objects. 133 map<string, string> annotations = 5 134 [(google.api.field_behavior) = OUTPUT_ONLY]; 135 136 // Output only. Represents time when the task was created by the system. 137 // It is not guaranteed to be set in happens-before order across separate 138 // operations. 139 google.protobuf.Timestamp create_time = 6 140 [(google.api.field_behavior) = OUTPUT_ONLY]; 141 142 // Output only. Represents time when the task was scheduled to run by the 143 // system. It is not guaranteed to be set in happens-before order across 144 // separate operations. 145 google.protobuf.Timestamp scheduled_time = 34 146 [(google.api.field_behavior) = OUTPUT_ONLY]; 147 148 // Output only. Represents time when the task started to run. 149 // It is not guaranteed to be set in happens-before order across separate 150 // operations. 151 google.protobuf.Timestamp start_time = 27 152 [(google.api.field_behavior) = OUTPUT_ONLY]; 153 154 // Output only. Represents time when the Task was completed. It is not 155 // guaranteed to be set in happens-before order across separate operations. 156 google.protobuf.Timestamp completion_time = 7 157 [(google.api.field_behavior) = OUTPUT_ONLY]; 158 159 // Output only. The last-modified time. 160 google.protobuf.Timestamp update_time = 8 161 [(google.api.field_behavior) = OUTPUT_ONLY]; 162 163 // Output only. For a deleted resource, the deletion time. It is only 164 // populated as a response to a Delete request. 165 google.protobuf.Timestamp delete_time = 9 166 [(google.api.field_behavior) = OUTPUT_ONLY]; 167 168 // Output only. For a deleted resource, the time after which it will be 169 // permamently deleted. It is only populated as a response to a Delete 170 // request. 171 google.protobuf.Timestamp expire_time = 10 172 [(google.api.field_behavior) = OUTPUT_ONLY]; 173 174 // Output only. The name of the parent Job. 175 string job = 12 [ 176 (google.api.field_behavior) = OUTPUT_ONLY, 177 (google.api.resource_reference) = { type: "run.googleapis.com/Job" } 178 ]; 179 180 // Output only. The name of the parent Execution. 181 string execution = 13 [ 182 (google.api.field_behavior) = OUTPUT_ONLY, 183 (google.api.resource_reference) = { type: "run.googleapis.com/Execution" } 184 ]; 185 186 // Holds the single container that defines the unit of execution for this 187 // task. 188 repeated Container containers = 14; 189 190 // A list of Volumes to make available to containers. 191 repeated Volume volumes = 15; 192 193 // Number of retries allowed per Task, before marking this Task failed. 194 int32 max_retries = 16; 195 196 // Max allowed time duration the Task may be active before the system will 197 // actively try to mark it failed and kill associated containers. This applies 198 // per attempt of a task, meaning each retry can run for the full timeout. 199 google.protobuf.Duration timeout = 17; 200 201 // Email address of the IAM service account associated with the Task of a 202 // Job. The service account represents the identity of the 203 // running task, and determines what permissions the task has. If 204 // not provided, the task will use the project's default service account. 205 string service_account = 18; 206 207 // The execution environment being used to host this Task. 208 ExecutionEnvironment execution_environment = 20; 209 210 // Output only. Indicates whether the resource's reconciliation is still in 211 // progress. See comments in `Job.reconciling` for additional information on 212 // reconciliation process in Cloud Run. 213 bool reconciling = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; 214 215 // Output only. The Condition of this Task, containing its readiness status, 216 // and detailed error information in case it did not reach the desired state. 217 repeated Condition conditions = 22 218 [(google.api.field_behavior) = OUTPUT_ONLY]; 219 220 // Output only. The generation of this Task. See comments in `Job.reconciling` 221 // for additional information on reconciliation process in Cloud Run. 222 int64 observed_generation = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; 223 224 // Output only. Index of the Task, unique per execution, and beginning at 0. 225 int32 index = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; 226 227 // Output only. The number of times this Task was retried. 228 // Tasks are retried when they fail up to the maxRetries limit. 229 int32 retried = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; 230 231 // Output only. Result of the last attempt of this Task. 232 TaskAttemptResult last_attempt_result = 26 233 [(google.api.field_behavior) = OUTPUT_ONLY]; 234 235 // Output only. A reference to a customer managed encryption key (CMEK) to use 236 // to encrypt this container image. For more information, go to 237 // https://cloud.google.com/run/docs/securing/using-cmek 238 string encryption_key = 28 [ 239 (google.api.field_behavior) = OUTPUT_ONLY, 240 (google.api.resource_reference) = { 241 type: "cloudkms.googleapis.com/CryptoKey" 242 } 243 ]; 244 245 // Output only. VPC Access configuration to use for this Task. For more 246 // information, visit 247 // https://cloud.google.com/run/docs/configuring/connecting-vpc. 248 VpcAccess vpc_access = 29 [(google.api.field_behavior) = OUTPUT_ONLY]; 249 250 // Output only. URI where logs for this execution can be found in Cloud 251 // Console. 252 string log_uri = 32 [(google.api.field_behavior) = OUTPUT_ONLY]; 253 254 // Output only. Reserved for future use. 255 bool satisfies_pzs = 33 [(google.api.field_behavior) = OUTPUT_ONLY]; 256 257 // Output only. A system-generated fingerprint for this version of the 258 // resource. May be used to detect modification conflict during updates. 259 string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY]; 260} 261 262// Result of a task attempt. 263message TaskAttemptResult { 264 // Output only. The status of this attempt. 265 // If the status code is OK, then the attempt succeeded. 266 google.rpc.Status status = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 267 268 // Output only. The exit code of this attempt. 269 // This may be unset if the container was unable to exit cleanly with a code 270 // due to some other failure. 271 // See status field for possible failure details. 272 int32 exit_code = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 273} 274