executions.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. // Copyright 2021 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.workflows.executions.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/protobuf/timestamp.proto";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1;executions";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "ExecutionsProto";
  24. option java_package = "com.google.cloud.workflows.executions.v1";
  25. option (google.api.resource_definition) = {
  26. type: "workflows.googleapis.com/Workflow"
  27. pattern: "projects/{project}/locations/{location}/workflows/{workflow}"
  28. };
  29. // Executions is used to start and manage running instances of
  30. // [Workflows][google.cloud.workflows.v1.Workflow] called executions.
  31. service Executions {
  32. option (google.api.default_host) = "workflowexecutions.googleapis.com";
  33. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  34. // Returns a list of executions which belong to the workflow with
  35. // the given name. The method returns executions of all workflow
  36. // revisions. Returned executions are ordered by their start time (newest
  37. // first).
  38. rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) {
  39. option (google.api.http) = {
  40. get: "/v1/{parent=projects/*/locations/*/workflows/*}/executions"
  41. };
  42. option (google.api.method_signature) = "parent";
  43. }
  44. // Creates a new execution using the latest revision of the given workflow.
  45. rpc CreateExecution(CreateExecutionRequest) returns (Execution) {
  46. option (google.api.http) = {
  47. post: "/v1/{parent=projects/*/locations/*/workflows/*}/executions"
  48. body: "execution"
  49. };
  50. option (google.api.method_signature) = "parent,execution";
  51. }
  52. // Returns an execution of the given name.
  53. rpc GetExecution(GetExecutionRequest) returns (Execution) {
  54. option (google.api.http) = {
  55. get: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}"
  56. };
  57. option (google.api.method_signature) = "name";
  58. }
  59. // Cancels an execution of the given name.
  60. rpc CancelExecution(CancelExecutionRequest) returns (Execution) {
  61. option (google.api.http) = {
  62. post: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}:cancel"
  63. body: "*"
  64. };
  65. option (google.api.method_signature) = "name";
  66. }
  67. }
  68. // A running instance of a
  69. // [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows).
  70. message Execution {
  71. option (google.api.resource) = {
  72. type: "workflowexecutions.googleapis.com/Execution"
  73. pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}"
  74. };
  75. // A single stack element (frame) where an error occurred.
  76. message StackTraceElement {
  77. // Position contains source position information about the stack trace
  78. // element such as line number, column number and length of the code block
  79. // in bytes.
  80. message Position {
  81. // The source code line number the current instruction was generated from.
  82. int64 line = 1;
  83. // The source code column position (of the line) the current instruction
  84. // was generated from.
  85. int64 column = 2;
  86. // The number of bytes of source code making up this stack trace element.
  87. int64 length = 3;
  88. }
  89. // The step the error occurred at.
  90. string step = 1;
  91. // The routine where the error occurred.
  92. string routine = 2;
  93. // The source position information of the stack trace element.
  94. Position position = 3;
  95. }
  96. // A collection of stack elements (frames) where an error occurred.
  97. message StackTrace {
  98. // An array of stack elements.
  99. repeated StackTraceElement elements = 1;
  100. }
  101. // Error describes why the execution was abnormally terminated.
  102. message Error {
  103. // Error message and data returned represented as a JSON string.
  104. string payload = 1;
  105. // Human-readable stack trace string.
  106. string context = 2;
  107. // Stack trace with detailed information of where error was generated.
  108. StackTrace stack_trace = 3;
  109. }
  110. // Describes the current state of the execution. More states might be added
  111. // in the future.
  112. enum State {
  113. // Invalid state.
  114. STATE_UNSPECIFIED = 0;
  115. // The execution is in progress.
  116. ACTIVE = 1;
  117. // The execution finished successfully.
  118. SUCCEEDED = 2;
  119. // The execution failed with an error.
  120. FAILED = 3;
  121. // The execution was stopped intentionally.
  122. CANCELLED = 4;
  123. }
  124. // Describes the level of platform logging to apply to calls and call
  125. // responses during workflow executions.
  126. enum CallLogLevel {
  127. // No call logging specified.
  128. CALL_LOG_LEVEL_UNSPECIFIED = 0;
  129. // Log all call steps within workflows, all call returns, and all exceptions
  130. // raised.
  131. LOG_ALL_CALLS = 1;
  132. // Log only exceptions that are raised from call steps within workflows.
  133. LOG_ERRORS_ONLY = 2;
  134. }
  135. // Output only. The resource name of the execution.
  136. // Format:
  137. // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
  138. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  139. // Output only. Marks the beginning of execution.
  140. google.protobuf.Timestamp start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  141. // Output only. Marks the end of execution, successful or not.
  142. google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  143. // Output only. Current state of the execution.
  144. State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  145. // Input parameters of the execution represented as a JSON string.
  146. // The size limit is 32KB.
  147. //
  148. // *Note*: If you are using the REST API directly to run your workflow, you
  149. // must escape any JSON string value of `argument`. Example:
  150. // `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'`
  151. string argument = 5;
  152. // Output only. Output of the execution represented as a JSON string. The
  153. // value can only be present if the execution's state is `SUCCEEDED`.
  154. string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  155. // Output only. The error which caused the execution to finish prematurely.
  156. // The value is only present if the execution's state is `FAILED`
  157. // or `CANCELLED`.
  158. Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  159. // Output only. Revision of the workflow this execution is using.
  160. string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  161. // The call logging level associated to this execution.
  162. CallLogLevel call_log_level = 9;
  163. }
  164. // Request for the
  165. // [ListExecutions][]
  166. // method.
  167. message ListExecutionsRequest {
  168. // Required. Name of the workflow for which the executions should be listed.
  169. // Format: projects/{project}/locations/{location}/workflows/{workflow}
  170. string parent = 1 [
  171. (google.api.field_behavior) = REQUIRED,
  172. (google.api.resource_reference) = {
  173. type: "workflows.googleapis.com/Workflow"
  174. }
  175. ];
  176. // Maximum number of executions to return per call.
  177. // Max supported value depends on the selected Execution view: it's 10000 for
  178. // BASIC and 100 for FULL. The default value used if the field is not
  179. // specified is 100, regardless of the selected view. Values greater than
  180. // the max value will be coerced down to it.
  181. int32 page_size = 2;
  182. // A page token, received from a previous `ListExecutions` call.
  183. // Provide this to retrieve the subsequent page.
  184. //
  185. // When paginating, all other parameters provided to `ListExecutions` must
  186. // match the call that provided the page token.
  187. string page_token = 3;
  188. // Optional. A view defining which fields should be filled in the returned executions.
  189. // The API will default to the BASIC view.
  190. ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL];
  191. }
  192. // Response for the
  193. // [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions]
  194. // method.
  195. message ListExecutionsResponse {
  196. // The executions which match the request.
  197. repeated Execution executions = 1;
  198. // A token, which can be sent as `page_token` to retrieve the next page.
  199. // If this field is omitted, there are no subsequent pages.
  200. string next_page_token = 2;
  201. }
  202. // Request for the
  203. // [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution]
  204. // method.
  205. message CreateExecutionRequest {
  206. // Required. Name of the workflow for which an execution should be created.
  207. // Format: projects/{project}/locations/{location}/workflows/{workflow}
  208. // The latest revision of the workflow will be used.
  209. string parent = 1 [
  210. (google.api.field_behavior) = REQUIRED,
  211. (google.api.resource_reference) = {
  212. type: "workflows.googleapis.com/Workflow"
  213. }
  214. ];
  215. // Required. Execution to be created.
  216. Execution execution = 2 [(google.api.field_behavior) = REQUIRED];
  217. }
  218. // Request for the
  219. // [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution]
  220. // method.
  221. message GetExecutionRequest {
  222. // Required. Name of the execution to be retrieved.
  223. // Format:
  224. // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
  225. string name = 1 [
  226. (google.api.field_behavior) = REQUIRED,
  227. (google.api.resource_reference) = {
  228. type: "workflowexecutions.googleapis.com/Execution"
  229. }
  230. ];
  231. // Optional. A view defining which fields should be filled in the returned execution.
  232. // The API will default to the FULL view.
  233. ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL];
  234. }
  235. // Request for the
  236. // [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution]
  237. // method.
  238. message CancelExecutionRequest {
  239. // Required. Name of the execution to be cancelled.
  240. // Format:
  241. // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
  242. string name = 1 [
  243. (google.api.field_behavior) = REQUIRED,
  244. (google.api.resource_reference) = {
  245. type: "workflowexecutions.googleapis.com/Execution"
  246. }
  247. ];
  248. }
  249. // Defines possible views for execution resource.
  250. enum ExecutionView {
  251. // The default / unset value.
  252. EXECUTION_VIEW_UNSPECIFIED = 0;
  253. // Includes only basic metadata about the execution.
  254. // Following fields are returned: name, start_time, end_time, state
  255. // and workflow_revision_id.
  256. BASIC = 1;
  257. // Includes all data.
  258. FULL = 2;
  259. }