xref: /aosp_15_r20/external/googleapis/google/cloud/workflows/v1/workflows.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.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/longrunning/operations.proto";
24import "google/protobuf/empty.proto";
25import "google/protobuf/field_mask.proto";
26import "google/protobuf/timestamp.proto";
27
28option go_package = "cloud.google.com/go/workflows/apiv1/workflowspb;workflowspb";
29option java_multiple_files = true;
30option java_outer_classname = "WorkflowsProto";
31option java_package = "com.google.cloud.workflows.v1";
32option (google.api.resource_definition) = {
33  type: "cloudkms.googleapis.com/CryptoKey"
34  pattern: "projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}"
35};
36
37// Workflows is used to deploy and execute workflow programs.
38// Workflows makes sure the program executes reliably, despite hardware and
39// networking interruptions.
40service Workflows {
41  option (google.api.default_host) = "workflows.googleapis.com";
42  option (google.api.oauth_scopes) =
43      "https://www.googleapis.com/auth/cloud-platform";
44
45  // Lists workflows in a given project and location.
46  // The default order is not specified.
47  rpc ListWorkflows(ListWorkflowsRequest) returns (ListWorkflowsResponse) {
48    option (google.api.http) = {
49      get: "/v1/{parent=projects/*/locations/*}/workflows"
50    };
51    option (google.api.method_signature) = "parent";
52  }
53
54  // Gets details of a single workflow.
55  rpc GetWorkflow(GetWorkflowRequest) returns (Workflow) {
56    option (google.api.http) = {
57      get: "/v1/{name=projects/*/locations/*/workflows/*}"
58    };
59    option (google.api.method_signature) = "name";
60  }
61
62  // Creates a new workflow. If a workflow with the specified name already
63  // exists in the specified project and location, the long running operation
64  // returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
65  rpc CreateWorkflow(CreateWorkflowRequest)
66      returns (google.longrunning.Operation) {
67    option (google.api.http) = {
68      post: "/v1/{parent=projects/*/locations/*}/workflows"
69      body: "workflow"
70    };
71    option (google.api.method_signature) = "parent,workflow,workflow_id";
72    option (google.longrunning.operation_info) = {
73      response_type: "Workflow"
74      metadata_type: "OperationMetadata"
75    };
76  }
77
78  // Deletes a workflow with the specified name.
79  // This method also cancels and deletes all running executions of the
80  // workflow.
81  rpc DeleteWorkflow(DeleteWorkflowRequest)
82      returns (google.longrunning.Operation) {
83    option (google.api.http) = {
84      delete: "/v1/{name=projects/*/locations/*/workflows/*}"
85    };
86    option (google.api.method_signature) = "name";
87    option (google.longrunning.operation_info) = {
88      response_type: "google.protobuf.Empty"
89      metadata_type: "OperationMetadata"
90    };
91  }
92
93  // Updates an existing workflow.
94  // Running this method has no impact on already running executions of the
95  // workflow. A new revision of the workflow might be created as a result of a
96  // successful update operation. In that case, the new revision is used
97  // in new workflow executions.
98  rpc UpdateWorkflow(UpdateWorkflowRequest)
99      returns (google.longrunning.Operation) {
100    option (google.api.http) = {
101      patch: "/v1/{workflow.name=projects/*/locations/*/workflows/*}"
102      body: "workflow"
103    };
104    option (google.api.method_signature) = "workflow,update_mask";
105    option (google.longrunning.operation_info) = {
106      response_type: "Workflow"
107      metadata_type: "OperationMetadata"
108    };
109  }
110}
111
112// Workflow program to be executed by Workflows.
113message Workflow {
114  option (google.api.resource) = {
115    type: "workflows.googleapis.com/Workflow"
116    pattern: "projects/{project}/locations/{location}/workflows/{workflow}"
117  };
118
119  // Describes the current state of workflow deployment.
120  enum State {
121    // Invalid state.
122    STATE_UNSPECIFIED = 0;
123
124    // The workflow has been deployed successfully and is serving.
125    ACTIVE = 1;
126
127    // Workflow data is unavailable. See the `state_error` field.
128    UNAVAILABLE = 2;
129  }
130
131  // Describes an error related to the current state of the workflow.
132  message StateError {
133    // Describes the possibled types of a state error.
134    enum Type {
135      // No type specified.
136      TYPE_UNSPECIFIED = 0;
137
138      // Caused by an issue with KMS.
139      KMS_ERROR = 1;
140    }
141
142    // Provides specifics about the error.
143    string details = 1;
144
145    // The type of this state error.
146    Type type = 2;
147  }
148
149  // Describes the level of platform logging to apply to calls and call
150  // responses during workflow executions.
151  enum CallLogLevel {
152    // No call logging level specified.
153    CALL_LOG_LEVEL_UNSPECIFIED = 0;
154
155    // Log all call steps within workflows, all call returns, and all exceptions
156    // raised.
157    LOG_ALL_CALLS = 1;
158
159    // Log only exceptions that are raised from call steps within workflows.
160    LOG_ERRORS_ONLY = 2;
161
162    // Explicitly log nothing.
163    LOG_NONE = 3;
164  }
165
166  // The resource name of the workflow.
167  // Format: projects/{project}/locations/{location}/workflows/{workflow}
168  string name = 1;
169
170  // Description of the workflow provided by the user.
171  // Must be at most 1000 unicode characters long.
172  string description = 2;
173
174  // Output only. State of the workflow deployment.
175  State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
176
177  // Output only. The revision of the workflow.
178  // A new revision of a workflow is created as a result of updating the
179  // following properties of a workflow:
180  //
181  // - [Service account][google.cloud.workflows.v1.Workflow.service_account]
182  // - [Workflow code to be
183  // executed][google.cloud.workflows.v1.Workflow.source_contents]
184  //
185  // The format is "000001-a4d", where the first six characters define
186  // the zero-padded revision ordinal number. They are followed by a hyphen and
187  // three hexadecimal random characters.
188  string revision_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
189
190  // Output only. The timestamp for when the workflow was created.
191  google.protobuf.Timestamp create_time = 5
192      [(google.api.field_behavior) = OUTPUT_ONLY];
193
194  // Output only. The timestamp for when the workflow was last updated.
195  google.protobuf.Timestamp update_time = 6
196      [(google.api.field_behavior) = OUTPUT_ONLY];
197
198  // Output only. The timestamp for the latest revision of the workflow's
199  // creation.
200  google.protobuf.Timestamp revision_create_time = 7
201      [(google.api.field_behavior) = OUTPUT_ONLY];
202
203  // Labels associated with this workflow.
204  // Labels can contain at most 64 entries. Keys and values can be no longer
205  // than 63 characters and can only contain lowercase letters, numeric
206  // characters, underscores, and dashes. Label keys must start with a letter.
207  // International characters are allowed.
208  map<string, string> labels = 8;
209
210  // The service account associated with the latest workflow version.
211  // This service account represents the identity of the workflow and determines
212  // what permissions the workflow has.
213  // Format: projects/{project}/serviceAccounts/{account} or {account}
214  //
215  // Using `-` as a wildcard for the `{project}` or not providing one at all
216  // will infer the project from the account. The `{account}` value can be the
217  // `email` address or the `unique_id` of the service account.
218  //
219  // If not provided, workflow will use the project's default service account.
220  // Modifying this field for an existing workflow results in a new workflow
221  // revision.
222  string service_account = 9;
223
224  // Required. Location of the workflow source code.
225  // Modifying this field for an existing workflow results in a new workflow
226  // revision.
227  oneof source_code {
228    // Workflow code to be executed. The size limit is 128KB.
229    string source_contents = 10;
230  }
231
232  // Optional. The resource name of a KMS crypto key used to encrypt or decrypt
233  // the data associated with the workflow.
234  //
235  // Format:
236  // projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}
237  //
238  // Using `-` as a wildcard for the `{project}` or not providing one at all
239  // will infer the project from the account.
240  //
241  // If not provided, data associated with the workflow will not be
242  // CMEK-encrypted.
243  string crypto_key_name = 11 [
244    (google.api.field_behavior) = OPTIONAL,
245    (google.api.resource_reference) = {
246      type: "cloudkms.googleapis.com/CryptoKey"
247    }
248  ];
249
250  // Output only. Error regarding the state of the workflow. For example, this
251  // field will have error details if the execution data is unavailable due to
252  // revoked KMS key permissions.
253  StateError state_error = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
254
255  // Optional. Describes the level of platform logging to apply to calls and
256  // call responses during executions of this workflow. If both the workflow and
257  // the execution specify a logging level, the execution level takes
258  // precedence.
259  CallLogLevel call_log_level = 13 [(google.api.field_behavior) = OPTIONAL];
260
261  // Optional. User-defined environment variables associated with this workflow
262  // revision. This map has a maximum length of 20. Each string can take up to
263  // 40KiB. Keys cannot be empty strings and cannot start with “GOOGLE” or
264  // “WORKFLOWS".
265  map<string, string> user_env_vars = 14
266      [(google.api.field_behavior) = OPTIONAL];
267}
268
269// Request for the
270// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
271// method.
272message ListWorkflowsRequest {
273  // Required. Project and location from which the workflows should be listed.
274  // Format: projects/{project}/locations/{location}
275  string parent = 1 [
276    (google.api.field_behavior) = REQUIRED,
277    (google.api.resource_reference) = {
278      type: "locations.googleapis.com/Location"
279    }
280  ];
281
282  // Maximum number of workflows to return per call. The service might return
283  // fewer than this value even if not at the end of the collection. If a value
284  // is not specified, a default value of 500 is used. The maximum permitted
285  // value is 1000 and values greater than 1000 are coerced down to 1000.
286  int32 page_size = 2;
287
288  // A page token, received from a previous `ListWorkflows` call.
289  // Provide this to retrieve the subsequent page.
290  //
291  // When paginating, all other parameters provided to `ListWorkflows` must
292  // match the call that provided the page token.
293  string page_token = 3;
294
295  // Filter to restrict results to specific workflows.
296  string filter = 4;
297
298  // Comma-separated list of fields that specify the order of the results.
299  // Default sorting order for a field is ascending. To specify descending order
300  // for a field, append a "desc" suffix.
301  // If not specified, the results are returned in an unspecified order.
302  string order_by = 5;
303}
304
305// Response for the
306// [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows]
307// method.
308message ListWorkflowsResponse {
309  // The workflows that match the request.
310  repeated Workflow workflows = 1;
311
312  // A token, which can be sent as `page_token` to retrieve the next page.
313  // If this field is omitted, there are no subsequent pages.
314  string next_page_token = 2;
315
316  // Unreachable resources.
317  repeated string unreachable = 3;
318}
319
320// Request for the
321// [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method.
322message GetWorkflowRequest {
323  // Required. Name of the workflow for which information should be retrieved.
324  // Format: projects/{project}/locations/{location}/workflows/{workflow}
325  string name = 1 [
326    (google.api.field_behavior) = REQUIRED,
327    (google.api.resource_reference) = {
328      type: "workflows.googleapis.com/Workflow"
329    }
330  ];
331
332  // Optional. The revision of the workflow to retrieve. If the revision_id is
333  // empty, the latest revision is retrieved.
334  // The format is "000001-a4d", where the first six characters define
335  // the zero-padded decimal revision number. They are followed by a hyphen and
336  // three hexadecimal characters.
337  string revision_id = 2 [(google.api.field_behavior) = OPTIONAL];
338}
339
340// Request for the
341// [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow]
342// method.
343message CreateWorkflowRequest {
344  // Required. Project and location in which the workflow should be created.
345  // Format:  projects/{project}/locations/{location}
346  string parent = 1 [
347    (google.api.field_behavior) = REQUIRED,
348    (google.api.resource_reference) = {
349      type: "locations.googleapis.com/Location"
350    }
351  ];
352
353  // Required. Workflow to be created.
354  Workflow workflow = 2 [(google.api.field_behavior) = REQUIRED];
355
356  // Required. The ID of the workflow to be created. It has to fulfill the
357  // following requirements:
358  //
359  // * Must contain only letters, numbers, underscores and hyphens.
360  // * Must start with a letter.
361  // * Must be between 1-64 characters.
362  // * Must end with a number or a letter.
363  // * Must be unique within the customer project and location.
364  string workflow_id = 3 [(google.api.field_behavior) = REQUIRED];
365}
366
367// Request for the
368// [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow]
369// method.
370message DeleteWorkflowRequest {
371  // Required. Name of the workflow to be deleted.
372  // Format: projects/{project}/locations/{location}/workflows/{workflow}
373  string name = 1 [
374    (google.api.field_behavior) = REQUIRED,
375    (google.api.resource_reference) = {
376      type: "workflows.googleapis.com/Workflow"
377    }
378  ];
379}
380
381// Request for the
382// [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow]
383// method.
384message UpdateWorkflowRequest {
385  // Required. Workflow to be updated.
386  Workflow workflow = 1 [(google.api.field_behavior) = REQUIRED];
387
388  // List of fields to be updated. If not present, the entire workflow
389  // will be updated.
390  google.protobuf.FieldMask update_mask = 2;
391}
392
393// Represents the metadata of the long-running operation.
394message OperationMetadata {
395  // The time the operation was created.
396  google.protobuf.Timestamp create_time = 1;
397
398  // The time the operation finished running.
399  google.protobuf.Timestamp end_time = 2;
400
401  // Server-defined resource path for the target of the operation.
402  string target = 3;
403
404  // Name of the verb executed by the operation.
405  string verb = 4;
406
407  // API version used to start the operation.
408  string api_version = 5;
409}
410