templates.proto 21 KB

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