• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.dataflow.v1beta3;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/dataflow/v1beta3/environment.proto";
22import "google/dataflow/v1beta3/snapshots.proto";
23import "google/protobuf/duration.proto";
24import "google/protobuf/struct.proto";
25import "google/protobuf/timestamp.proto";
26
27option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3";
28option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb";
29option java_multiple_files = true;
30option java_outer_classname = "JobsProto";
31option java_package = "com.google.dataflow.v1beta3";
32option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3";
33option ruby_package = "Google::Cloud::Dataflow::V1beta3";
34
35// Provides a method to create and modify Google Cloud Dataflow jobs.
36// A Job is a multi-stage computation graph run by the Cloud Dataflow service.
37service JobsV1Beta3 {
38  option (google.api.default_host) = "dataflow.googleapis.com";
39  option (google.api.oauth_scopes) =
40      "https://www.googleapis.com/auth/cloud-platform,"
41      "https://www.googleapis.com/auth/compute,"
42      "https://www.googleapis.com/auth/compute.readonly,"
43      "https://www.googleapis.com/auth/userinfo.email";
44
45  // Creates a Cloud Dataflow job.
46  //
47  // To create a job, we recommend using `projects.locations.jobs.create` with a
48  // [regional endpoint]
49  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using
50  // `projects.jobs.create` is not recommended, as your job will always start
51  // in `us-central1`.
52  rpc CreateJob(CreateJobRequest) returns (Job) {
53    option (google.api.http) = {
54      post: "/v1b3/projects/{project_id}/locations/{location}/jobs"
55      body: "job"
56      additional_bindings {
57        post: "/v1b3/projects/{project_id}/jobs"
58        body: "job"
59      }
60    };
61  }
62
63  // Gets the state of the specified Cloud Dataflow job.
64  //
65  // To get the state of a job, we recommend using `projects.locations.jobs.get`
66  // with a [regional endpoint]
67  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using
68  // `projects.jobs.get` is not recommended, as you can only get the state of
69  // jobs that are running in `us-central1`.
70  rpc GetJob(GetJobRequest) returns (Job) {
71    option (google.api.http) = {
72      get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}"
73      additional_bindings {
74        get: "/v1b3/projects/{project_id}/jobs/{job_id}"
75      }
76    };
77  }
78
79  // Updates the state of an existing Cloud Dataflow job.
80  //
81  // To update the state of an existing job, we recommend using
82  // `projects.locations.jobs.update` with a [regional endpoint]
83  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using
84  // `projects.jobs.update` is not recommended, as you can only update the state
85  // of jobs that are running in `us-central1`.
86  rpc UpdateJob(UpdateJobRequest) returns (Job) {
87    option (google.api.http) = {
88      put: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}"
89      body: "job"
90      additional_bindings {
91        put: "/v1b3/projects/{project_id}/jobs/{job_id}"
92        body: "job"
93      }
94    };
95  }
96
97  // List the jobs of a project.
98  //
99  // To list the jobs of a project in a region, we recommend using
100  // `projects.locations.jobs.list` with a [regional endpoint]
101  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). To
102  // list the all jobs across all regions, use `projects.jobs.aggregated`. Using
103  // `projects.jobs.list` is not recommended, as you can only get the list of
104  // jobs that are running in `us-central1`.
105  rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) {
106    option (google.api.http) = {
107      get: "/v1b3/projects/{project_id}/locations/{location}/jobs"
108      additional_bindings {
109        get: "/v1b3/projects/{project_id}/jobs"
110      }
111    };
112  }
113
114  // List the jobs of a project across all regions.
115  rpc AggregatedListJobs(ListJobsRequest) returns (ListJobsResponse) {
116    option (google.api.http) = {
117      get: "/v1b3/projects/{project_id}/jobs:aggregated"
118    };
119  }
120
121  // Check for existence of active jobs in the given project across all regions.
122  rpc CheckActiveJobs(CheckActiveJobsRequest) returns (CheckActiveJobsResponse) {
123  }
124
125  // Snapshot the state of a streaming job.
126  rpc SnapshotJob(SnapshotJobRequest) returns (Snapshot) {
127    option (google.api.http) = {
128      post: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}:snapshot"
129      body: "*"
130      additional_bindings {
131        post: "/v1b3/projects/{project_id}/jobs/{job_id}:snapshot"
132        body: "*"
133      }
134    };
135  }
136}
137
138// Defines a job to be run by the Cloud Dataflow service.
139message Job {
140  // The unique ID of this job.
141  //
142  // This field is set by the Cloud Dataflow service when the Job is
143  // created, and is immutable for the life of the job.
144  string id = 1;
145
146  // The ID of the Cloud Platform project that the job belongs to.
147  string project_id = 2;
148
149  // The user-specified Cloud Dataflow job name.
150  //
151  // Only one Job with a given name may exist in a project at any
152  // given time. If a caller attempts to create a Job with the same
153  // name as an already-existing Job, the attempt returns the
154  // existing Job.
155  //
156  // The name must match the regular expression
157  // `[a-z]([-a-z0-9]{0,1022}[a-z0-9])?`
158  string name = 3;
159
160  // The type of Cloud Dataflow job.
161  JobType type = 4;
162
163  // The environment for the job.
164  Environment environment = 5;
165
166  // Exactly one of step or steps_location should be specified.
167  //
168  // The top-level steps that constitute the entire job. Only retrieved with
169  // JOB_VIEW_ALL.
170  repeated Step steps = 6;
171
172  // The Cloud Storage location where the steps are stored.
173  string steps_location = 24;
174
175  // The current state of the job.
176  //
177  // Jobs are created in the `JOB_STATE_STOPPED` state unless otherwise
178  // specified.
179  //
180  // A job in the `JOB_STATE_RUNNING` state may asynchronously enter a
181  // terminal state. After a job has reached a terminal state, no
182  // further state updates may be made.
183  //
184  // This field may be mutated by the Cloud Dataflow service;
185  // callers cannot mutate it.
186  JobState current_state = 7;
187
188  // The timestamp associated with the current state.
189  google.protobuf.Timestamp current_state_time = 8;
190
191  // The job's requested state.
192  //
193  // `UpdateJob` may be used to switch between the `JOB_STATE_STOPPED` and
194  // `JOB_STATE_RUNNING` states, by setting requested_state.  `UpdateJob` may
195  // also be used to directly set a job's requested state to
196  // `JOB_STATE_CANCELLED` or `JOB_STATE_DONE`, irrevocably terminating the
197  // job if it has not already reached a terminal state.
198  JobState requested_state = 9;
199
200  // Deprecated.
201  JobExecutionInfo execution_info = 10;
202
203  // The timestamp when the job was initially created. Immutable and set by the
204  // Cloud Dataflow service.
205  google.protobuf.Timestamp create_time = 11;
206
207  // If this job is an update of an existing job, this field is the job ID
208  // of the job it replaced.
209  //
210  // When sending a `CreateJobRequest`, you can update a job by specifying it
211  // here. The job named here is stopped, and its intermediate state is
212  // transferred to this job.
213  string replace_job_id = 12;
214
215  // The map of transform name prefixes of the job to be replaced to the
216  // corresponding name prefixes of the new job.
217  map<string, string> transform_name_mapping = 13;
218
219  // The client's unique identifier of the job, re-used across retried attempts.
220  // If this field is set, the service will ensure its uniqueness.
221  // The request to create a job will fail if the service has knowledge of a
222  // previously submitted job with the same client's ID and job name.
223  // The caller may use this field to ensure idempotence of job
224  // creation across retried attempts to create a job.
225  // By default, the field is empty and, in that case, the service ignores it.
226  string client_request_id = 14;
227
228  // If another job is an update of this job (and thus, this job is in
229  // `JOB_STATE_UPDATED`), this field contains the ID of that job.
230  string replaced_by_job_id = 15;
231
232  // A set of files the system should be aware of that are used
233  // for temporary storage. These temporary files will be
234  // removed on job completion.
235  // No duplicates are allowed.
236  // No file patterns are supported.
237  //
238  // The supported files are:
239  //
240  // Google Cloud Storage:
241  //
242  //    storage.googleapis.com/{bucket}/{object}
243  //    bucket.storage.googleapis.com/{object}
244  repeated string temp_files = 16;
245
246  // User-defined labels for this job.
247  //
248  // The labels map can contain no more than 64 entries.  Entries of the labels
249  // map are UTF8 strings that comply with the following restrictions:
250  //
251  // * Keys must conform to regexp:  [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
252  // * Values must conform to regexp:  [\p{Ll}\p{Lo}\p{N}_-]{0,63}
253  // * Both keys and values are additionally constrained to be <= 128 bytes in
254  // size.
255  map<string, string> labels = 17;
256
257  // The [regional endpoint]
258  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
259  // contains this job.
260  string location = 18;
261
262  // Preliminary field: The format of this data may change at any time.
263  // A description of the user pipeline and stages through which it is executed.
264  // Created by Cloud Dataflow service.  Only retrieved with
265  // JOB_VIEW_DESCRIPTION or JOB_VIEW_ALL.
266  PipelineDescription pipeline_description = 19;
267
268  // This field may be mutated by the Cloud Dataflow service;
269  // callers cannot mutate it.
270  repeated ExecutionStageState stage_states = 20;
271
272  // This field is populated by the Dataflow service to support filtering jobs
273  // by the metadata values provided here. Populated for ListJobs and all GetJob
274  // views SUMMARY and higher.
275  JobMetadata job_metadata = 21;
276
277  // The timestamp when the job was started (transitioned to JOB_STATE_PENDING).
278  // Flexible resource scheduling jobs are started with some delay after job
279  // creation, so start_time is unset before start and is updated when the
280  // job is started by the Cloud Dataflow service. For other jobs, start_time
281  // always equals to create_time and is immutable and set by the Cloud Dataflow
282  // service.
283  google.protobuf.Timestamp start_time = 22;
284
285  // If this is specified, the job's initial state is populated from the given
286  // snapshot.
287  string created_from_snapshot_id = 23;
288
289  // Reserved for future use. This field is set only in responses from the
290  // server; it is ignored if it is set in any requests.
291  bool satisfies_pzs = 25;
292}
293
294// Metadata for a Datastore connector used by the job.
295message DatastoreIODetails {
296  // Namespace used in the connection.
297  string namespace = 1;
298
299  // ProjectId accessed in the connection.
300  string project_id = 2;
301}
302
303// Metadata for a Pub/Sub connector used by the job.
304message PubSubIODetails {
305  // Topic accessed in the connection.
306  string topic = 1;
307
308  // Subscription used in the connection.
309  string subscription = 2;
310}
311
312// Metadata for a File connector used by the job.
313message FileIODetails {
314  // File Pattern used to access files by the connector.
315  string file_pattern = 1;
316}
317
318// Metadata for a Cloud Bigtable connector used by the job.
319message BigTableIODetails {
320  // ProjectId accessed in the connection.
321  string project_id = 1;
322
323  // InstanceId accessed in the connection.
324  string instance_id = 2;
325
326  // TableId accessed in the connection.
327  string table_id = 3;
328}
329
330// Metadata for a BigQuery connector used by the job.
331message BigQueryIODetails {
332  // Table accessed in the connection.
333  string table = 1;
334
335  // Dataset accessed in the connection.
336  string dataset = 2;
337
338  // Project accessed in the connection.
339  string project_id = 3;
340
341  // Query used to access data in the connection.
342  string query = 4;
343}
344
345// Metadata for a Spanner connector used by the job.
346message SpannerIODetails {
347  // ProjectId accessed in the connection.
348  string project_id = 1;
349
350  // InstanceId accessed in the connection.
351  string instance_id = 2;
352
353  // DatabaseId accessed in the connection.
354  string database_id = 3;
355}
356
357// The version of the SDK used to run the job.
358message SdkVersion {
359  // The support status of the SDK used to run the job.
360  enum SdkSupportStatus {
361    // Cloud Dataflow is unaware of this version.
362    UNKNOWN = 0;
363
364    // This is a known version of an SDK, and is supported.
365    SUPPORTED = 1;
366
367    // A newer version of the SDK family exists, and an update is recommended.
368    STALE = 2;
369
370    // This version of the SDK is deprecated and will eventually be
371    // unsupported.
372    DEPRECATED = 3;
373
374    // Support for this SDK version has ended and it should no longer be used.
375    UNSUPPORTED = 4;
376  }
377
378  // The version of the SDK used to run the job.
379  string version = 1;
380
381  // A readable string describing the version of the SDK.
382  string version_display_name = 2;
383
384  // The support status for this SDK version.
385  SdkSupportStatus sdk_support_status = 3;
386}
387
388// Metadata available primarily for filtering jobs. Will be included in the
389// ListJob response and Job SUMMARY view.
390message JobMetadata {
391  // The SDK version used to run the job.
392  SdkVersion sdk_version = 1;
393
394  // Identification of a Spanner source used in the Dataflow job.
395  repeated SpannerIODetails spanner_details = 2;
396
397  // Identification of a BigQuery source used in the Dataflow job.
398  repeated BigQueryIODetails bigquery_details = 3;
399
400  // Identification of a Cloud Bigtable source used in the Dataflow job.
401  repeated BigTableIODetails big_table_details = 4;
402
403  // Identification of a Pub/Sub source used in the Dataflow job.
404  repeated PubSubIODetails pubsub_details = 5;
405
406  // Identification of a File source used in the Dataflow job.
407  repeated FileIODetails file_details = 6;
408
409  // Identification of a Datastore source used in the Dataflow job.
410  repeated DatastoreIODetails datastore_details = 7;
411}
412
413// A message describing the state of a particular execution stage.
414message ExecutionStageState {
415  // The name of the execution stage.
416  string execution_stage_name = 1;
417
418  // Executions stage states allow the same set of values as JobState.
419  JobState execution_stage_state = 2;
420
421  // The time at which the stage transitioned to this state.
422  google.protobuf.Timestamp current_state_time = 3;
423}
424
425// A descriptive representation of submitted pipeline as well as the executed
426// form.  This data is provided by the Dataflow service for ease of visualizing
427// the pipeline and interpreting Dataflow provided metrics.
428message PipelineDescription {
429  // Description of each transform in the pipeline and collections between them.
430  repeated TransformSummary original_pipeline_transform = 1;
431
432  // Description of each stage of execution of the pipeline.
433  repeated ExecutionStageSummary execution_pipeline_stage = 2;
434
435  // Pipeline level display data.
436  repeated DisplayData display_data = 3;
437}
438
439// Type of transform or stage operation.
440enum KindType {
441  // Unrecognized transform type.
442  UNKNOWN_KIND = 0;
443
444  // ParDo transform.
445  PAR_DO_KIND = 1;
446
447  // Group By Key transform.
448  GROUP_BY_KEY_KIND = 2;
449
450  // Flatten transform.
451  FLATTEN_KIND = 3;
452
453  // Read transform.
454  READ_KIND = 4;
455
456  // Write transform.
457  WRITE_KIND = 5;
458
459  // Constructs from a constant value, such as with Create.of.
460  CONSTANT_KIND = 6;
461
462  // Creates a Singleton view of a collection.
463  SINGLETON_KIND = 7;
464
465  // Opening or closing a shuffle session, often as part of a GroupByKey.
466  SHUFFLE_KIND = 8;
467}
468
469// Description of the type, names/ids, and input/outputs for a transform.
470message TransformSummary {
471  // Type of transform.
472  KindType kind = 1;
473
474  // SDK generated id of this transform instance.
475  string id = 2;
476
477  // User provided name for this transform instance.
478  string name = 3;
479
480  // Transform-specific display data.
481  repeated DisplayData display_data = 4;
482
483  // User  names for all collection outputs to this transform.
484  repeated string output_collection_name = 5;
485
486  // User names for all collection inputs to this transform.
487  repeated string input_collection_name = 6;
488}
489
490// Description of the composing transforms, names/ids, and input/outputs of a
491// stage of execution.  Some composing transforms and sources may have been
492// generated by the Dataflow service during execution planning.
493message ExecutionStageSummary {
494  // Description of an input or output of an execution stage.
495  message StageSource {
496    // Human-readable name for this source; may be user or system generated.
497    string user_name = 1;
498
499    // Dataflow service generated name for this source.
500    string name = 2;
501
502    // User name for the original user transform or collection with which this
503    // source is most closely associated.
504    string original_transform_or_collection = 3;
505
506    // Size of the source, if measurable.
507    int64 size_bytes = 4;
508  }
509
510  // Description of a transform executed as part of an execution stage.
511  message ComponentTransform {
512    // Human-readable name for this transform; may be user or system generated.
513    string user_name = 1;
514
515    // Dataflow service generated name for this source.
516    string name = 2;
517
518    // User name for the original user transform with which this transform is
519    // most closely associated.
520    string original_transform = 3;
521  }
522
523  // Description of an interstitial value between transforms in an execution
524  // stage.
525  message ComponentSource {
526    // Human-readable name for this transform; may be user or system generated.
527    string user_name = 1;
528
529    // Dataflow service generated name for this source.
530    string name = 2;
531
532    // User name for the original user transform or collection with which this
533    // source is most closely associated.
534    string original_transform_or_collection = 3;
535  }
536
537  // Dataflow service generated name for this stage.
538  string name = 1;
539
540  // Dataflow service generated id for this stage.
541  string id = 2;
542
543  // Type of transform this stage is executing.
544  KindType kind = 3;
545
546  // Input sources for this stage.
547  repeated StageSource input_source = 4;
548
549  // Output sources for this stage.
550  repeated StageSource output_source = 5;
551
552  // Other stages that must complete before this stage can run.
553  repeated string prerequisite_stage = 8;
554
555  // Transforms that comprise this execution stage.
556  repeated ComponentTransform component_transform = 6;
557
558  // Collections produced and consumed by component transforms of this stage.
559  repeated ComponentSource component_source = 7;
560}
561
562// Data provided with a pipeline or transform to provide descriptive info.
563message DisplayData {
564  // The key identifying the display data.
565  // This is intended to be used as a label for the display data
566  // when viewed in a dax monitoring system.
567  string key = 1;
568
569  // The namespace for the key. This is usually a class name or programming
570  // language namespace (i.e. python module) which defines the display data.
571  // This allows a dax monitoring system to specially handle the data
572  // and perform custom rendering.
573  string namespace = 2;
574
575  // Various value types which can be used for display data.  Only one will be
576  // set.
577  oneof Value {
578    // Contains value if the data is of string type.
579    string str_value = 4;
580
581    // Contains value if the data is of int64 type.
582    int64 int64_value = 5;
583
584    // Contains value if the data is of float type.
585    float float_value = 6;
586
587    // Contains value if the data is of java class type.
588    string java_class_value = 7;
589
590    // Contains value if the data is of timestamp type.
591    google.protobuf.Timestamp timestamp_value = 8;
592
593    // Contains value if the data is of duration type.
594    google.protobuf.Duration duration_value = 9;
595
596    // Contains value if the data is of a boolean type.
597    bool bool_value = 10;
598  }
599
600  // A possible additional shorter value to display.
601  // For example a java_class_name_value of com.mypackage.MyDoFn
602  // will be stored with MyDoFn as the short_str_value and
603  // com.mypackage.MyDoFn as the java_class_name value.
604  // short_str_value can be displayed and java_class_name_value
605  // will be displayed as a tooltip.
606  string short_str_value = 11;
607
608  // An optional full URL.
609  string url = 12;
610
611  // An optional label to display in a dax UI for the element.
612  string label = 13;
613}
614
615// Defines a particular step within a Cloud Dataflow job.
616//
617// A job consists of multiple steps, each of which performs some
618// specific operation as part of the overall job.  Data is typically
619// passed from one step to another as part of the job.
620//
621// Here's an example of a sequence of steps which together implement a
622// Map-Reduce job:
623//
624//   * Read a collection of data from some source, parsing the
625//     collection's elements.
626//
627//   * Validate the elements.
628//
629//   * Apply a user-defined function to map each element to some value
630//     and extract an element-specific key value.
631//
632//   * Group elements with the same key into a single element with
633//     that key, transforming a multiply-keyed collection into a
634//     uniquely-keyed collection.
635//
636//   * Write the elements out to some data sink.
637//
638// Note that the Cloud Dataflow service may be used to run many different
639// types of jobs, not just Map-Reduce.
640message Step {
641  // The kind of step in the Cloud Dataflow job.
642  string kind = 1;
643
644  // The name that identifies the step. This must be unique for each
645  // step with respect to all other steps in the Cloud Dataflow job.
646  string name = 2;
647
648  // Named properties associated with the step. Each kind of
649  // predefined step has its own required set of properties.
650  // Must be provided on Create.  Only retrieved with JOB_VIEW_ALL.
651  google.protobuf.Struct properties = 3;
652}
653
654// Describes the overall state of a [google.dataflow.v1beta3.Job][google.dataflow.v1beta3.Job].
655enum JobState {
656  // The job's run state isn't specified.
657  JOB_STATE_UNKNOWN = 0;
658
659  // `JOB_STATE_STOPPED` indicates that the job has not
660  // yet started to run.
661  JOB_STATE_STOPPED = 1;
662
663  // `JOB_STATE_RUNNING` indicates that the job is currently running.
664  JOB_STATE_RUNNING = 2;
665
666  // `JOB_STATE_DONE` indicates that the job has successfully completed.
667  // This is a terminal job state.  This state may be set by the Cloud Dataflow
668  // service, as a transition from `JOB_STATE_RUNNING`. It may also be set via a
669  // Cloud Dataflow `UpdateJob` call, if the job has not yet reached a terminal
670  // state.
671  JOB_STATE_DONE = 3;
672
673  // `JOB_STATE_FAILED` indicates that the job has failed.  This is a
674  // terminal job state.  This state may only be set by the Cloud Dataflow
675  // service, and only as a transition from `JOB_STATE_RUNNING`.
676  JOB_STATE_FAILED = 4;
677
678  // `JOB_STATE_CANCELLED` indicates that the job has been explicitly
679  // cancelled. This is a terminal job state. This state may only be
680  // set via a Cloud Dataflow `UpdateJob` call, and only if the job has not
681  // yet reached another terminal state.
682  JOB_STATE_CANCELLED = 5;
683
684  // `JOB_STATE_UPDATED` indicates that the job was successfully updated,
685  // meaning that this job was stopped and another job was started, inheriting
686  // state from this one. This is a terminal job state. This state may only be
687  // set by the Cloud Dataflow service, and only as a transition from
688  // `JOB_STATE_RUNNING`.
689  JOB_STATE_UPDATED = 6;
690
691  // `JOB_STATE_DRAINING` indicates that the job is in the process of draining.
692  // A draining job has stopped pulling from its input sources and is processing
693  // any data that remains in-flight. This state may be set via a Cloud Dataflow
694  // `UpdateJob` call, but only as a transition from `JOB_STATE_RUNNING`. Jobs
695  // that are draining may only transition to `JOB_STATE_DRAINED`,
696  // `JOB_STATE_CANCELLED`, or `JOB_STATE_FAILED`.
697  JOB_STATE_DRAINING = 7;
698
699  // `JOB_STATE_DRAINED` indicates that the job has been drained.
700  // A drained job terminated by stopping pulling from its input sources and
701  // processing any data that remained in-flight when draining was requested.
702  // This state is a terminal state, may only be set by the Cloud Dataflow
703  // service, and only as a transition from `JOB_STATE_DRAINING`.
704  JOB_STATE_DRAINED = 8;
705
706  // `JOB_STATE_PENDING` indicates that the job has been created but is not yet
707  // running.  Jobs that are pending may only transition to `JOB_STATE_RUNNING`,
708  // or `JOB_STATE_FAILED`.
709  JOB_STATE_PENDING = 9;
710
711  // `JOB_STATE_CANCELLING` indicates that the job has been explicitly cancelled
712  // and is in the process of stopping.  Jobs that are cancelling may only
713  // transition to `JOB_STATE_CANCELLED` or `JOB_STATE_FAILED`.
714  JOB_STATE_CANCELLING = 10;
715
716  // `JOB_STATE_QUEUED` indicates that the job has been created but is being
717  // delayed until launch. Jobs that are queued may only transition to
718  // `JOB_STATE_PENDING` or `JOB_STATE_CANCELLED`.
719  JOB_STATE_QUEUED = 11;
720
721  // `JOB_STATE_RESOURCE_CLEANING_UP` indicates that the batch job's associated
722  // resources are currently being cleaned up after a successful run.
723  // Currently, this is an opt-in feature, please reach out to Cloud support
724  // team if you are interested.
725  JOB_STATE_RESOURCE_CLEANING_UP = 12;
726}
727
728// Additional information about how a Cloud Dataflow job will be executed that
729// isn't contained in the submitted job.
730message JobExecutionInfo {
731  // A mapping from each stage to the information about that stage.
732  map<string, JobExecutionStageInfo> stages = 1;
733}
734
735// Contains information about how a particular
736// [google.dataflow.v1beta3.Step][google.dataflow.v1beta3.Step] will be executed.
737message JobExecutionStageInfo {
738  // The steps associated with the execution stage.
739  // Note that stages may have several steps, and that a given step
740  // might be run by more than one stage.
741  repeated string step_name = 1;
742}
743
744// Selector for how much information is returned in Job responses.
745enum JobView {
746  // The job view to return isn't specified, or is unknown.
747  // Responses will contain at least the `JOB_VIEW_SUMMARY` information,
748  // and may contain additional information.
749  JOB_VIEW_UNKNOWN = 0;
750
751  // Request summary information only:
752  // Project ID, Job ID, job name, job type, job status, start/end time,
753  // and Cloud SDK version details.
754  JOB_VIEW_SUMMARY = 1;
755
756  // Request all information available for this job.
757  JOB_VIEW_ALL = 2;
758
759  // Request summary info and limited job description data for steps, labels and
760  // environment.
761  JOB_VIEW_DESCRIPTION = 3;
762}
763
764// Request to create a Cloud Dataflow job.
765message CreateJobRequest {
766  // The ID of the Cloud Platform project that the job belongs to.
767  string project_id = 1;
768
769  // The job to create.
770  Job job = 2;
771
772  // The level of information requested in response.
773  JobView view = 3;
774
775  // Deprecated. This field is now in the Job message.
776  string replace_job_id = 4;
777
778  // The [regional endpoint]
779  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
780  // contains this job.
781  string location = 5;
782}
783
784// Request to get the state of a Cloud Dataflow job.
785message GetJobRequest {
786  // The ID of the Cloud Platform project that the job belongs to.
787  string project_id = 1;
788
789  // The job ID.
790  string job_id = 2;
791
792  // The level of information requested in response.
793  JobView view = 3;
794
795  // The [regional endpoint]
796  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
797  // contains this job.
798  string location = 4;
799}
800
801// Request to update a Cloud Dataflow job.
802message UpdateJobRequest {
803  // The ID of the Cloud Platform project that the job belongs to.
804  string project_id = 1;
805
806  // The job ID.
807  string job_id = 2;
808
809  // The updated job.
810  // Only the job state is updatable; other fields will be ignored.
811  Job job = 3;
812
813  // The [regional endpoint]
814  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
815  // contains this job.
816  string location = 4;
817}
818
819// Request to list Cloud Dataflow jobs.
820message ListJobsRequest {
821  // This field filters out and returns jobs in the specified job state. The
822  // order of data returned is determined by the filter used, and is subject to
823  // change.
824  enum Filter {
825    // The filter isn't specified, or is unknown. This returns all jobs ordered
826    // on descending `JobUuid`.
827    UNKNOWN = 0;
828
829    // Returns all running jobs first ordered on creation timestamp, then
830    // returns all terminated jobs ordered on the termination timestamp.
831    ALL = 1;
832
833    // Filters the jobs that have a terminated state, ordered on the
834    // termination timestamp. Example terminated states: `JOB_STATE_STOPPED`,
835    // `JOB_STATE_UPDATED`, `JOB_STATE_DRAINED`, etc.
836    TERMINATED = 2;
837
838    // Filters the jobs that are running ordered on the creation timestamp.
839    ACTIVE = 3;
840  }
841
842  // The kind of filter to use.
843  Filter filter = 5;
844
845  // The project which owns the jobs.
846  string project_id = 1;
847
848  // Deprecated. ListJobs always returns summaries now.
849  // Use GetJob for other JobViews.
850  JobView view = 2 [deprecated = true];
851
852  // If there are many jobs, limit response to at most this many.
853  // The actual number of jobs returned will be the lesser of max_responses
854  // and an unspecified server-defined limit.
855  int32 page_size = 3;
856
857  // Set this to the 'next_page_token' field of a previous response
858  // to request additional results in a long list.
859  string page_token = 4;
860
861  // The [regional endpoint]
862  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
863  // contains this job.
864  string location = 17;
865}
866
867// Indicates which [regional endpoint]
868// (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) failed
869// to respond to a request for data.
870message FailedLocation {
871  // The name of the [regional endpoint]
872  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
873  // failed to respond.
874  string name = 1;
875}
876
877// Response to a request to list Cloud Dataflow jobs in a project. This might
878// be a partial response, depending on the page size in the ListJobsRequest.
879// However, if the project does not have any jobs, an instance of
880// ListJobsResponse is not returned and the requests's response
881// body is empty {}.
882message ListJobsResponse {
883  // A subset of the requested job information.
884  repeated Job jobs = 1;
885
886  // Set if there may be more results than fit in this response.
887  string next_page_token = 2;
888
889  // Zero or more messages describing the [regional endpoints]
890  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that
891  // failed to respond.
892  repeated FailedLocation failed_location = 3;
893}
894
895// Request to create a snapshot of a job.
896message SnapshotJobRequest {
897  // The project which owns the job to be snapshotted.
898  string project_id = 1;
899
900  // The job to be snapshotted.
901  string job_id = 2;
902
903  // TTL for the snapshot.
904  google.protobuf.Duration ttl = 3;
905
906  // The location that contains this job.
907  string location = 4;
908
909  // If true, perform snapshots for sources which support this.
910  bool snapshot_sources = 5;
911
912  // User specified description of the snapshot. Maybe empty.
913  string description = 6;
914}
915
916// Request to check is active jobs exists for a project
917message CheckActiveJobsRequest {
918  // The project which owns the jobs.
919  string project_id = 1;
920}
921
922// Response for CheckActiveJobsRequest.
923message CheckActiveJobsResponse {
924  // If True, active jobs exists for project. False otherwise.
925  bool active_jobs_exist = 1;
926}
927