xref: /aosp_15_r20/external/googleapis/google/cloud/workflows/executions/v1/executions.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.workflows.executions.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/protobuf/duration.proto";
24import "google/protobuf/timestamp.proto";
25
26option go_package = "cloud.google.com/go/workflows/executions/apiv1/executionspb;executionspb";
27option java_multiple_files = true;
28option java_outer_classname = "ExecutionsProto";
29option java_package = "com.google.cloud.workflows.executions.v1";
30option (google.api.resource_definition) = {
31  type: "workflows.googleapis.com/Workflow"
32  pattern: "projects/{project}/locations/{location}/workflows/{workflow}"
33};
34
35// Executions is used to start and manage running instances of
36// [Workflows][google.cloud.workflows.v1.Workflow] called executions.
37service Executions {
38  option (google.api.default_host) = "workflowexecutions.googleapis.com";
39  option (google.api.oauth_scopes) =
40      "https://www.googleapis.com/auth/cloud-platform";
41
42  // Returns a list of executions which belong to the workflow with
43  // the given name. The method returns executions of all workflow
44  // revisions. Returned executions are ordered by their start time (newest
45  // first).
46  rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) {
47    option (google.api.http) = {
48      get: "/v1/{parent=projects/*/locations/*/workflows/*}/executions"
49    };
50    option (google.api.method_signature) = "parent";
51  }
52
53  // Creates a new execution using the latest revision of the given workflow.
54  rpc CreateExecution(CreateExecutionRequest) returns (Execution) {
55    option (google.api.http) = {
56      post: "/v1/{parent=projects/*/locations/*/workflows/*}/executions"
57      body: "execution"
58    };
59    option (google.api.method_signature) = "parent,execution";
60  }
61
62  // Returns an execution of the given name.
63  rpc GetExecution(GetExecutionRequest) returns (Execution) {
64    option (google.api.http) = {
65      get: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}"
66    };
67    option (google.api.method_signature) = "name";
68  }
69
70  // Cancels an execution of the given name.
71  rpc CancelExecution(CancelExecutionRequest) returns (Execution) {
72    option (google.api.http) = {
73      post: "/v1/{name=projects/*/locations/*/workflows/*/executions/*}:cancel"
74      body: "*"
75    };
76    option (google.api.method_signature) = "name";
77  }
78}
79
80// A running instance of a
81// [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows).
82message Execution {
83  option (google.api.resource) = {
84    type: "workflowexecutions.googleapis.com/Execution"
85    pattern: "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}"
86  };
87
88  // Describes the current state of the execution. More states might be added
89  // in the future.
90  enum State {
91    // Invalid state.
92    STATE_UNSPECIFIED = 0;
93
94    // The execution is in progress.
95    ACTIVE = 1;
96
97    // The execution finished successfully.
98    SUCCEEDED = 2;
99
100    // The execution failed with an error.
101    FAILED = 3;
102
103    // The execution was stopped intentionally.
104    CANCELLED = 4;
105
106    // Execution data is unavailable. See the `state_error` field.
107    UNAVAILABLE = 5;
108
109    // Request has been placed in the backlog for processing at a later time.
110    QUEUED = 6;
111  }
112
113  // A single stack element (frame) where an error occurred.
114  message StackTraceElement {
115    // Position contains source position information about the stack trace
116    // element such as line number, column number and length of the code block
117    // in bytes.
118    message Position {
119      // The source code line number the current instruction was generated from.
120      int64 line = 1;
121
122      // The source code column position (of the line) the current instruction
123      // was generated from.
124      int64 column = 2;
125
126      // The number of bytes of source code making up this stack trace element.
127      int64 length = 3;
128    }
129
130    // The step the error occurred at.
131    string step = 1;
132
133    // The routine where the error occurred.
134    string routine = 2;
135
136    // The source position information of the stack trace element.
137    Position position = 3;
138  }
139
140  // A collection of stack elements (frames) where an error occurred.
141  message StackTrace {
142    // An array of stack elements.
143    repeated StackTraceElement elements = 1;
144  }
145
146  // Error describes why the execution was abnormally terminated.
147  message Error {
148    // Error message and data returned represented as a JSON string.
149    string payload = 1;
150
151    // Human-readable stack trace string.
152    string context = 2;
153
154    // Stack trace with detailed information of where error was generated.
155    StackTrace stack_trace = 3;
156  }
157
158  // Describes the level of platform logging to apply to calls and call
159  // responses during workflow executions.
160  enum CallLogLevel {
161    // No call logging level specified.
162    CALL_LOG_LEVEL_UNSPECIFIED = 0;
163
164    // Log all call steps within workflows, all call returns, and all exceptions
165    // raised.
166    LOG_ALL_CALLS = 1;
167
168    // Log only exceptions that are raised from call steps within workflows.
169    LOG_ERRORS_ONLY = 2;
170
171    // Explicitly log nothing.
172    LOG_NONE = 3;
173  }
174
175  // Represents the current status of this execution.
176  message Status {
177    // Represents a step of the workflow this execution is running.
178    message Step {
179      // Name of a routine within the workflow.
180      string routine = 1;
181
182      // Name of a step within the routine.
183      string step = 2;
184    }
185
186    // A list of currently executing or last executed step names for the
187    // workflow execution currently running. If the workflow has succeeded or
188    // failed, this is the last attempted or executed step. Presently, if the
189    // current step is inside a subworkflow, the list only includes that step.
190    // In the future, the list will contain items for each step in the call
191    // stack, starting with the outermost step in the `main` subworkflow, and
192    // ending with the most deeply nested step.
193    repeated Step current_steps = 1;
194  }
195
196  // Describes an error related to the current state of the Execution resource.
197  message StateError {
198    // Describes the possible types of a state error.
199    enum Type {
200      // No type specified.
201      TYPE_UNSPECIFIED = 0;
202
203      // Caused by an issue with KMS.
204      KMS_ERROR = 1;
205    }
206
207    // Provides specifics about the error.
208    string details = 1;
209
210    // The type of this state error.
211    Type type = 2;
212  }
213
214  // Output only. The resource name of the execution.
215  // Format:
216  // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
217  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
218
219  // Output only. Marks the beginning of execution.
220  google.protobuf.Timestamp start_time = 2
221      [(google.api.field_behavior) = OUTPUT_ONLY];
222
223  // Output only. Marks the end of execution, successful or not.
224  google.protobuf.Timestamp end_time = 3
225      [(google.api.field_behavior) = OUTPUT_ONLY];
226
227  // Output only. Measures the duration of the execution.
228  google.protobuf.Duration duration = 12
229      [(google.api.field_behavior) = OUTPUT_ONLY];
230
231  // Output only. Current state of the execution.
232  State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
233
234  // Input parameters of the execution represented as a JSON string.
235  // The size limit is 32KB.
236  //
237  // *Note*: If you are using the REST API directly to run your workflow, you
238  // must escape any JSON string value of `argument`. Example:
239  // `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'`
240  string argument = 5;
241
242  // Output only. Output of the execution represented as a JSON string. The
243  // value can only be present if the execution's state is `SUCCEEDED`.
244  string result = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
245
246  // Output only. The error which caused the execution to finish prematurely.
247  // The value is only present if the execution's state is `FAILED`
248  // or `CANCELLED`.
249  Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
250
251  // Output only. Revision of the workflow this execution is using.
252  string workflow_revision_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
253
254  // The call logging level associated to this execution.
255  CallLogLevel call_log_level = 9;
256
257  // Output only. Status tracks the current steps and progress data of this
258  // execution.
259  Status status = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
260
261  // Labels associated with this execution.
262  // Labels can contain at most 64 entries. Keys and values can be no longer
263  // than 63 characters and can only contain lowercase letters, numeric
264  // characters, underscores, and dashes. Label keys must start with a letter.
265  // International characters are allowed.
266  // By default, labels are inherited from the workflow but are overridden by
267  // any labels associated with the execution.
268  map<string, string> labels = 11;
269
270  // Output only. Error regarding the state of the Execution resource. For
271  // example, this field will have error details if the execution data is
272  // unavailable due to revoked KMS key permissions.
273  StateError state_error = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
274}
275
276// Request for the
277// [ListExecutions][]
278// method.
279message ListExecutionsRequest {
280  // Required. Name of the workflow for which the executions should be listed.
281  // Format: projects/{project}/locations/{location}/workflows/{workflow}
282  string parent = 1 [
283    (google.api.field_behavior) = REQUIRED,
284    (google.api.resource_reference) = {
285      type: "workflows.googleapis.com/Workflow"
286    }
287  ];
288
289  // Maximum number of executions to return per call.
290  // Max supported value depends on the selected Execution view: it's 1000 for
291  // BASIC and 100 for FULL. The default value used if the field is not
292  // specified is 100, regardless of the selected view. Values greater than
293  // the max value will be coerced down to it.
294  int32 page_size = 2;
295
296  // A page token, received from a previous `ListExecutions` call.
297  // Provide this to retrieve the subsequent page.
298  //
299  // When paginating, all other parameters provided to `ListExecutions` must
300  // match the call that provided the page token.
301  //
302  // Note that pagination is applied to dynamic data. The list of executions
303  // returned can change between page requests.
304  string page_token = 3;
305
306  // Optional. A view defining which fields should be filled in the returned
307  // executions. The API will default to the BASIC view.
308  ExecutionView view = 4 [(google.api.field_behavior) = OPTIONAL];
309
310  // Optional. Filters applied to the [Executions.ListExecutions] results.
311  // The following fields are supported for filtering:
312  // executionID, state, startTime, endTime, duration, workflowRevisionID,
313  // stepName, and label.
314  string filter = 5 [(google.api.field_behavior) = OPTIONAL];
315
316  // Optional. The ordering applied to the [Executions.ListExecutions] results.
317  // By default the ordering is based on descending start time.
318  // The following fields are supported for order by:
319  // executionID, startTime, endTime, duration, state, and workflowRevisionID.
320  string order_by = 6 [(google.api.field_behavior) = OPTIONAL];
321}
322
323// Response for the
324// [ListExecutions][google.cloud.workflows.executions.v1.Executions.ListExecutions]
325// method.
326message ListExecutionsResponse {
327  // The executions which match the request.
328  repeated Execution executions = 1;
329
330  // A token, which can be sent as `page_token` to retrieve the next page.
331  // If this field is omitted, there are no subsequent pages.
332  string next_page_token = 2;
333}
334
335// Request for the
336// [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution]
337// method.
338message CreateExecutionRequest {
339  // Required. Name of the workflow for which an execution should be created.
340  // Format: projects/{project}/locations/{location}/workflows/{workflow}
341  // The latest revision of the workflow will be used.
342  string parent = 1 [
343    (google.api.field_behavior) = REQUIRED,
344    (google.api.resource_reference) = {
345      type: "workflows.googleapis.com/Workflow"
346    }
347  ];
348
349  // Required. Execution to be created.
350  Execution execution = 2 [(google.api.field_behavior) = REQUIRED];
351}
352
353// Request for the
354// [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution]
355// method.
356message GetExecutionRequest {
357  // Required. Name of the execution to be retrieved.
358  // Format:
359  // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
360  string name = 1 [
361    (google.api.field_behavior) = REQUIRED,
362    (google.api.resource_reference) = {
363      type: "workflowexecutions.googleapis.com/Execution"
364    }
365  ];
366
367  // Optional. A view defining which fields should be filled in the returned
368  // execution. The API will default to the FULL view.
369  ExecutionView view = 2 [(google.api.field_behavior) = OPTIONAL];
370}
371
372// Request for the
373// [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution]
374// method.
375message CancelExecutionRequest {
376  // Required. Name of the execution to be cancelled.
377  // Format:
378  // projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
379  string name = 1 [
380    (google.api.field_behavior) = REQUIRED,
381    (google.api.resource_reference) = {
382      type: "workflowexecutions.googleapis.com/Execution"
383    }
384  ];
385}
386
387// Defines possible views for execution resource.
388enum ExecutionView {
389  // The default / unset value.
390  EXECUTION_VIEW_UNSPECIFIED = 0;
391
392  // Includes only basic metadata about the execution.
393  // The following fields are returned: name, start_time, end_time, duration,
394  // state, and workflow_revision_id.
395  BASIC = 1;
396
397  // Includes all data.
398  FULL = 2;
399}
400