batch.proto 9.1 KB

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