xref: /aosp_15_r20/external/googleapis/google/dataflow/v1beta3/templates.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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/jobs.proto";
23import "google/rpc/status.proto";
24
25option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3";
26option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb";
27option java_multiple_files = true;
28option java_outer_classname = "TemplatesProto";
29option java_package = "com.google.dataflow.v1beta3";
30option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3";
31option ruby_package = "Google::Cloud::Dataflow::V1beta3";
32
33// Provides a method to create Cloud Dataflow jobs from templates.
34service TemplatesService {
35  option (google.api.default_host) = "dataflow.googleapis.com";
36  option (google.api.oauth_scopes) =
37      "https://www.googleapis.com/auth/cloud-platform,"
38      "https://www.googleapis.com/auth/compute,"
39      "https://www.googleapis.com/auth/compute.readonly,"
40      "https://www.googleapis.com/auth/userinfo.email";
41
42  // Creates a Cloud Dataflow job from a template.
43  rpc CreateJobFromTemplate(CreateJobFromTemplateRequest) returns (Job) {
44    option (google.api.http) = {
45      post: "/v1b3/projects/{project_id}/locations/{location}/templates"
46      body: "*"
47      additional_bindings {
48        post: "/v1b3/projects/{project_id}/templates"
49        body: "*"
50      }
51    };
52  }
53
54  // Launch a template.
55  rpc LaunchTemplate(LaunchTemplateRequest) returns (LaunchTemplateResponse) {
56    option (google.api.http) = {
57      post: "/v1b3/projects/{project_id}/locations/{location}/templates:launch"
58      body: "launch_parameters"
59      additional_bindings {
60        post: "/v1b3/projects/{project_id}/templates:launch"
61        body: "launch_parameters"
62      }
63    };
64  }
65
66  // Get the template associated with a template.
67  rpc GetTemplate(GetTemplateRequest) returns (GetTemplateResponse) {
68    option (google.api.http) = {
69      get: "/v1b3/projects/{project_id}/locations/{location}/templates:get"
70      additional_bindings {
71        get: "/v1b3/projects/{project_id}/templates:get"
72      }
73    };
74  }
75}
76
77// Provides a service for Flex templates. This feature is not ready yet.
78service FlexTemplatesService {
79  option (google.api.default_host) = "dataflow.googleapis.com";
80  option (google.api.oauth_scopes) =
81      "https://www.googleapis.com/auth/cloud-platform,"
82      "https://www.googleapis.com/auth/compute,"
83      "https://www.googleapis.com/auth/compute.readonly,"
84      "https://www.googleapis.com/auth/userinfo.email";
85
86  // Launch a job with a FlexTemplate.
87  rpc LaunchFlexTemplate(LaunchFlexTemplateRequest) returns (LaunchFlexTemplateResponse) {
88    option (google.api.http) = {
89      post: "/v1b3/projects/{project_id}/locations/{location}/flexTemplates:launch"
90      body: "*"
91    };
92  }
93}
94
95// Response to the request to launch a job from Flex Template.
96message LaunchFlexTemplateResponse {
97  // The job that was launched, if the request was not a dry run and
98  // the job was successfully launched.
99  Job job = 1;
100}
101
102// Container Spec.
103message ContainerSpec {
104  // Name of the docker container image. E.g., gcr.io/project/some-image
105  string image = 1;
106
107  // Metadata describing a template including description and validation rules.
108  TemplateMetadata metadata = 2;
109
110  // Required. SDK info of the Flex Template.
111  SDKInfo sdk_info = 3;
112
113  // Default runtime environment for the job.
114  FlexTemplateRuntimeEnvironment default_environment = 4;
115}
116
117// Launch FlexTemplate Parameter.
118message LaunchFlexTemplateParameter {
119  // Required. The job name to use for the created job. For update job request,
120  // job name should be same as the existing running job.
121  string job_name = 1;
122
123  // Launch Mechanism.
124  oneof template {
125    // Spec about the container image to launch.
126    ContainerSpec container_spec = 4;
127
128    // Cloud Storage path to a file with json serialized ContainerSpec as
129    // content.
130    string container_spec_gcs_path = 5;
131  }
132
133  // The parameters for FlexTemplate.
134  // Ex. {"num_workers":"5"}
135  map<string, string> parameters = 2;
136
137  // Launch options for this flex template job. This is a common set of options
138  // across languages and templates. This should not be used to pass job
139  // parameters.
140  map<string, string> launch_options = 6;
141
142  // The runtime environment for the FlexTemplate job
143  FlexTemplateRuntimeEnvironment environment = 7;
144
145  // Set this to true if you are sending a request to update a running
146  // streaming job. When set, the job name should be the same as the
147  // running job.
148  bool update = 8;
149
150  // Use this to pass transform_name_mappings for streaming update jobs.
151  // Ex:{"oldTransformName":"newTransformName",...}'
152  map<string, string> transform_name_mappings = 9;
153}
154
155// The environment values to be set at runtime for flex template.
156message FlexTemplateRuntimeEnvironment {
157  // The initial number of Google Compute Engine instances for the job.
158  int32 num_workers = 1;
159
160  // The maximum number of Google Compute Engine instances to be made
161  // available to your pipeline during execution, from 1 to 1000.
162  int32 max_workers = 2;
163
164  // The Compute Engine [availability
165  // zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones)
166  // for launching worker instances to run your pipeline.
167  // In the future, worker_zone will take precedence.
168  string zone = 3;
169
170  // The email address of the service account to run the job as.
171  string service_account_email = 4;
172
173  // The Cloud Storage path to use for temporary files.
174  // Must be a valid Cloud Storage URL, beginning with `gs://`.
175  string temp_location = 5;
176
177  // The machine type to use for the job. Defaults to the value from the
178  // template if not specified.
179  string machine_type = 6;
180
181  // Additional experiment flags for the job.
182  repeated string additional_experiments = 7;
183
184  // Network to which VMs will be assigned.  If empty or unspecified,
185  // the service will use the network "default".
186  string network = 8;
187
188  // Subnetwork to which VMs will be assigned, if desired. You can specify a
189  // subnetwork using either a complete URL or an abbreviated path. Expected to
190  // be of the form
191  // "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK"
192  // or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in
193  // a Shared VPC network, you must use the complete URL.
194  string subnetwork = 9;
195
196  // Additional user labels to be specified for the job.
197  // Keys and values must follow the restrictions specified in the [labeling
198  // restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
199  // page.
200  // An object containing a list of "key": value pairs.
201  // Example: { "name": "wrench", "mass": "1kg", "count": "3" }.
202  map<string, string> additional_user_labels = 10;
203
204  // Name for the Cloud KMS key for the job.
205  // Key format is:
206  // projects/<project>/locations/<location>/keyRings/<keyring>/cryptoKeys/<key>
207  string kms_key_name = 11;
208
209  // Configuration for VM IPs.
210  WorkerIPAddressConfiguration ip_configuration = 12;
211
212  // The Compute Engine region
213  // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in
214  // which worker processing should occur, e.g. "us-west1". Mutually exclusive
215  // with worker_zone. If neither worker_region nor worker_zone is specified,
216  // default to the control plane's region.
217  string worker_region = 13;
218
219  // The Compute Engine zone
220  // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in
221  // which worker processing should occur, e.g. "us-west1-a". Mutually exclusive
222  // with worker_region. If neither worker_region nor worker_zone is specified,
223  // a zone in the control plane's region is chosen based on available capacity.
224  // If both `worker_zone` and `zone` are set, `worker_zone` takes precedence.
225  string worker_zone = 14;
226
227  // Whether to enable Streaming Engine for the job.
228  bool enable_streaming_engine = 15;
229
230  // Set FlexRS goal for the job.
231  // https://cloud.google.com/dataflow/docs/guides/flexrs
232  FlexResourceSchedulingGoal flexrs_goal = 16;
233
234  // The Cloud Storage path for staging local files.
235  // Must be a valid Cloud Storage URL, beginning with `gs://`.
236  string staging_location = 17;
237
238  // Docker registry location of container image to use for the 'worker harness.
239  // Default is the container for the version of the SDK. Note this field is
240  // only valid for portable pipelines.
241  string sdk_container_image = 18;
242
243  // Worker disk size, in gigabytes.
244  int32 disk_size_gb = 20;
245
246  // The algorithm to use for autoscaling
247  AutoscalingAlgorithm autoscaling_algorithm = 21;
248
249  // If true, save a heap dump before killing a thread or process which is GC
250  // thrashing or out of memory. The location of the heap file will either be
251  // echoed back to the user, or the user will be given the opportunity to
252  // download the heap file.
253  bool dump_heap_on_oom = 22;
254
255  // Cloud Storage bucket (directory) to upload heap dumps to the given
256  // location. Enabling this implies that heap dumps should be generated on OOM
257  // (dump_heap_on_oom is set to true).
258  string save_heap_dumps_to_gcs_path = 23;
259
260  // The machine type to use for launching the job. The default is
261  // n1-standard-1.
262  string launcher_machine_type = 24;
263}
264
265// A request to launch a Cloud Dataflow job from a FlexTemplate.
266message LaunchFlexTemplateRequest {
267  // Required. The ID of the Cloud Platform project that the job belongs to.
268  string project_id = 1;
269
270  // Required. Parameter to launch a job form Flex Template.
271  LaunchFlexTemplateParameter launch_parameter = 2;
272
273  // Required. The [regional endpoint]
274  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
275  // which to direct the request. E.g., us-central1, us-west1.
276  string location = 3;
277
278  // If true, the request is validated but not actually executed.
279  // Defaults to false.
280  bool validate_only = 4;
281}
282
283// The environment values to set at runtime.
284message RuntimeEnvironment {
285  // The initial number of Google Compute Engine instnaces for the job.
286  int32 num_workers = 11;
287
288  // The maximum number of Google Compute Engine instances to be made
289  // available to your pipeline during execution, from 1 to 1000.
290  int32 max_workers = 1;
291
292  // The Compute Engine [availability
293  // zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones)
294  // for launching worker instances to run your pipeline.
295  // In the future, worker_zone will take precedence.
296  string zone = 2;
297
298  // The email address of the service account to run the job as.
299  string service_account_email = 3;
300
301  // The Cloud Storage path to use for temporary files.
302  // Must be a valid Cloud Storage URL, beginning with `gs://`.
303  string temp_location = 4;
304
305  // Whether to bypass the safety checks for the job's temporary directory.
306  // Use with caution.
307  bool bypass_temp_dir_validation = 5;
308
309  // The machine type to use for the job. Defaults to the value from the
310  // template if not specified.
311  string machine_type = 6;
312
313  // Additional experiment flags for the job, specified with the
314  // `--experiments` option.
315  repeated string additional_experiments = 7;
316
317  // Network to which VMs will be assigned.  If empty or unspecified,
318  // the service will use the network "default".
319  string network = 8;
320
321  // Subnetwork to which VMs will be assigned, if desired. You can specify a
322  // subnetwork using either a complete URL or an abbreviated path. Expected to
323  // be of the form
324  // "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK"
325  // or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in
326  // a Shared VPC network, you must use the complete URL.
327  string subnetwork = 9;
328
329  // Additional user labels to be specified for the job.
330  // Keys and values should follow the restrictions specified in the [labeling
331  // restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
332  // page.
333  // An object containing a list of "key": value pairs.
334  // Example: { "name": "wrench", "mass": "1kg", "count": "3" }.
335  map<string, string> additional_user_labels = 10;
336
337  // Name for the Cloud KMS key for the job.
338  // Key format is:
339  // projects/<project>/locations/<location>/keyRings/<keyring>/cryptoKeys/<key>
340  string kms_key_name = 12;
341
342  // Configuration for VM IPs.
343  WorkerIPAddressConfiguration ip_configuration = 14;
344
345  // The Compute Engine region
346  // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in
347  // which worker processing should occur, e.g. "us-west1". Mutually exclusive
348  // with worker_zone. If neither worker_region nor worker_zone is specified,
349  // default to the control plane's region.
350  string worker_region = 15;
351
352  // The Compute Engine zone
353  // (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in
354  // which worker processing should occur, e.g. "us-west1-a". Mutually exclusive
355  // with worker_region. If neither worker_region nor worker_zone is specified,
356  // a zone in the control plane's region is chosen based on available capacity.
357  // If both `worker_zone` and `zone` are set, `worker_zone` takes precedence.
358  string worker_zone = 16;
359
360  // Whether to enable Streaming Engine for the job.
361  bool enable_streaming_engine = 17;
362}
363
364// Metadata for a specific parameter.
365message ParameterMetadata {
366  // Required. The name of the parameter.
367  string name = 1;
368
369  // Required. The label to display for the parameter.
370  string label = 2;
371
372  // Required. The help text to display for the parameter.
373  string help_text = 3;
374
375  // Optional. Whether the parameter is optional. Defaults to false.
376  bool is_optional = 4;
377
378  // Optional. Regexes that the parameter must match.
379  repeated string regexes = 5;
380
381  // Optional. The type of the parameter.
382  // Used for selecting input picker.
383  ParameterType param_type = 6;
384
385  // Optional. Additional metadata for describing this parameter.
386  map<string, string> custom_metadata = 7;
387}
388
389// ParameterType specifies what kind of input we need for this parameter.
390enum ParameterType {
391  // Default input type.
392  DEFAULT = 0;
393
394  // The parameter specifies generic text input.
395  TEXT = 1;
396
397  // The parameter specifies a Cloud Storage Bucket to read from.
398  GCS_READ_BUCKET = 2;
399
400  // The parameter specifies a Cloud Storage Bucket to write to.
401  GCS_WRITE_BUCKET = 3;
402
403  // The parameter specifies a Cloud Storage file path to read from.
404  GCS_READ_FILE = 4;
405
406  // The parameter specifies a Cloud Storage file path to write to.
407  GCS_WRITE_FILE = 5;
408
409  // The parameter specifies a Cloud Storage folder path to read from.
410  GCS_READ_FOLDER = 6;
411
412  // The parameter specifies a Cloud Storage folder to write to.
413  GCS_WRITE_FOLDER = 7;
414
415  // The parameter specifies a Pub/Sub Topic.
416  PUBSUB_TOPIC = 8;
417
418  // The parameter specifies a Pub/Sub Subscription.
419  PUBSUB_SUBSCRIPTION = 9;
420}
421
422// Metadata describing a template.
423message TemplateMetadata {
424  // Required. The name of the template.
425  string name = 1;
426
427  // Optional. A description of the template.
428  string description = 2;
429
430  // The parameters for the template.
431  repeated ParameterMetadata parameters = 3;
432}
433
434// SDK Information.
435message SDKInfo {
436  // SDK Language.
437  enum Language {
438    // UNKNOWN Language.
439    UNKNOWN = 0;
440
441    // Java.
442    JAVA = 1;
443
444    // Python.
445    PYTHON = 2;
446  }
447
448  // Required. The SDK Language.
449  Language language = 1;
450
451  // Optional. The SDK version.
452  string version = 2;
453}
454
455// RuntimeMetadata describing a runtime environment.
456message RuntimeMetadata {
457  // SDK Info for the template.
458  SDKInfo sdk_info = 1;
459
460  // The parameters for the template.
461  repeated ParameterMetadata parameters = 2;
462}
463
464// A request to create a Cloud Dataflow job from a template.
465message CreateJobFromTemplateRequest {
466  // Required. The ID of the Cloud Platform project that the job belongs to.
467  string project_id = 1;
468
469  // Required. The job name to use for the created job.
470  string job_name = 4;
471
472  // The template from which to create the job.
473  oneof template {
474    // Required. A Cloud Storage path to the template from which to
475    // create the job.
476    // Must be a valid Cloud Storage URL, beginning with `gs://`.
477    string gcs_path = 2;
478  }
479
480  // The runtime parameters to pass to the job.
481  map<string, string> parameters = 3;
482
483  // The runtime environment for the job.
484  RuntimeEnvironment environment = 5;
485
486  // The [regional endpoint]
487  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
488  // which to direct the request.
489  string location = 6;
490}
491
492// A request to retrieve a Cloud Dataflow job template.
493message GetTemplateRequest {
494  // The various views of a template that may be retrieved.
495  enum TemplateView {
496    // Template view that retrieves only the metadata associated with the
497    // template.
498    METADATA_ONLY = 0;
499  }
500
501  // Required. The ID of the Cloud Platform project that the job belongs to.
502  string project_id = 1;
503
504  // The template from which to create the job.
505  oneof template {
506    // Required. A Cloud Storage path to the template from which to
507    // create the job.
508    // Must be valid Cloud Storage URL, beginning with 'gs://'.
509    string gcs_path = 2;
510  }
511
512  // The view to retrieve. Defaults to METADATA_ONLY.
513  TemplateView view = 3;
514
515  // The [regional endpoint]
516  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
517  // which to direct the request.
518  string location = 4;
519}
520
521// The response to a GetTemplate request.
522message GetTemplateResponse {
523  // Template Type.
524  enum TemplateType {
525    // Unknown Template Type.
526    UNKNOWN = 0;
527
528    // Legacy Template.
529    LEGACY = 1;
530
531    // Flex Template.
532    FLEX = 2;
533  }
534
535  // The status of the get template request. Any problems with the
536  // request will be indicated in the error_details.
537  google.rpc.Status status = 1;
538
539  // The template metadata describing the template name, available
540  // parameters, etc.
541  TemplateMetadata metadata = 2;
542
543  // Template Type.
544  TemplateType template_type = 3;
545
546  // Describes the runtime metadata with SDKInfo and available parameters.
547  RuntimeMetadata runtime_metadata = 4;
548}
549
550// Parameters to provide to the template being launched.
551message LaunchTemplateParameters {
552  // Required. The job name to use for the created job.
553  string job_name = 1;
554
555  // The runtime parameters to pass to the job.
556  map<string, string> parameters = 2;
557
558  // The runtime environment for the job.
559  RuntimeEnvironment environment = 3;
560
561  // If set, replace the existing pipeline with the name specified by jobName
562  // with this pipeline, preserving state.
563  bool update = 4;
564
565  // Only applicable when updating a pipeline. Map of transform name prefixes of
566  // the job to be replaced to the corresponding name prefixes of the new job.
567  map<string, string> transform_name_mapping = 5;
568}
569
570// A request to launch a template.
571message LaunchTemplateRequest {
572  // Required. The ID of the Cloud Platform project that the job belongs to.
573  string project_id = 1;
574
575  // If true, the request is validated but not actually executed.
576  // Defaults to false.
577  bool validate_only = 2;
578
579  // The template from which to create the job.
580  oneof template {
581    // A Cloud Storage path to the template from which to create
582    // the job.
583    // Must be valid Cloud Storage URL, beginning with 'gs://'.
584    string gcs_path = 3;
585
586    // Params for launching a dynamic template.
587    DynamicTemplateLaunchParams dynamic_template = 6;
588  }
589
590  // The parameters of the template to launch. This should be part of the
591  // body of the POST request.
592  LaunchTemplateParameters launch_parameters = 4;
593
594  // The [regional endpoint]
595  // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to
596  // which to direct the request.
597  string location = 5;
598}
599
600// Response to the request to launch a template.
601message LaunchTemplateResponse {
602  // The job that was launched, if the request was not a dry run and
603  // the job was successfully launched.
604  Job job = 1;
605}
606
607// Used in the error_details field of a google.rpc.Status message, this
608// indicates problems with the template parameter.
609message InvalidTemplateParameters {
610  // A specific template-parameter violation.
611  message ParameterViolation {
612    // The parameter that failed to validate.
613    string parameter = 1;
614
615    // A description of why the parameter failed to validate.
616    string description = 2;
617  }
618
619  // Describes all parameter violations in a template request.
620  repeated ParameterViolation parameter_violations = 1;
621}
622
623// Params which should be passed when launching a dynamic template.
624message DynamicTemplateLaunchParams {
625  // Path to dynamic template spec file on Cloud Storage.
626  // The file must be a Json serialized DynamicTemplateFieSpec object.
627  string gcs_path = 1;
628
629  // Cloud Storage path for staging dependencies.
630  // Must be a valid Cloud Storage URL, beginning with `gs://`.
631  string staging_location = 2;
632}
633