xref: /aosp_15_r20/external/googleapis/google/cloud/batch/v1alpha/batch.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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.v1alpha;
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/v1alpha/job.proto";
25import "google/cloud/batch/v1alpha/resource_allowance.proto";
26import "google/cloud/batch/v1alpha/task.proto";
27import "google/longrunning/operations.proto";
28import "google/protobuf/empty.proto";
29import "google/protobuf/field_mask.proto";
30import "google/protobuf/timestamp.proto";
31
32option csharp_namespace = "Google.Cloud.Batch.V1Alpha";
33option go_package = "cloud.google.com/go/batch/apiv1alpha/batchpb;batchpb";
34option java_multiple_files = true;
35option java_outer_classname = "BatchProto";
36option java_package = "com.google.cloud.batch.v1alpha";
37option objc_class_prefix = "GCB";
38option php_namespace = "Google\\Cloud\\Batch\\V1alpha";
39option ruby_package = "Google::Cloud::Batch::V1alpha";
40
41// Google Batch Service.
42// The service manages user submitted batch jobs and allocates Google Compute
43// Engine VM instances to run the jobs.
44service BatchService {
45  option (google.api.default_host) = "batch.googleapis.com";
46  option (google.api.oauth_scopes) =
47      "https://www.googleapis.com/auth/cloud-platform";
48
49  // Create a Job.
50  rpc CreateJob(CreateJobRequest) returns (Job) {
51    option (google.api.http) = {
52      post: "/v1alpha/{parent=projects/*/locations/*}/jobs"
53      body: "job"
54    };
55    option (google.api.method_signature) = "parent,job,job_id";
56  }
57
58  // Get a Job specified by its resource name.
59  rpc GetJob(GetJobRequest) returns (Job) {
60    option (google.api.http) = {
61      get: "/v1alpha/{name=projects/*/locations/*/jobs/*}"
62    };
63    option (google.api.method_signature) = "name";
64  }
65
66  // Delete a Job.
67  rpc DeleteJob(DeleteJobRequest) returns (google.longrunning.Operation) {
68    option (google.api.http) = {
69      delete: "/v1alpha/{name=projects/*/locations/*/jobs/*}"
70    };
71    option (google.api.method_signature) = "name";
72    option (google.longrunning.operation_info) = {
73      response_type: "google.protobuf.Empty"
74      metadata_type: "google.cloud.batch.v1alpha.OperationMetadata"
75    };
76  }
77
78  // List all Jobs for a project within a region.
79  rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) {
80    option (google.api.http) = {
81      get: "/v1alpha/{parent=projects/*/locations/*}/jobs"
82    };
83    option (google.api.method_signature) = "parent";
84  }
85
86  // Return a single Task.
87  rpc GetTask(GetTaskRequest) returns (Task) {
88    option (google.api.http) = {
89      get: "/v1alpha/{name=projects/*/locations/*/jobs/*/taskGroups/*/tasks/*}"
90    };
91    option (google.api.method_signature) = "name";
92  }
93
94  // List Tasks associated with a job.
95  rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) {
96    option (google.api.http) = {
97      get: "/v1alpha/{parent=projects/*/locations/*/jobs/*/taskGroups/*}/tasks"
98    };
99    option (google.api.method_signature) = "parent";
100  }
101
102  // Create a Resource Allowance.
103  rpc CreateResourceAllowance(CreateResourceAllowanceRequest)
104      returns (ResourceAllowance) {
105    option (google.api.http) = {
106      post: "/v1alpha/{parent=projects/*/locations/*}/resourceAllowances"
107      body: "resource_allowance"
108    };
109    option (google.api.method_signature) =
110        "parent,resource_allowance,resource_allowance_id";
111  }
112
113  // Get a ResourceAllowance specified by its resource name.
114  rpc GetResourceAllowance(GetResourceAllowanceRequest)
115      returns (ResourceAllowance) {
116    option (google.api.http) = {
117      get: "/v1alpha/{name=projects/*/locations/*/resourceAllowances/*}"
118    };
119    option (google.api.method_signature) = "name";
120  }
121
122  // Delete a ResourceAllowance.
123  rpc DeleteResourceAllowance(DeleteResourceAllowanceRequest)
124      returns (google.longrunning.Operation) {
125    option (google.api.http) = {
126      delete: "/v1alpha/{name=projects/*/locations/*/resourceAllowances/*}"
127    };
128    option (google.api.method_signature) = "name";
129    option (google.longrunning.operation_info) = {
130      response_type: "google.protobuf.Empty"
131      metadata_type: "google.cloud.batch.v1alpha.OperationMetadata"
132    };
133  }
134
135  // List all ResourceAllowances for a project within a region.
136  rpc ListResourceAllowances(ListResourceAllowancesRequest)
137      returns (ListResourceAllowancesResponse) {
138    option (google.api.http) = {
139      get: "/v1alpha/{parent=projects/*/locations/*}/resourceAllowances"
140    };
141    option (google.api.method_signature) = "parent";
142  }
143
144  // Update a Resource Allowance.
145  rpc UpdateResourceAllowance(UpdateResourceAllowanceRequest)
146      returns (ResourceAllowance) {
147    option (google.api.http) = {
148      patch: "/v1alpha/{resource_allowance.name=projects/*/locations/*/resourceAllowances/*}"
149      body: "resource_allowance"
150    };
151    option (google.api.method_signature) = "resource_allowance,update_mask";
152  }
153}
154
155// CreateJob Request.
156message CreateJobRequest {
157  // Required. The parent resource name where the Job will be created.
158  // Pattern: "projects/{project}/locations/{location}"
159  string parent = 1 [
160    (google.api.field_behavior) = REQUIRED,
161    (google.api.resource_reference) = { child_type: "batch.googleapis.com/Job" }
162  ];
163
164  // ID used to uniquely identify the Job within its parent scope.
165  // This field should contain at most 63 characters and must start with
166  // lowercase characters.
167  // Only lowercase characters, numbers and '-' are accepted.
168  // The '-' character cannot be the first or the last one.
169  // A system generated ID will be used if the field is not set.
170  //
171  // The job.name field in the request will be ignored and the created resource
172  // name of the Job will be "{parent}/jobs/{job_id}".
173  string job_id = 2;
174
175  // Required. The Job to create.
176  Job job = 3 [(google.api.field_behavior) = REQUIRED];
177
178  // Optional. An optional request ID to identify requests. Specify a unique
179  // request ID so that if you must retry your request, the server will know to
180  // ignore the request if it has already been completed. The server will
181  // guarantee that for at least 60 minutes since the first request.
182  //
183  // For example, consider a situation where you make an initial request and
184  // the request times out. If you make the request again with the same request
185  // ID, the server can check if original operation with the same request ID
186  // was received, and if so, will ignore the second request. This prevents
187  // clients from accidentally creating duplicate commitments.
188  //
189  // The request ID must be a valid UUID with the exception that zero UUID is
190  // not supported (00000000-0000-0000-0000-000000000000).
191  string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
192}
193
194// GetJob Request.
195message GetJobRequest {
196  // Required. Job name.
197  string name = 1 [
198    (google.api.field_behavior) = REQUIRED,
199    (google.api.resource_reference) = { type: "batch.googleapis.com/Job" }
200  ];
201}
202
203// DeleteJob Request.
204message DeleteJobRequest {
205  // Job name.
206  string name = 1;
207
208  // Optional. Reason for this deletion.
209  string reason = 2 [(google.api.field_behavior) = OPTIONAL];
210
211  // Optional. An optional request ID to identify requests. Specify a unique
212  // request ID so that if you must retry your request, the server will know to
213  // ignore the request if it has already been completed. The server will
214  // guarantee that for at least 60 minutes after the first request.
215  //
216  // For example, consider a situation where you make an initial request and
217  // the request times out. If you make the request again with the same request
218  // ID, the server can check if original operation with the same request ID
219  // was received, and if so, will ignore the second request. This prevents
220  // clients from accidentally creating duplicate commitments.
221  //
222  // The request ID must be a valid UUID with the exception that zero UUID is
223  // not supported (00000000-0000-0000-0000-000000000000).
224  string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
225}
226
227// ListJob Request.
228message ListJobsRequest {
229  // Parent path.
230  string parent = 1;
231
232  // List filter.
233  string filter = 4;
234
235  // Optional. Sort results. Supported are "name", "name desc", "create_time",
236  // and "create_time desc".
237  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
238
239  // Page size.
240  int32 page_size = 2;
241
242  // Page token.
243  string page_token = 3;
244}
245
246// ListJob Response.
247message ListJobsResponse {
248  // Jobs.
249  repeated Job jobs = 1;
250
251  // Next page token.
252  string next_page_token = 2;
253
254  // Locations that could not be reached.
255  repeated string unreachable = 3;
256}
257
258// ListTasks Request.
259message ListTasksRequest {
260  // Required. Name of a TaskGroup from which Tasks are being requested.
261  // Pattern:
262  // "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"
263  string parent = 1 [
264    (google.api.field_behavior) = REQUIRED,
265    (google.api.resource_reference) = { type: "batch.googleapis.com/TaskGroup" }
266  ];
267
268  // Task filter, null filter matches all Tasks.
269  // Filter string should be of the format State=TaskStatus.State e.g.
270  // State=RUNNING
271  string filter = 2;
272
273  // Not implemented.
274  string order_by = 5;
275
276  // Page size.
277  int32 page_size = 3;
278
279  // Page token.
280  string page_token = 4;
281}
282
283// ListTasks Response.
284message ListTasksResponse {
285  // Tasks.
286  repeated Task tasks = 1;
287
288  // Next page token.
289  string next_page_token = 2;
290
291  // Locations that could not be reached.
292  repeated string unreachable = 3;
293}
294
295// Request for a single Task by name.
296message GetTaskRequest {
297  // Required. Task name.
298  string name = 1 [
299    (google.api.field_behavior) = REQUIRED,
300    (google.api.resource_reference) = { type: "batch.googleapis.com/Task" }
301  ];
302}
303
304// CreateResourceAllowance Request.
305message CreateResourceAllowanceRequest {
306  // Required. The parent resource name where the ResourceAllowance will be
307  // created. Pattern: "projects/{project}/locations/{location}"
308  string parent = 1 [
309    (google.api.field_behavior) = REQUIRED,
310    (google.api.resource_reference) = {
311      child_type: "batch.googleapis.com/ResourceAllowance"
312    }
313  ];
314
315  // ID used to uniquely identify the ResourceAllowance within its parent scope.
316  // This field should contain at most 63 characters and must start with
317  // lowercase characters.
318  // Only lowercase characters, numbers and '-' are accepted.
319  // The '-' character cannot be the first or the last one.
320  // A system generated ID will be used if the field is not set.
321  //
322  // The resource_allowance.name field in the request will be ignored and the
323  // created resource name of the ResourceAllowance will be
324  // "{parent}/resourceAllowances/{resource_allowance_id}".
325  string resource_allowance_id = 2;
326
327  // Required. The ResourceAllowance to create.
328  ResourceAllowance resource_allowance = 3
329      [(google.api.field_behavior) = REQUIRED];
330
331  // Optional. An optional request ID to identify requests. Specify a unique
332  // request ID so that if you must retry your request, the server will know to
333  // ignore the request if it has already been completed. The server will
334  // guarantee that for at least 60 minutes since the first request.
335  //
336  // For example, consider a situation where you make an initial request and
337  // the request times out. If you make the request again with the same request
338  // ID, the server can check if original operation with the same request ID
339  // was received, and if so, will ignore the second request. This prevents
340  // clients from accidentally creating duplicate commitments.
341  //
342  // The request ID must be a valid UUID with the exception that zero UUID is
343  // not supported (00000000-0000-0000-0000-000000000000).
344  string request_id = 4 [
345    (google.api.field_info).format = UUID4,
346    (google.api.field_behavior) = OPTIONAL
347  ];
348}
349
350// GetResourceAllowance Request.
351message GetResourceAllowanceRequest {
352  // Required. ResourceAllowance name.
353  string name = 1 [
354    (google.api.field_behavior) = REQUIRED,
355    (google.api.resource_reference) = {
356      type: "batch.googleapis.com/ResourceAllowance"
357    }
358  ];
359}
360
361// DeleteResourceAllowance Request.
362message DeleteResourceAllowanceRequest {
363  // Required. ResourceAllowance name.
364  string name = 1 [
365    (google.api.field_behavior) = REQUIRED,
366    (google.api.resource_reference) = {
367      type: "batch.googleapis.com/ResourceAllowance"
368    }
369  ];
370
371  // Optional. Reason for this deletion.
372  string reason = 2 [(google.api.field_behavior) = OPTIONAL];
373
374  // Optional. An optional request ID to identify requests. Specify a unique
375  // request ID so that if you must retry your request, the server will know to
376  // ignore the request if it has already been completed. The server will
377  // guarantee that for at least 60 minutes after the first request.
378  //
379  // For example, consider a situation where you make an initial request and
380  // the request times out. If you make the request again with the same request
381  // ID, the server can check if original operation with the same request ID
382  // was received, and if so, will ignore the second request. This prevents
383  // clients from accidentally creating duplicate commitments.
384  //
385  // The request ID must be a valid UUID with the exception that zero UUID is
386  // not supported (00000000-0000-0000-0000-000000000000).
387  string request_id = 4 [
388    (google.api.field_info).format = UUID4,
389    (google.api.field_behavior) = OPTIONAL
390  ];
391}
392
393// ListResourceAllowances Request.
394message ListResourceAllowancesRequest {
395  // Required. Parent path.
396  string parent = 1 [
397    (google.api.field_behavior) = REQUIRED,
398    (google.api.resource_reference) = {
399      child_type: "batch.googleapis.com/ResourceAllowance"
400    }
401  ];
402
403  // Optional. Page size.
404  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
405
406  // Optional. Page token.
407  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
408}
409
410// ListResourceAllowances Response.
411message ListResourceAllowancesResponse {
412  // ResourceAllowances.
413  repeated ResourceAllowance resource_allowances = 1;
414
415  // Next page token.
416  string next_page_token = 2;
417
418  // Locations that could not be reached.
419  repeated string unreachable = 3;
420}
421
422// UpdateResourceAllowance Request.
423message UpdateResourceAllowanceRequest {
424  // Required. The ResourceAllowance to update.
425  // Update description.
426  // Only fields specified in `update_mask` are updated.
427  ResourceAllowance resource_allowance = 1
428      [(google.api.field_behavior) = REQUIRED];
429
430  // Required. Mask of fields to update.
431  //
432  // Field mask is used to specify the fields to be overwritten in the
433  // ResourceAllowance resource by the update.
434  // The fields specified in the update_mask are relative to the resource, not
435  // the full request. A field will be overwritten if it is in the mask. If the
436  // user does not provide a mask then all fields will be overwritten.
437  //
438  // UpdateResourceAllowance request now only supports update on `limit` field.
439  google.protobuf.FieldMask update_mask = 2
440      [(google.api.field_behavior) = REQUIRED];
441
442  // Optional. An optional request ID to identify requests. Specify a unique
443  // request ID so that if you must retry your request, the server will know to
444  // ignore the request if it has already been completed. The server will
445  // guarantee that for at least 60 minutes since the first request.
446  //
447  // For example, consider a situation where you make an initial request and
448  // the request times out. If you make the request again with the same request
449  // ID, the server can check if original operation with the same request ID
450  // was received, and if so, will ignore the second request. This prevents
451  // clients from accidentally creating duplicate commitments.
452  //
453  // The request ID must be a valid UUID with the exception that zero UUID is
454  // not supported (00000000-0000-0000-0000-000000000000).
455  string request_id = 3 [
456    (google.api.field_info).format = UUID4,
457    (google.api.field_behavior) = OPTIONAL
458  ];
459}
460
461// Represents the metadata of the long-running operation.
462message OperationMetadata {
463  // Output only. The time the operation was created.
464  google.protobuf.Timestamp create_time = 1
465      [(google.api.field_behavior) = OUTPUT_ONLY];
466
467  // Output only. The time the operation finished running.
468  google.protobuf.Timestamp end_time = 2
469      [(google.api.field_behavior) = OUTPUT_ONLY];
470
471  // Output only. Server-defined resource path for the target of the operation.
472  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
473
474  // Output only. Name of the verb executed by the operation.
475  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
476
477  // Output only. Human-readable status of the operation, if any.
478  string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
479
480  // Output only. Identifies whether the user has requested cancellation
481  // of the operation. Operations that have successfully been cancelled
482  // have [Operation.error][] value with a
483  // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
484  // `Code.CANCELLED`.
485  bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
486
487  // Output only. API version used to start the operation.
488  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
489}
490