job.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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.run.v2;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/launch_stage.proto";
  20. import "google/api/resource.proto";
  21. import "google/cloud/run/v2/condition.proto";
  22. import "google/cloud/run/v2/execution_template.proto";
  23. import "google/cloud/run/v2/vendor_settings.proto";
  24. import "google/iam/v1/iam_policy.proto";
  25. import "google/iam/v1/policy.proto";
  26. import "google/longrunning/operations.proto";
  27. import "google/protobuf/timestamp.proto";
  28. option go_package = "google.golang.org/genproto/googleapis/cloud/run/v2;run";
  29. option java_multiple_files = true;
  30. option java_outer_classname = "JobProto";
  31. option java_package = "com.google.cloud.run.v2";
  32. // Cloud Run Job Control Plane API.
  33. service Jobs {
  34. option (google.api.default_host) = "run.googleapis.com";
  35. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  36. // Creates a Job.
  37. rpc CreateJob(CreateJobRequest) returns (google.longrunning.Operation) {
  38. option (google.api.http) = {
  39. post: "/v2/{parent=projects/*/locations/*}/jobs"
  40. body: "job"
  41. };
  42. option (google.api.method_signature) = "parent,job,job_id";
  43. option (google.longrunning.operation_info) = {
  44. response_type: "Job"
  45. metadata_type: "Job"
  46. };
  47. }
  48. // Gets information about a Job.
  49. rpc GetJob(GetJobRequest) returns (Job) {
  50. option (google.api.http) = {
  51. get: "/v2/{name=projects/*/locations/*/jobs/*}"
  52. };
  53. option (google.api.method_signature) = "name";
  54. }
  55. // Lists Jobs.
  56. rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) {
  57. option (google.api.http) = {
  58. get: "/v2/{parent=projects/*/locations/*}/jobs"
  59. };
  60. option (google.api.method_signature) = "parent";
  61. }
  62. // Updates a Job.
  63. rpc UpdateJob(UpdateJobRequest) returns (google.longrunning.Operation) {
  64. option (google.api.http) = {
  65. patch: "/v2/{job.name=projects/*/locations/*/jobs/*}"
  66. body: "job"
  67. };
  68. option (google.api.method_signature) = "job";
  69. option (google.longrunning.operation_info) = {
  70. response_type: "Job"
  71. metadata_type: "Job"
  72. };
  73. }
  74. // Deletes a Job.
  75. rpc DeleteJob(DeleteJobRequest) returns (google.longrunning.Operation) {
  76. option (google.api.http) = {
  77. delete: "/v2/{name=projects/*/locations/*/jobs/*}"
  78. };
  79. option (google.api.method_signature) = "name";
  80. option (google.longrunning.operation_info) = {
  81. response_type: "Job"
  82. metadata_type: "Job"
  83. };
  84. }
  85. // Triggers creation of a new Execution of this Job.
  86. rpc RunJob(RunJobRequest) returns (google.longrunning.Operation) {
  87. option (google.api.http) = {
  88. post: "/v2/{name=projects/*/locations/*/jobs/*}:run"
  89. body: "*"
  90. };
  91. option (google.api.method_signature) = "name";
  92. option (google.longrunning.operation_info) = {
  93. response_type: "Execution"
  94. metadata_type: "Execution"
  95. };
  96. }
  97. // Gets the IAM Access Control policy currently in effect for the given Job.
  98. // This result does not include any inherited policies.
  99. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
  100. option (google.api.http) = {
  101. get: "/v2/{resource=projects/*/locations/*/jobs/*}:getIamPolicy"
  102. };
  103. }
  104. // Sets the IAM Access control policy for the specified Job. Overwrites
  105. // any existing policy.
  106. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
  107. option (google.api.http) = {
  108. post: "/v2/{resource=projects/*/locations/*/jobs/*}:setIamPolicy"
  109. body: "*"
  110. };
  111. }
  112. // Returns permissions that a caller has on the specified Project.
  113. //
  114. // There are no permissions required for making this API call.
  115. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
  116. option (google.api.http) = {
  117. post: "/v2/{resource=projects/*/locations/*/jobs/*}:testIamPermissions"
  118. body: "*"
  119. };
  120. }
  121. }
  122. // Request message for creating a Job.
  123. message CreateJobRequest {
  124. // Required. The location and project in which this Job should be created.
  125. // Format: projects/{project}/locations/{location}, where {project} can be
  126. // project id or number.
  127. string parent = 1 [
  128. (google.api.field_behavior) = REQUIRED,
  129. (google.api.resource_reference) = {
  130. child_type: "run.googleapis.com/Job"
  131. }
  132. ];
  133. // Required. The Job instance to create.
  134. Job job = 2 [(google.api.field_behavior) = REQUIRED];
  135. // Required. The unique identifier for the Job. The name of the job becomes
  136. // {parent}/jobs/{job_id}.
  137. string job_id = 3 [(google.api.field_behavior) = REQUIRED];
  138. // Indicates that the request should be validated and default values
  139. // populated, without persisting the request or creating any resources.
  140. bool validate_only = 4;
  141. }
  142. // Request message for obtaining a Job by its full name.
  143. message GetJobRequest {
  144. // Required. The full name of the Job.
  145. // Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
  146. // can be project id or number.
  147. string name = 1 [
  148. (google.api.field_behavior) = REQUIRED,
  149. (google.api.resource_reference) = {
  150. type: "run.googleapis.com/Job"
  151. }
  152. ];
  153. }
  154. // Request message for updating a Job.
  155. message UpdateJobRequest {
  156. // Required. The Job to be updated.
  157. Job job = 1 [(google.api.field_behavior) = REQUIRED];
  158. // Indicates that the request should be validated and default values
  159. // populated, without persisting the request or updating any resources.
  160. bool validate_only = 3;
  161. // If set to true, and if the Job does not exist, it will create a new
  162. // one. Caller must have both create and update permissions for this call if
  163. // this is set to true.
  164. bool allow_missing = 4;
  165. }
  166. // Request message for retrieving a list of Jobs.
  167. message ListJobsRequest {
  168. // Required. The location and project to list resources on.
  169. // Format: projects/{project}/locations/{location}, where {project} can be
  170. // project id or number.
  171. string parent = 1 [
  172. (google.api.field_behavior) = REQUIRED,
  173. (google.api.resource_reference) = {
  174. child_type: "run.googleapis.com/Job"
  175. }
  176. ];
  177. // Maximum number of Jobs to return in this call.
  178. int32 page_size = 2;
  179. // A page token received from a previous call to ListJobs.
  180. // All other parameters must match.
  181. string page_token = 3;
  182. // If true, returns deleted (but unexpired) resources along with active ones.
  183. bool show_deleted = 4;
  184. }
  185. // Response message containing a list of Jobs.
  186. message ListJobsResponse {
  187. // The resulting list of Jobs.
  188. repeated Job jobs = 1;
  189. // A token indicating there are more items than page_size. Use it in the next
  190. // ListJobs request to continue.
  191. string next_page_token = 2;
  192. }
  193. // Request message to delete a Job by its full name.
  194. message DeleteJobRequest {
  195. // Required. The full name of the Job.
  196. // Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
  197. // can be project id or number.
  198. string name = 1 [
  199. (google.api.field_behavior) = REQUIRED,
  200. (google.api.resource_reference) = {
  201. type: "run.googleapis.com/Job"
  202. }
  203. ];
  204. // Indicates that the request should be validated without actually
  205. // deleting any resources.
  206. bool validate_only = 3;
  207. // A system-generated fingerprint for this version of the
  208. // resource. May be used to detect modification conflict during updates.
  209. string etag = 4;
  210. }
  211. // Request message to create a new Execution of a Job.
  212. message RunJobRequest {
  213. // Required. The full name of the Job.
  214. // Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
  215. // can be project id or number.
  216. string name = 1 [
  217. (google.api.field_behavior) = REQUIRED,
  218. (google.api.resource_reference) = {
  219. type: "run.googleapis.com/Job"
  220. }
  221. ];
  222. // Indicates that the request should be validated without actually
  223. // deleting any resources.
  224. bool validate_only = 2;
  225. // A system-generated fingerprint for this version of the
  226. // resource. May be used to detect modification conflict during updates.
  227. string etag = 3;
  228. }
  229. // Job represents the configuration of a single job. A job an immutable resource
  230. // that references a container image which is run to completion.
  231. message Job {
  232. option (google.api.resource) = {
  233. type: "run.googleapis.com/Job"
  234. pattern: "projects/{project}/locations/{location}/jobs/{job}"
  235. style: DECLARATIVE_FRIENDLY
  236. };
  237. // The fully qualified name of this Job.
  238. //
  239. // Format:
  240. // projects/{project}/locations/{location}/jobs/{job}
  241. string name = 1;
  242. // Output only. Server assigned unique identifier for the Execution. The value is a UUID4
  243. // string and guaranteed to remain unchanged until the resource is deleted.
  244. string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  245. // Output only. A number that monotonically increases every time the user
  246. // modifies the desired state.
  247. int64 generation = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  248. // KRM-style labels for the resource.
  249. // User-provided labels are shared with Google's billing system, so they can
  250. // be used to filter, or break down billing charges by team, component,
  251. // environment, state, etc. For more information, visit
  252. // https://cloud.google.com/resource-manager/docs/creating-managing-labels or
  253. // https://cloud.google.com/run/docs/configuring/labels
  254. // Cloud Run will populate some labels with 'run.googleapis.com' or
  255. // 'serving.knative.dev' namespaces. Those labels are read-only, and user
  256. // changes will not be preserved.
  257. map<string, string> labels = 4;
  258. // KRM-style annotations for the resource. Unstructured key value map that may
  259. // be set by external tools to store and arbitrary metadata.
  260. // They are not queryable and should be preserved
  261. // when modifying objects. Cloud Run will populate some annotations using
  262. // 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
  263. // follows Kubernetes annotations' namespacing, limits, and rules. More info:
  264. // https://kubernetes.io/docs/user-guide/annotations
  265. map<string, string> annotations = 5;
  266. // Output only. The creation time.
  267. google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  268. // Output only. The last-modified time.
  269. google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  270. // Output only. The deletion time.
  271. google.protobuf.Timestamp delete_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  272. // Output only. For a deleted resource, the time after which it will be
  273. // permamently deleted.
  274. google.protobuf.Timestamp expire_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  275. // Output only. Email address of the authenticated creator.
  276. string creator = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  277. // Output only. Email address of the last authenticated modifier.
  278. string last_modifier = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
  279. // Arbitrary identifier for the API client.
  280. string client = 12;
  281. // Arbitrary version identifier for the API client.
  282. string client_version = 13;
  283. // The launch stage as defined by [Google Cloud Platform
  284. // Launch Stages](https://cloud.google.com/terms/launch-stages).
  285. // Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
  286. // is assumed.
  287. google.api.LaunchStage launch_stage = 14;
  288. // Settings for the Binary Authorization feature.
  289. BinaryAuthorization binary_authorization = 15;
  290. // Required. The template used to create executions for this Job.
  291. ExecutionTemplate template = 16 [(google.api.field_behavior) = REQUIRED];
  292. // Output only. The generation of this Job. See comments in `reconciling` for additional
  293. // information on reconciliation process in Cloud Run.
  294. int64 observed_generation = 17 [(google.api.field_behavior) = OUTPUT_ONLY];
  295. // Output only. The Condition of this Job, containing its readiness status, and
  296. // detailed error information in case it did not reach the desired state.
  297. Condition terminal_condition = 18 [(google.api.field_behavior) = OUTPUT_ONLY];
  298. // Output only. The Conditions of all other associated sub-resources. They contain
  299. // additional diagnostics information in case the Job does not reach its
  300. // desired state. See comments in `reconciling` for additional information on
  301. // reconciliation process in Cloud Run.
  302. repeated Condition conditions = 19 [(google.api.field_behavior) = OUTPUT_ONLY];
  303. // Output only. Number of executions created for this job.
  304. int32 execution_count = 20 [(google.api.field_behavior) = OUTPUT_ONLY];
  305. // Output only. Name of the last created execution.
  306. ExecutionReference latest_created_execution = 22 [(google.api.field_behavior) = OUTPUT_ONLY];
  307. // Output only. Returns true if the Job is currently being acted upon by the system to
  308. // bring it into the desired state.
  309. //
  310. // When a new Job is created, or an existing one is updated, Cloud Run
  311. // will asynchronously perform all necessary steps to bring the Job to the
  312. // desired state. This process is called reconciliation.
  313. // While reconciliation is in process, `observed_generation` and
  314. // `latest_succeeded_execution`, will have transient values that might
  315. // mismatch the intended state: Once reconciliation is over (and this field is
  316. // false), there are two possible outcomes: reconciliation succeeded and the
  317. // state matches the Job, or there was an error, and reconciliation failed.
  318. // This state can be found in `terminal_condition.state`.
  319. //
  320. // If reconciliation succeeded, the following fields will match:
  321. // `observed_generation` and `generation`, `latest_succeeded_execution` and
  322. // `latest_created_execution`.
  323. //
  324. // If reconciliation failed, `observed_generation` and
  325. // `latest_succeeded_execution` will have the state of the last succeeded
  326. // execution or empty for newly created Job. Additional information on the
  327. // failure can be found in `terminal_condition` and `conditions`.
  328. bool reconciling = 23 [(google.api.field_behavior) = OUTPUT_ONLY];
  329. // Output only. A system-generated fingerprint for this version of the
  330. // resource. May be used to detect modification conflict during updates.
  331. string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY];
  332. }
  333. // Reference to an Execution. Use /Executions.GetExecution with the given name
  334. // to get full execution including the latest status.
  335. message ExecutionReference {
  336. // Name of the execution.
  337. string name = 1 [(google.api.resource_reference) = {
  338. type: "run.googleapis.com/Execution"
  339. }];
  340. // Creation timestamp of the execution.
  341. google.protobuf.Timestamp create_time = 2;
  342. // Creation timestamp of the execution.
  343. google.protobuf.Timestamp completion_time = 3;
  344. }