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