1// Copyright 2022 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.dataproc.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/cloud/dataproc/v1/clusters.proto";
24import "google/cloud/dataproc/v1/jobs.proto";
25import "google/longrunning/operations.proto";
26import "google/protobuf/duration.proto";
27import "google/protobuf/empty.proto";
28import "google/protobuf/timestamp.proto";
29
30option go_package = "cloud.google.com/go/dataproc/v2/apiv1/dataprocpb;dataprocpb";
31option java_multiple_files = true;
32option java_outer_classname = "WorkflowTemplatesProto";
33option java_package = "com.google.cloud.dataproc.v1";
34
35// The API interface for managing Workflow Templates in the
36// Dataproc API.
37service WorkflowTemplateService {
38  option (google.api.default_host) = "dataproc.googleapis.com";
39  option (google.api.oauth_scopes) =
40      "https://www.googleapis.com/auth/cloud-platform";
41
42  // Creates new workflow template.
43  rpc CreateWorkflowTemplate(CreateWorkflowTemplateRequest)
44      returns (WorkflowTemplate) {
45    option (google.api.http) = {
46      post: "/v1/{parent=projects/*/locations/*}/workflowTemplates"
47      body: "template"
48      additional_bindings {
49        post: "/v1/{parent=projects/*/regions/*}/workflowTemplates"
50        body: "template"
51      }
52    };
53    option (google.api.method_signature) = "parent,template";
54  }
55
56  // Retrieves the latest workflow template.
57  //
58  // Can retrieve previously instantiated template by specifying optional
59  // version parameter.
60  rpc GetWorkflowTemplate(GetWorkflowTemplateRequest)
61      returns (WorkflowTemplate) {
62    option (google.api.http) = {
63      get: "/v1/{name=projects/*/locations/*/workflowTemplates/*}"
64      additional_bindings {
65        get: "/v1/{name=projects/*/regions/*/workflowTemplates/*}"
66      }
67    };
68    option (google.api.method_signature) = "name";
69  }
70
71  // Instantiates a template and begins execution.
72  //
73  // The returned Operation can be used to track execution of
74  // workflow by polling
75  // [operations.get][google.longrunning.Operations.GetOperation].
76  // The Operation will complete when entire workflow is finished.
77  //
78  // The running workflow can be aborted via
79  // [operations.cancel][google.longrunning.Operations.CancelOperation].
80  // This will cause any inflight jobs to be cancelled and workflow-owned
81  // clusters to be deleted.
82  //
83  // The [Operation.metadata][google.longrunning.Operation.metadata] will be
84  // [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata).
85  // Also see [Using
86  // WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
87  //
88  // On successful completion,
89  // [Operation.response][google.longrunning.Operation.response] will be
90  // [Empty][google.protobuf.Empty].
91  rpc InstantiateWorkflowTemplate(InstantiateWorkflowTemplateRequest)
92      returns (google.longrunning.Operation) {
93    option (google.api.http) = {
94      post: "/v1/{name=projects/*/locations/*/workflowTemplates/*}:instantiate"
95      body: "*"
96      additional_bindings {
97        post: "/v1/{name=projects/*/regions/*/workflowTemplates/*}:instantiate"
98        body: "*"
99      }
100    };
101    option (google.api.method_signature) = "name";
102    option (google.api.method_signature) = "name,parameters";
103    option (google.longrunning.operation_info) = {
104      response_type: "google.protobuf.Empty"
105      metadata_type: "WorkflowMetadata"
106    };
107  }
108
109  // Instantiates a template and begins execution.
110  //
111  // This method is equivalent to executing the sequence
112  // [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate],
113  // [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate],
114  // [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate].
115  //
116  // The returned Operation can be used to track execution of
117  // workflow by polling
118  // [operations.get][google.longrunning.Operations.GetOperation].
119  // The Operation will complete when entire workflow is finished.
120  //
121  // The running workflow can be aborted via
122  // [operations.cancel][google.longrunning.Operations.CancelOperation].
123  // This will cause any inflight jobs to be cancelled and workflow-owned
124  // clusters to be deleted.
125  //
126  // The [Operation.metadata][google.longrunning.Operation.metadata] will be
127  // [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata).
128  // Also see [Using
129  // WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
130  //
131  // On successful completion,
132  // [Operation.response][google.longrunning.Operation.response] will be
133  // [Empty][google.protobuf.Empty].
134  rpc InstantiateInlineWorkflowTemplate(
135      InstantiateInlineWorkflowTemplateRequest)
136      returns (google.longrunning.Operation) {
137    option (google.api.http) = {
138      post: "/v1/{parent=projects/*/locations/*}/workflowTemplates:instantiateInline"
139      body: "template"
140      additional_bindings {
141        post: "/v1/{parent=projects/*/regions/*}/workflowTemplates:instantiateInline"
142        body: "template"
143      }
144    };
145    option (google.api.method_signature) = "parent,template";
146    option (google.longrunning.operation_info) = {
147      response_type: "google.protobuf.Empty"
148      metadata_type: "WorkflowMetadata"
149    };
150  }
151
152  // Updates (replaces) workflow template. The updated template
153  // must contain version that matches the current server version.
154  rpc UpdateWorkflowTemplate(UpdateWorkflowTemplateRequest)
155      returns (WorkflowTemplate) {
156    option (google.api.http) = {
157      put: "/v1/{template.name=projects/*/locations/*/workflowTemplates/*}"
158      body: "template"
159      additional_bindings {
160        put: "/v1/{template.name=projects/*/regions/*/workflowTemplates/*}"
161        body: "template"
162      }
163    };
164    option (google.api.method_signature) = "template";
165  }
166
167  // Lists workflows that match the specified filter in the request.
168  rpc ListWorkflowTemplates(ListWorkflowTemplatesRequest)
169      returns (ListWorkflowTemplatesResponse) {
170    option (google.api.http) = {
171      get: "/v1/{parent=projects/*/locations/*}/workflowTemplates"
172      additional_bindings {
173        get: "/v1/{parent=projects/*/regions/*}/workflowTemplates"
174      }
175    };
176    option (google.api.method_signature) = "parent";
177  }
178
179  // Deletes a workflow template. It does not cancel in-progress workflows.
180  rpc DeleteWorkflowTemplate(DeleteWorkflowTemplateRequest)
181      returns (google.protobuf.Empty) {
182    option (google.api.http) = {
183      delete: "/v1/{name=projects/*/locations/*/workflowTemplates/*}"
184      additional_bindings {
185        delete: "/v1/{name=projects/*/regions/*/workflowTemplates/*}"
186      }
187    };
188    option (google.api.method_signature) = "name";
189  }
190}
191
192// A Dataproc workflow template resource.
193message WorkflowTemplate {
194  option (google.api.resource) = {
195    type: "dataproc.googleapis.com/WorkflowTemplate"
196    pattern: "projects/{project}/regions/{region}/workflowTemplates/{workflow_template}"
197    pattern: "projects/{project}/locations/{location}/workflowTemplates/{workflow_template}"
198    history: ORIGINALLY_SINGLE_PATTERN
199  };
200
201  string id = 2 [(google.api.field_behavior) = REQUIRED];
202
203  // Output only. The resource name of the workflow template, as described
204  // in https://cloud.google.com/apis/design/resource_names.
205  //
206  // * For `projects.regions.workflowTemplates`, the resource name of the
207  //   template has the following format:
208  //   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
209  //
210  // * For `projects.locations.workflowTemplates`, the resource name of the
211  //   template has the following format:
212  //   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
213  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
214
215  // Optional. Used to perform a consistent read-modify-write.
216  //
217  // This field should be left blank for a `CreateWorkflowTemplate` request. It
218  // is required for an `UpdateWorkflowTemplate` request, and must match the
219  // current server version. A typical update template flow would fetch the
220  // current template with a `GetWorkflowTemplate` request, which will return
221  // the current template with the `version` field filled in with the
222  // current server version. The user updates other fields in the template,
223  // then returns it as part of the `UpdateWorkflowTemplate` request.
224  int32 version = 3 [(google.api.field_behavior) = OPTIONAL];
225
226  // Output only. The time template was created.
227  google.protobuf.Timestamp create_time = 4
228      [(google.api.field_behavior) = OUTPUT_ONLY];
229
230  // Output only. The time template was last updated.
231  google.protobuf.Timestamp update_time = 5
232      [(google.api.field_behavior) = OUTPUT_ONLY];
233
234  // Optional. The labels to associate with this template. These labels
235  // will be propagated to all jobs and clusters created by the workflow
236  // instance.
237  //
238  // Label **keys** must contain 1 to 63 characters, and must conform to
239  // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
240  //
241  // Label **values** may be empty, but, if present, must contain 1 to 63
242  // characters, and must conform to
243  // [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
244  //
245  // No more than 32 labels can be associated with a template.
246  map<string, string> labels = 6 [(google.api.field_behavior) = OPTIONAL];
247
248  // Required. WorkflowTemplate scheduling information.
249  WorkflowTemplatePlacement placement = 7
250      [(google.api.field_behavior) = REQUIRED];
251
252  // Required. The Directed Acyclic Graph of Jobs to submit.
253  repeated OrderedJob jobs = 8 [(google.api.field_behavior) = REQUIRED];
254
255  // Optional. Template parameters whose values are substituted into the
256  // template. Values for parameters must be provided when the template is
257  // instantiated.
258  repeated TemplateParameter parameters = 9
259      [(google.api.field_behavior) = OPTIONAL];
260
261  // Optional. Timeout duration for the DAG of jobs, expressed in seconds (see
262  // [JSON representation of
263  // duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
264  // The timeout duration must be from 10 minutes ("600s") to 24 hours
265  // ("86400s"). The timer begins when the first job is submitted. If the
266  // workflow is running at the end of the timeout period, any remaining jobs
267  // are cancelled, the workflow is ended, and if the workflow was running on a
268  // [managed
269  // cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster),
270  // the cluster is deleted.
271  google.protobuf.Duration dag_timeout = 10
272      [(google.api.field_behavior) = OPTIONAL];
273}
274
275// Specifies workflow execution target.
276//
277// Either `managed_cluster` or `cluster_selector` is required.
278message WorkflowTemplatePlacement {
279  // Required. Specifies where workflow executes; either on a managed
280  // cluster or an existing cluster chosen by labels.
281  oneof placement {
282    // A cluster that is managed by the workflow.
283    ManagedCluster managed_cluster = 1;
284
285    // Optional. A selector that chooses target cluster for jobs based
286    // on metadata.
287    //
288    // The selector is evaluated at the time each job is submitted.
289    ClusterSelector cluster_selector = 2;
290  }
291}
292
293// Cluster that is managed by the workflow.
294message ManagedCluster {
295  // Required. The cluster name prefix. A unique cluster name will be formed by
296  // appending a random suffix.
297  //
298  // The name must contain only lower-case letters (a-z), numbers (0-9),
299  // and hyphens (-). Must begin with a letter. Cannot begin or end with
300  // hyphen. Must consist of between 2 and 35 characters.
301  string cluster_name = 2 [(google.api.field_behavior) = REQUIRED];
302
303  // Required. The cluster configuration.
304  ClusterConfig config = 3 [(google.api.field_behavior) = REQUIRED];
305
306  // Optional. The labels to associate with this cluster.
307  //
308  // Label keys must be between 1 and 63 characters long, and must conform to
309  // the following PCRE regular expression:
310  // [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
311  //
312  // Label values must be between 1 and 63 characters long, and must conform to
313  // the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
314  //
315  // No more than 32 labels can be associated with a given cluster.
316  map<string, string> labels = 4 [(google.api.field_behavior) = OPTIONAL];
317}
318
319// A selector that chooses target cluster for jobs based on metadata.
320message ClusterSelector {
321  // Optional. The zone where workflow process executes. This parameter does not
322  // affect the selection of the cluster.
323  //
324  // If unspecified, the zone of the first cluster matching the selector
325  // is used.
326  string zone = 1 [(google.api.field_behavior) = OPTIONAL];
327
328  // Required. The cluster labels. Cluster must have all labels
329  // to match.
330  map<string, string> cluster_labels = 2
331      [(google.api.field_behavior) = REQUIRED];
332}
333
334// A job executed by the workflow.
335message OrderedJob {
336  // Required. The step id. The id must be unique among all jobs
337  // within the template.
338  //
339  // The step id is used as prefix for job id, as job
340  // `goog-dataproc-workflow-step-id` label, and in
341  // [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]
342  // field from other steps.
343  //
344  // The id must contain only letters (a-z, A-Z), numbers (0-9),
345  // underscores (_), and hyphens (-). Cannot begin or end with underscore
346  // or hyphen. Must consist of between 3 and 50 characters.
347  string step_id = 1 [(google.api.field_behavior) = REQUIRED];
348
349  // Required. The job definition.
350  oneof job_type {
351    // Optional. Job is a Hadoop job.
352    HadoopJob hadoop_job = 2 [(google.api.field_behavior) = OPTIONAL];
353
354    // Optional. Job is a Spark job.
355    SparkJob spark_job = 3 [(google.api.field_behavior) = OPTIONAL];
356
357    // Optional. Job is a PySpark job.
358    PySparkJob pyspark_job = 4 [(google.api.field_behavior) = OPTIONAL];
359
360    // Optional. Job is a Hive job.
361    HiveJob hive_job = 5 [(google.api.field_behavior) = OPTIONAL];
362
363    // Optional. Job is a Pig job.
364    PigJob pig_job = 6 [(google.api.field_behavior) = OPTIONAL];
365
366    // Optional. Job is a SparkR job.
367    SparkRJob spark_r_job = 11 [(google.api.field_behavior) = OPTIONAL];
368
369    // Optional. Job is a SparkSql job.
370    SparkSqlJob spark_sql_job = 7 [(google.api.field_behavior) = OPTIONAL];
371
372    // Optional. Job is a Presto job.
373    PrestoJob presto_job = 12 [(google.api.field_behavior) = OPTIONAL];
374  }
375
376  // Optional. The labels to associate with this job.
377  //
378  // Label keys must be between 1 and 63 characters long, and must conform to
379  // the following regular expression:
380  // [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
381  //
382  // Label values must be between 1 and 63 characters long, and must conform to
383  // the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
384  //
385  // No more than 32 labels can be associated with a given job.
386  map<string, string> labels = 8 [(google.api.field_behavior) = OPTIONAL];
387
388  // Optional. Job scheduling configuration.
389  JobScheduling scheduling = 9 [(google.api.field_behavior) = OPTIONAL];
390
391  // Optional. The optional list of prerequisite job step_ids.
392  // If not specified, the job will start at the beginning of workflow.
393  repeated string prerequisite_step_ids = 10
394      [(google.api.field_behavior) = OPTIONAL];
395}
396
397// A configurable parameter that replaces one or more fields in the template.
398// Parameterizable fields:
399// - Labels
400// - File uris
401// - Job properties
402// - Job arguments
403// - Script variables
404// - Main class (in HadoopJob and SparkJob)
405// - Zone (in ClusterSelector)
406message TemplateParameter {
407  // Required. Parameter name.
408  // The parameter name is used as the key, and paired with the
409  // parameter value, which are passed to the template when the template
410  // is instantiated.
411  // The name must contain only capital letters (A-Z), numbers (0-9), and
412  // underscores (_), and must not start with a number. The maximum length is
413  // 40 characters.
414  string name = 1 [(google.api.field_behavior) = REQUIRED];
415
416  // Required. Paths to all fields that the parameter replaces.
417  // A field is allowed to appear in at most one parameter's list of field
418  // paths.
419  //
420  // A field path is similar in syntax to a
421  // [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a
422  // field path that references the zone field of a workflow template's cluster
423  // selector would be specified as `placement.clusterSelector.zone`.
424  //
425  // Also, field paths can reference fields using the following syntax:
426  //
427  // * Values in maps can be referenced by key:
428  //     * labels['key']
429  //     * placement.clusterSelector.clusterLabels['key']
430  //     * placement.managedCluster.labels['key']
431  //     * placement.clusterSelector.clusterLabels['key']
432  //     * jobs['step-id'].labels['key']
433  //
434  // * Jobs in the jobs list can be referenced by step-id:
435  //     * jobs['step-id'].hadoopJob.mainJarFileUri
436  //     * jobs['step-id'].hiveJob.queryFileUri
437  //     * jobs['step-id'].pySparkJob.mainPythonFileUri
438  //     * jobs['step-id'].hadoopJob.jarFileUris[0]
439  //     * jobs['step-id'].hadoopJob.archiveUris[0]
440  //     * jobs['step-id'].hadoopJob.fileUris[0]
441  //     * jobs['step-id'].pySparkJob.pythonFileUris[0]
442  //
443  // * Items in repeated fields can be referenced by a zero-based index:
444  //     * jobs['step-id'].sparkJob.args[0]
445  //
446  // * Other examples:
447  //     * jobs['step-id'].hadoopJob.properties['key']
448  //     * jobs['step-id'].hadoopJob.args[0]
449  //     * jobs['step-id'].hiveJob.scriptVariables['key']
450  //     * jobs['step-id'].hadoopJob.mainJarFileUri
451  //     * placement.clusterSelector.zone
452  //
453  // It may not be possible to parameterize maps and repeated fields in their
454  // entirety since only individual map values and individual items in repeated
455  // fields can be referenced. For example, the following field paths are
456  // invalid:
457  //
458  // - placement.clusterSelector.clusterLabels
459  // - jobs['step-id'].sparkJob.args
460  repeated string fields = 2 [(google.api.field_behavior) = REQUIRED];
461
462  // Optional. Brief description of the parameter.
463  // Must not exceed 1024 characters.
464  string description = 3 [(google.api.field_behavior) = OPTIONAL];
465
466  // Optional. Validation rules to be applied to this parameter's value.
467  ParameterValidation validation = 4 [(google.api.field_behavior) = OPTIONAL];
468}
469
470// Configuration for parameter validation.
471message ParameterValidation {
472  // Required. The type of validation to be performed.
473  oneof validation_type {
474    // Validation based on regular expressions.
475    RegexValidation regex = 1;
476
477    // Validation based on a list of allowed values.
478    ValueValidation values = 2;
479  }
480}
481
482// Validation based on regular expressions.
483message RegexValidation {
484  // Required. RE2 regular expressions used to validate the parameter's value.
485  // The value must match the regex in its entirety (substring
486  // matches are not sufficient).
487  repeated string regexes = 1 [(google.api.field_behavior) = REQUIRED];
488}
489
490// Validation based on a list of allowed values.
491message ValueValidation {
492  // Required. List of allowed values for the parameter.
493  repeated string values = 1 [(google.api.field_behavior) = REQUIRED];
494}
495
496// A Dataproc workflow template resource.
497message WorkflowMetadata {
498  // The operation state.
499  enum State {
500    // Unused.
501    UNKNOWN = 0;
502
503    // The operation has been created.
504    PENDING = 1;
505
506    // The operation is running.
507    RUNNING = 2;
508
509    // The operation is done; either cancelled or completed.
510    DONE = 3;
511  }
512
513  // Output only. The resource name of the workflow template as described
514  // in https://cloud.google.com/apis/design/resource_names.
515  //
516  // * For `projects.regions.workflowTemplates`, the resource name of the
517  //   template has the following format:
518  //   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
519  //
520  // * For `projects.locations.workflowTemplates`, the resource name of the
521  //   template has the following format:
522  //   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
523  string template = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
524
525  // Output only. The version of template at the time of
526  // workflow instantiation.
527  int32 version = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
528
529  // Output only. The create cluster operation metadata.
530  ClusterOperation create_cluster = 3
531      [(google.api.field_behavior) = OUTPUT_ONLY];
532
533  // Output only. The workflow graph.
534  WorkflowGraph graph = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
535
536  // Output only. The delete cluster operation metadata.
537  ClusterOperation delete_cluster = 5
538      [(google.api.field_behavior) = OUTPUT_ONLY];
539
540  // Output only. The workflow state.
541  State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
542
543  // Output only. The name of the target cluster.
544  string cluster_name = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
545
546  // Map from parameter names to values that were used for those parameters.
547  map<string, string> parameters = 8;
548
549  // Output only. Workflow start time.
550  google.protobuf.Timestamp start_time = 9
551      [(google.api.field_behavior) = OUTPUT_ONLY];
552
553  // Output only. Workflow end time.
554  google.protobuf.Timestamp end_time = 10
555      [(google.api.field_behavior) = OUTPUT_ONLY];
556
557  // Output only. The UUID of target cluster.
558  string cluster_uuid = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
559
560  // Output only. The timeout duration for the DAG of jobs, expressed in seconds
561  // (see [JSON representation of
562  // duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
563  google.protobuf.Duration dag_timeout = 12
564      [(google.api.field_behavior) = OUTPUT_ONLY];
565
566  // Output only. DAG start time, only set for workflows with
567  // [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
568  // DAG begins.
569  google.protobuf.Timestamp dag_start_time = 13
570      [(google.api.field_behavior) = OUTPUT_ONLY];
571
572  // Output only. DAG end time, only set for workflows with
573  // [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
574  // DAG ends.
575  google.protobuf.Timestamp dag_end_time = 14
576      [(google.api.field_behavior) = OUTPUT_ONLY];
577}
578
579// The cluster operation triggered by a workflow.
580message ClusterOperation {
581  // Output only. The id of the cluster operation.
582  string operation_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
583
584  // Output only. Error, if operation failed.
585  string error = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
586
587  // Output only. Indicates the operation is done.
588  bool done = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
589}
590
591// The workflow graph.
592message WorkflowGraph {
593  // Output only. The workflow nodes.
594  repeated WorkflowNode nodes = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
595}
596
597// The workflow node.
598message WorkflowNode {
599  // The workflow node state.
600  enum NodeState {
601    // State is unspecified.
602    NODE_STATE_UNSPECIFIED = 0;
603
604    // The node is awaiting prerequisite node to finish.
605    BLOCKED = 1;
606
607    // The node is runnable but not running.
608    RUNNABLE = 2;
609
610    // The node is running.
611    RUNNING = 3;
612
613    // The node completed successfully.
614    COMPLETED = 4;
615
616    // The node failed. A node can be marked FAILED because
617    // its ancestor or peer failed.
618    FAILED = 5;
619  }
620
621  // Output only. The name of the node.
622  string step_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
623
624  // Output only. Node's prerequisite nodes.
625  repeated string prerequisite_step_ids = 2
626      [(google.api.field_behavior) = OUTPUT_ONLY];
627
628  // Output only. The job id; populated after the node enters RUNNING state.
629  string job_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
630
631  // Output only. The node state.
632  NodeState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
633
634  // Output only. The error detail.
635  string error = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
636}
637
638// A request to create a workflow template.
639message CreateWorkflowTemplateRequest {
640  // Required. The resource name of the region or location, as described
641  // in https://cloud.google.com/apis/design/resource_names.
642  //
643  // * For `projects.regions.workflowTemplates.create`, the resource name of the
644  //   region has the following format:
645  //   `projects/{project_id}/regions/{region}`
646  //
647  // * For `projects.locations.workflowTemplates.create`, the resource name of
648  //   the location has the following format:
649  //   `projects/{project_id}/locations/{location}`
650  string parent = 1 [
651    (google.api.field_behavior) = REQUIRED,
652    (google.api.resource_reference) = {
653      child_type: "dataproc.googleapis.com/WorkflowTemplate"
654    }
655  ];
656
657  // Required. The Dataproc workflow template to create.
658  WorkflowTemplate template = 2 [(google.api.field_behavior) = REQUIRED];
659}
660
661// A request to fetch a workflow template.
662message GetWorkflowTemplateRequest {
663  // Required. The resource name of the workflow template, as described
664  // in https://cloud.google.com/apis/design/resource_names.
665  //
666  // * For `projects.regions.workflowTemplates.get`, the resource name of the
667  //   template has the following format:
668  //   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
669  //
670  // * For `projects.locations.workflowTemplates.get`, the resource name of the
671  //   template has the following format:
672  //   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
673  string name = 1 [
674    (google.api.field_behavior) = REQUIRED,
675    (google.api.resource_reference) = {
676      type: "dataproc.googleapis.com/WorkflowTemplate"
677    }
678  ];
679
680  // Optional. The version of workflow template to retrieve. Only previously
681  // instantiated versions can be retrieved.
682  //
683  // If unspecified, retrieves the current version.
684  int32 version = 2 [(google.api.field_behavior) = OPTIONAL];
685}
686
687// A request to instantiate a workflow template.
688message InstantiateWorkflowTemplateRequest {
689  // Required. The resource name of the workflow template, as described
690  // in https://cloud.google.com/apis/design/resource_names.
691  //
692  // * For `projects.regions.workflowTemplates.instantiate`, the resource name
693  // of the template has the following format:
694  //   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
695  //
696  // * For `projects.locations.workflowTemplates.instantiate`, the resource name
697  //   of the template has the following format:
698  //   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
699  string name = 1 [
700    (google.api.field_behavior) = REQUIRED,
701    (google.api.resource_reference) = {
702      type: "dataproc.googleapis.com/WorkflowTemplate"
703    }
704  ];
705
706  // Optional. The version of workflow template to instantiate. If specified,
707  // the workflow will be instantiated only if the current version of
708  // the workflow template has the supplied version.
709  //
710  // This option cannot be used to instantiate a previous version of
711  // workflow template.
712  int32 version = 2 [(google.api.field_behavior) = OPTIONAL];
713
714  // Optional. A tag that prevents multiple concurrent workflow
715  // instances with the same tag from running. This mitigates risk of
716  // concurrent instances started due to retries.
717  //
718  // It is recommended to always set this value to a
719  // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
720  //
721  // The tag must contain only letters (a-z, A-Z), numbers (0-9),
722  // underscores (_), and hyphens (-). The maximum length is 40 characters.
723  string request_id = 5 [(google.api.field_behavior) = OPTIONAL];
724
725  // Optional. Map from parameter names to values that should be used for those
726  // parameters. Values may not exceed 1000 characters.
727  map<string, string> parameters = 6 [(google.api.field_behavior) = OPTIONAL];
728}
729
730// A request to instantiate an inline workflow template.
731message InstantiateInlineWorkflowTemplateRequest {
732  // Required. The resource name of the region or location, as described
733  // in https://cloud.google.com/apis/design/resource_names.
734  //
735  // * For `projects.regions.workflowTemplates,instantiateinline`, the resource
736  //   name of the region has the following format:
737  //   `projects/{project_id}/regions/{region}`
738  //
739  // * For `projects.locations.workflowTemplates.instantiateinline`, the
740  //   resource name of the location has the following format:
741  //   `projects/{project_id}/locations/{location}`
742  string parent = 1 [
743    (google.api.field_behavior) = REQUIRED,
744    (google.api.resource_reference) = {
745      child_type: "dataproc.googleapis.com/WorkflowTemplate"
746    }
747  ];
748
749  // Required. The workflow template to instantiate.
750  WorkflowTemplate template = 2 [(google.api.field_behavior) = REQUIRED];
751
752  // Optional. A tag that prevents multiple concurrent workflow
753  // instances with the same tag from running. This mitigates risk of
754  // concurrent instances started due to retries.
755  //
756  // It is recommended to always set this value to a
757  // [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
758  //
759  // The tag must contain only letters (a-z, A-Z), numbers (0-9),
760  // underscores (_), and hyphens (-). The maximum length is 40 characters.
761  string request_id = 3 [(google.api.field_behavior) = OPTIONAL];
762}
763
764// A request to update a workflow template.
765message UpdateWorkflowTemplateRequest {
766  // Required. The updated workflow template.
767  //
768  // The `template.version` field must match the current version.
769  WorkflowTemplate template = 1 [(google.api.field_behavior) = REQUIRED];
770}
771
772// A request to list workflow templates in a project.
773message ListWorkflowTemplatesRequest {
774  // Required. The resource name of the region or location, as described
775  // in https://cloud.google.com/apis/design/resource_names.
776  //
777  // * For `projects.regions.workflowTemplates,list`, the resource
778  //   name of the region has the following format:
779  //   `projects/{project_id}/regions/{region}`
780  //
781  // * For `projects.locations.workflowTemplates.list`, the
782  //   resource name of the location has the following format:
783  //   `projects/{project_id}/locations/{location}`
784  string parent = 1 [
785    (google.api.field_behavior) = REQUIRED,
786    (google.api.resource_reference) = {
787      child_type: "dataproc.googleapis.com/WorkflowTemplate"
788    }
789  ];
790
791  // Optional. The maximum number of results to return in each response.
792  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
793
794  // Optional. The page token, returned by a previous call, to request the
795  // next page of results.
796  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
797}
798
799// A response to a request to list workflow templates in a project.
800message ListWorkflowTemplatesResponse {
801  // Output only. WorkflowTemplates list.
802  repeated WorkflowTemplate templates = 1
803      [(google.api.field_behavior) = OUTPUT_ONLY];
804
805  // Output only. This token is included in the response if there are more
806  // results to fetch. To fetch additional results, provide this value as the
807  // page_token in a subsequent <code>ListWorkflowTemplatesRequest</code>.
808  string next_page_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
809}
810
811// A request to delete a workflow template.
812//
813// Currently started workflows will remain running.
814message DeleteWorkflowTemplateRequest {
815  // Required. The resource name of the workflow template, as described
816  // in https://cloud.google.com/apis/design/resource_names.
817  //
818  // * For `projects.regions.workflowTemplates.delete`, the resource name
819  // of the template has the following format:
820  //   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
821  //
822  // * For `projects.locations.workflowTemplates.instantiate`, the resource name
823  //   of the template has the following format:
824  //   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
825  string name = 1 [
826    (google.api.field_behavior) = REQUIRED,
827    (google.api.resource_reference) = {
828      type: "dataproc.googleapis.com/WorkflowTemplate"
829    }
830  ];
831
832  // Optional. The version of workflow template to delete. If specified,
833  // will only delete the template if the current server version matches
834  // specified version.
835  int32 version = 2 [(google.api.field_behavior) = OPTIONAL];
836}
837