templates.proto 19 KB

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