task.proto 10 KB

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