1- // Copyright 2021 Google LLC
1+ // Copyright 2023 Google LLC
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import "google/api/annotations.proto";
2020import "google/api/client.proto" ;
2121import "google/api/field_behavior.proto" ;
2222import "google/api/resource.proto" ;
23+ import "google/protobuf/duration.proto" ;
2324import "google/protobuf/timestamp.proto" ;
2425
2526option go_package = "cloud.google.com/go/workflows/executions/apiv1/executionspb;executionspb" ;
@@ -35,7 +36,8 @@ option (google.api.resource_definition) = {
3536// [Workflows][google.cloud.workflows.v1.Workflow] called executions.
3637service Executions {
3738 option (google.api.default_host ) = "workflowexecutions.googleapis.com" ;
38- option (google.api.oauth_scopes ) = "https://www.googleapis.com/auth/cloud-platform" ;
39+ option (google.api.oauth_scopes ) =
40+ "https://www.googleapis.com/auth/cloud-platform" ;
3941
4042 // Returns a list of executions which belong to the workflow with
4143 // the given name. The method returns executions of all workflow
@@ -83,6 +85,31 @@ message Execution {
8385 pattern : "projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}"
8486 };
8587
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+
86113 // A single stack element (frame) where an error occurred.
87114 message StackTraceElement {
88115 // Position contains source position information about the stack trace
@@ -128,29 +155,10 @@ message Execution {
128155 StackTrace stack_trace = 3 ;
129156 }
130157
131- // Describes the current state of the execution. More states might be added
132- // in the future.
133- enum State {
134- // Invalid state.
135- STATE_UNSPECIFIED = 0 ;
136-
137- // The execution is in progress.
138- ACTIVE = 1 ;
139-
140- // The execution finished successfully.
141- SUCCEEDED = 2 ;
142-
143- // The execution failed with an error.
144- FAILED = 3 ;
145-
146- // The execution was stopped intentionally.
147- CANCELLED = 4 ;
148- }
149-
150158 // Describes the level of platform logging to apply to calls and call
151159 // responses during workflow executions.
152160 enum CallLogLevel {
153- // No call logging specified.
161+ // No call logging level specified.
154162 CALL_LOG_LEVEL_UNSPECIFIED = 0 ;
155163
156164 // Log all call steps within workflows, all call returns, and all exceptions
@@ -159,6 +167,48 @@ message Execution {
159167
160168 // Log only exceptions that are raised from call steps within workflows.
161169 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 ;
162212 }
163213
164214 // Output only. The resource name of the execution.
@@ -167,10 +217,16 @@ message Execution {
167217 string name = 1 [(google.api.field_behavior ) = OUTPUT_ONLY ];
168218
169219 // Output only. Marks the beginning of execution.
170- google.protobuf.Timestamp start_time = 2 [(google.api.field_behavior ) = OUTPUT_ONLY ];
220+ google.protobuf.Timestamp start_time = 2
221+ [(google.api.field_behavior ) = OUTPUT_ONLY ];
171222
172223 // Output only. Marks the end of execution, successful or not.
173- google.protobuf.Timestamp end_time = 3 [(google.api.field_behavior ) = OUTPUT_ONLY ];
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 ];
174230
175231 // Output only. Current state of the execution.
176232 State state = 4 [(google.api.field_behavior ) = OUTPUT_ONLY ];
@@ -197,6 +253,24 @@ message Execution {
197253
198254 // The call logging level associated to this execution.
199255 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 ];
200274}
201275
202276// Request for the
@@ -213,7 +287,7 @@ message ListExecutionsRequest {
213287 ];
214288
215289 // Maximum number of executions to return per call.
216- // Max supported value depends on the selected Execution view: it's 10000 for
290+ // Max supported value depends on the selected Execution view: it's 1000 for
217291 // BASIC and 100 for FULL. The default value used if the field is not
218292 // specified is 100, regardless of the selected view. Values greater than
219293 // the max value will be coerced down to it.
@@ -224,11 +298,26 @@ message ListExecutionsRequest {
224298 //
225299 // When paginating, all other parameters provided to `ListExecutions` must
226300 // 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.
227304 string page_token = 3 ;
228305
229- // Optional. A view defining which fields should be filled in the returned executions.
230- // The API will default to the BASIC view.
306+ // Optional. A view defining which fields should be filled in the returned
307+ // executions. The API will default to the BASIC view.
231308 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 ];
232321}
233322
234323// Response for the
@@ -275,8 +364,8 @@ message GetExecutionRequest {
275364 }
276365 ];
277366
278- // Optional. A view defining which fields should be filled in the returned execution.
279- // The API will default to the FULL view.
367+ // Optional. A view defining which fields should be filled in the returned
368+ // execution. The API will default to the FULL view.
280369 ExecutionView view = 2 [(google.api.field_behavior ) = OPTIONAL ];
281370}
282371
@@ -301,8 +390,8 @@ enum ExecutionView {
301390 EXECUTION_VIEW_UNSPECIFIED = 0 ;
302391
303392 // Includes only basic metadata about the execution.
304- // Following fields are returned: name, start_time, end_time, state
305- // and workflow_revision_id.
393+ // The following fields are returned: name, start_time, end_time, duration,
394+ // state, and workflow_revision_id.
306395 BASIC = 1 ;
307396
308397 // Includes all data.
0 commit comments