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.batch.v1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/field_info.proto"; 23import "google/api/resource.proto"; 24import "google/cloud/batch/v1/job.proto"; 25import "google/cloud/batch/v1/task.proto"; 26import "google/longrunning/operations.proto"; 27import "google/protobuf/empty.proto"; 28import "google/protobuf/timestamp.proto"; 29 30option csharp_namespace = "Google.Cloud.Batch.V1"; 31option go_package = "cloud.google.com/go/batch/apiv1/batchpb;batchpb"; 32option java_multiple_files = true; 33option java_outer_classname = "BatchProto"; 34option java_package = "com.google.cloud.batch.v1"; 35option objc_class_prefix = "GCB"; 36option php_namespace = "Google\\Cloud\\Batch\\V1"; 37option ruby_package = "Google::Cloud::Batch::V1"; 38 39// Google Batch Service. 40// The service manages user submitted batch jobs and allocates Google Compute 41// Engine VM instances to run the jobs. 42service BatchService { 43 option (google.api.default_host) = "batch.googleapis.com"; 44 option (google.api.oauth_scopes) = 45 "https://www.googleapis.com/auth/cloud-platform"; 46 47 // Create a Job. 48 rpc CreateJob(CreateJobRequest) returns (Job) { 49 option (google.api.http) = { 50 post: "/v1/{parent=projects/*/locations/*}/jobs" 51 body: "job" 52 }; 53 option (google.api.method_signature) = "parent,job,job_id"; 54 } 55 56 // Get a Job specified by its resource name. 57 rpc GetJob(GetJobRequest) returns (Job) { 58 option (google.api.http) = { 59 get: "/v1/{name=projects/*/locations/*/jobs/*}" 60 }; 61 option (google.api.method_signature) = "name"; 62 } 63 64 // Delete a Job. 65 rpc DeleteJob(DeleteJobRequest) returns (google.longrunning.Operation) { 66 option (google.api.http) = { 67 delete: "/v1/{name=projects/*/locations/*/jobs/*}" 68 }; 69 option (google.api.method_signature) = "name"; 70 option (google.longrunning.operation_info) = { 71 response_type: "google.protobuf.Empty" 72 metadata_type: "google.cloud.batch.v1.OperationMetadata" 73 }; 74 } 75 76 // List all Jobs for a project within a region. 77 rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { 78 option (google.api.http) = { 79 get: "/v1/{parent=projects/*/locations/*}/jobs" 80 }; 81 option (google.api.method_signature) = "parent"; 82 } 83 84 // Return a single Task. 85 rpc GetTask(GetTaskRequest) returns (Task) { 86 option (google.api.http) = { 87 get: "/v1/{name=projects/*/locations/*/jobs/*/taskGroups/*/tasks/*}" 88 }; 89 option (google.api.method_signature) = "name"; 90 } 91 92 // List Tasks associated with a job. 93 rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) { 94 option (google.api.http) = { 95 get: "/v1/{parent=projects/*/locations/*/jobs/*/taskGroups/*}/tasks" 96 }; 97 option (google.api.method_signature) = "parent"; 98 } 99} 100 101// CreateJob Request. 102message CreateJobRequest { 103 // Required. The parent resource name where the Job will be created. 104 // Pattern: "projects/{project}/locations/{location}" 105 string parent = 1 [ 106 (google.api.field_behavior) = REQUIRED, 107 (google.api.resource_reference) = { child_type: "batch.googleapis.com/Job" } 108 ]; 109 110 // ID used to uniquely identify the Job within its parent scope. 111 // This field should contain at most 63 characters and must start with 112 // lowercase characters. 113 // Only lowercase characters, numbers and '-' are accepted. 114 // The '-' character cannot be the first or the last one. 115 // A system generated ID will be used if the field is not set. 116 // 117 // The job.name field in the request will be ignored and the created resource 118 // name of the Job will be "{parent}/jobs/{job_id}". 119 string job_id = 2; 120 121 // Required. The Job to create. 122 Job job = 3 [(google.api.field_behavior) = REQUIRED]; 123 124 // Optional. An optional request ID to identify requests. Specify a unique 125 // request ID so that if you must retry your request, the server will know to 126 // ignore the request if it has already been completed. The server will 127 // guarantee that for at least 60 minutes since the first request. 128 // 129 // For example, consider a situation where you make an initial request and 130 // the request times out. If you make the request again with the same request 131 // ID, the server can check if original operation with the same request ID 132 // was received, and if so, will ignore the second request. This prevents 133 // clients from accidentally creating duplicate commitments. 134 // 135 // The request ID must be a valid UUID with the exception that zero UUID is 136 // not supported (00000000-0000-0000-0000-000000000000). 137 string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; 138} 139 140// GetJob Request. 141message GetJobRequest { 142 // Required. Job name. 143 string name = 1 [ 144 (google.api.field_behavior) = REQUIRED, 145 (google.api.resource_reference) = { type: "batch.googleapis.com/Job" } 146 ]; 147} 148 149// DeleteJob Request. 150message DeleteJobRequest { 151 // Job name. 152 string name = 1; 153 154 // Optional. Reason for this deletion. 155 string reason = 2 [(google.api.field_behavior) = OPTIONAL]; 156 157 // Optional. An optional request ID to identify requests. Specify a unique 158 // request ID so that if you must retry your request, the server will know to 159 // ignore the request if it has already been completed. The server will 160 // guarantee that for at least 60 minutes after the first request. 161 // 162 // For example, consider a situation where you make an initial request and 163 // the request times out. If you make the request again with the same request 164 // ID, the server can check if original operation with the same request ID 165 // was received, and if so, will ignore the second request. This prevents 166 // clients from accidentally creating duplicate commitments. 167 // 168 // The request ID must be a valid UUID with the exception that zero UUID is 169 // not supported (00000000-0000-0000-0000-000000000000). 170 string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; 171} 172 173// ListJob Request. 174message ListJobsRequest { 175 // Parent path. 176 string parent = 1; 177 178 // List filter. 179 string filter = 4; 180 181 // Optional. Sort results. Supported are "name", "name desc", "create_time", 182 // and "create_time desc". 183 string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; 184 185 // Page size. 186 int32 page_size = 2; 187 188 // Page token. 189 string page_token = 3; 190} 191 192// ListJob Response. 193message ListJobsResponse { 194 // Jobs. 195 repeated Job jobs = 1; 196 197 // Next page token. 198 string next_page_token = 2; 199 200 // Locations that could not be reached. 201 repeated string unreachable = 3; 202} 203 204// ListTasks Request. 205message ListTasksRequest { 206 // Required. Name of a TaskGroup from which Tasks are being requested. 207 // Pattern: 208 // "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}" 209 string parent = 1 [ 210 (google.api.field_behavior) = REQUIRED, 211 (google.api.resource_reference) = { type: "batch.googleapis.com/TaskGroup" } 212 ]; 213 214 // Task filter, null filter matches all Tasks. 215 // Filter string should be of the format State=TaskStatus.State e.g. 216 // State=RUNNING 217 string filter = 2; 218 219 // Page size. 220 int32 page_size = 3; 221 222 // Page token. 223 string page_token = 4; 224} 225 226// ListTasks Response. 227message ListTasksResponse { 228 // Tasks. 229 repeated Task tasks = 1; 230 231 // Next page token. 232 string next_page_token = 2; 233 234 // Locations that could not be reached. 235 repeated string unreachable = 3; 236} 237 238// Request for a single Task by name. 239message GetTaskRequest { 240 // Required. Task name. 241 string name = 1 [ 242 (google.api.field_behavior) = REQUIRED, 243 (google.api.resource_reference) = { type: "batch.googleapis.com/Task" } 244 ]; 245} 246 247// Represents the metadata of the long-running operation. 248message OperationMetadata { 249 // Output only. The time the operation was created. 250 google.protobuf.Timestamp create_time = 1 251 [(google.api.field_behavior) = OUTPUT_ONLY]; 252 253 // Output only. The time the operation finished running. 254 google.protobuf.Timestamp end_time = 2 255 [(google.api.field_behavior) = OUTPUT_ONLY]; 256 257 // Output only. Server-defined resource path for the target of the operation. 258 string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 259 260 // Output only. Name of the verb executed by the operation. 261 string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 262 263 // Output only. Human-readable status of the operation, if any. 264 string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 265 266 // Output only. Identifies whether the user has requested cancellation 267 // of the operation. Operations that have successfully been cancelled 268 // have [Operation.error][] value with a 269 // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to 270 // `Code.CANCELLED`. 271 bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; 272 273 // Output only. API version used to start the operation. 274 string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; 275} 276