google_cloud_dataproc_v1/model.rs
1// Copyright 2025 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// https://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//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate gtype;
25extern crate iam_v1;
26extern crate lazy_static;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Describes an autoscaling policy for Dataproc cluster autoscaler.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct AutoscalingPolicy {
45 /// Required. The policy id.
46 ///
47 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
48 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
49 /// or hyphen. Must consist of between 3 and 50 characters.
50 pub id: std::string::String,
51
52 /// Output only. The "resource name" of the autoscaling policy, as described
53 /// in <https://cloud.google.com/apis/design/resource_names>.
54 ///
55 /// * For `projects.regions.autoscalingPolicies`, the resource name of the
56 /// policy has the following format:
57 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
58 ///
59 /// * For `projects.locations.autoscalingPolicies`, the resource name of the
60 /// policy has the following format:
61 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
62 ///
63 pub name: std::string::String,
64
65 /// Required. Describes how the autoscaler will operate for primary workers.
66 pub worker_config: std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
67
68 /// Optional. Describes how the autoscaler will operate for secondary workers.
69 pub secondary_worker_config:
70 std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
71
72 /// Optional. The labels to associate with this autoscaling policy.
73 /// Label **keys** must contain 1 to 63 characters, and must conform to
74 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
75 /// Label **values** may be empty, but, if present, must contain 1 to 63
76 /// characters, and must conform to [RFC
77 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
78 /// associated with an autoscaling policy.
79 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
80
81 /// Autoscaling algorithm for policy.
82 pub algorithm: std::option::Option<crate::model::autoscaling_policy::Algorithm>,
83
84 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
85}
86
87impl AutoscalingPolicy {
88 pub fn new() -> Self {
89 std::default::Default::default()
90 }
91
92 /// Sets the value of [id][crate::model::AutoscalingPolicy::id].
93 ///
94 /// # Example
95 /// ```ignore,no_run
96 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
97 /// let x = AutoscalingPolicy::new().set_id("example");
98 /// ```
99 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
100 self.id = v.into();
101 self
102 }
103
104 /// Sets the value of [name][crate::model::AutoscalingPolicy::name].
105 ///
106 /// # Example
107 /// ```ignore,no_run
108 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
109 /// let x = AutoscalingPolicy::new().set_name("example");
110 /// ```
111 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
112 self.name = v.into();
113 self
114 }
115
116 /// Sets the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
117 ///
118 /// # Example
119 /// ```ignore,no_run
120 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
121 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
122 /// let x = AutoscalingPolicy::new().set_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
123 /// ```
124 pub fn set_worker_config<T>(mut self, v: T) -> Self
125 where
126 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
127 {
128 self.worker_config = std::option::Option::Some(v.into());
129 self
130 }
131
132 /// Sets or clears the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
133 ///
134 /// # Example
135 /// ```ignore,no_run
136 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
137 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
138 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
139 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
140 /// ```
141 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
142 where
143 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
144 {
145 self.worker_config = v.map(|x| x.into());
146 self
147 }
148
149 /// Sets the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
150 ///
151 /// # Example
152 /// ```ignore,no_run
153 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
154 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
155 /// let x = AutoscalingPolicy::new().set_secondary_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
156 /// ```
157 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
158 where
159 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
160 {
161 self.secondary_worker_config = std::option::Option::Some(v.into());
162 self
163 }
164
165 /// Sets or clears the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
166 ///
167 /// # Example
168 /// ```ignore,no_run
169 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
170 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
171 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
172 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
173 /// ```
174 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
175 where
176 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
177 {
178 self.secondary_worker_config = v.map(|x| x.into());
179 self
180 }
181
182 /// Sets the value of [labels][crate::model::AutoscalingPolicy::labels].
183 ///
184 /// # Example
185 /// ```ignore,no_run
186 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
187 /// let x = AutoscalingPolicy::new().set_labels([
188 /// ("key0", "abc"),
189 /// ("key1", "xyz"),
190 /// ]);
191 /// ```
192 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
193 where
194 T: std::iter::IntoIterator<Item = (K, V)>,
195 K: std::convert::Into<std::string::String>,
196 V: std::convert::Into<std::string::String>,
197 {
198 use std::iter::Iterator;
199 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
200 self
201 }
202
203 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm].
204 ///
205 /// Note that all the setters affecting `algorithm` are mutually
206 /// exclusive.
207 ///
208 /// # Example
209 /// ```ignore,no_run
210 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
211 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
212 /// let x = AutoscalingPolicy::new().set_algorithm(Some(
213 /// google_cloud_dataproc_v1::model::autoscaling_policy::Algorithm::BasicAlgorithm(BasicAutoscalingAlgorithm::default().into())));
214 /// ```
215 pub fn set_algorithm<
216 T: std::convert::Into<std::option::Option<crate::model::autoscaling_policy::Algorithm>>,
217 >(
218 mut self,
219 v: T,
220 ) -> Self {
221 self.algorithm = v.into();
222 self
223 }
224
225 /// The value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
226 /// if it holds a `BasicAlgorithm`, `None` if the field is not set or
227 /// holds a different branch.
228 pub fn basic_algorithm(
229 &self,
230 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>> {
231 #[allow(unreachable_patterns)]
232 self.algorithm.as_ref().and_then(|v| match v {
233 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v) => {
234 std::option::Option::Some(v)
235 }
236 _ => std::option::Option::None,
237 })
238 }
239
240 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
241 /// to hold a `BasicAlgorithm`.
242 ///
243 /// Note that all the setters affecting `algorithm` are
244 /// mutually exclusive.
245 ///
246 /// # Example
247 /// ```ignore,no_run
248 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
249 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
250 /// let x = AutoscalingPolicy::new().set_basic_algorithm(BasicAutoscalingAlgorithm::default()/* use setters */);
251 /// assert!(x.basic_algorithm().is_some());
252 /// ```
253 pub fn set_basic_algorithm<
254 T: std::convert::Into<std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>>,
255 >(
256 mut self,
257 v: T,
258 ) -> Self {
259 self.algorithm = std::option::Option::Some(
260 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v.into()),
261 );
262 self
263 }
264}
265
266impl wkt::message::Message for AutoscalingPolicy {
267 fn typename() -> &'static str {
268 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingPolicy"
269 }
270}
271
272/// Defines additional types related to [AutoscalingPolicy].
273pub mod autoscaling_policy {
274 #[allow(unused_imports)]
275 use super::*;
276
277 /// Autoscaling algorithm for policy.
278 #[derive(Clone, Debug, PartialEq)]
279 #[non_exhaustive]
280 pub enum Algorithm {
281 BasicAlgorithm(std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>),
282 }
283}
284
285/// Basic algorithm for autoscaling.
286#[derive(Clone, Default, PartialEq)]
287#[non_exhaustive]
288pub struct BasicAutoscalingAlgorithm {
289 /// Optional. Duration between scaling events. A scaling period starts after
290 /// the update operation from the previous event has completed.
291 ///
292 /// Bounds: [2m, 1d]. Default: 2m.
293 pub cooldown_period: std::option::Option<wkt::Duration>,
294
295 pub config: std::option::Option<crate::model::basic_autoscaling_algorithm::Config>,
296
297 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
298}
299
300impl BasicAutoscalingAlgorithm {
301 pub fn new() -> Self {
302 std::default::Default::default()
303 }
304
305 /// Sets the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
306 ///
307 /// # Example
308 /// ```ignore,no_run
309 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
310 /// use wkt::Duration;
311 /// let x = BasicAutoscalingAlgorithm::new().set_cooldown_period(Duration::default()/* use setters */);
312 /// ```
313 pub fn set_cooldown_period<T>(mut self, v: T) -> Self
314 where
315 T: std::convert::Into<wkt::Duration>,
316 {
317 self.cooldown_period = std::option::Option::Some(v.into());
318 self
319 }
320
321 /// Sets or clears the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
322 ///
323 /// # Example
324 /// ```ignore,no_run
325 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
326 /// use wkt::Duration;
327 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(Some(Duration::default()/* use setters */));
328 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(None::<Duration>);
329 /// ```
330 pub fn set_or_clear_cooldown_period<T>(mut self, v: std::option::Option<T>) -> Self
331 where
332 T: std::convert::Into<wkt::Duration>,
333 {
334 self.cooldown_period = v.map(|x| x.into());
335 self
336 }
337
338 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config].
339 ///
340 /// Note that all the setters affecting `config` are mutually
341 /// exclusive.
342 ///
343 /// # Example
344 /// ```ignore,no_run
345 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
346 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
347 /// let x = BasicAutoscalingAlgorithm::new().set_config(Some(
348 /// google_cloud_dataproc_v1::model::basic_autoscaling_algorithm::Config::YarnConfig(BasicYarnAutoscalingConfig::default().into())));
349 /// ```
350 pub fn set_config<
351 T: std::convert::Into<std::option::Option<crate::model::basic_autoscaling_algorithm::Config>>,
352 >(
353 mut self,
354 v: T,
355 ) -> Self {
356 self.config = v.into();
357 self
358 }
359
360 /// The value of [config][crate::model::BasicAutoscalingAlgorithm::config]
361 /// if it holds a `YarnConfig`, `None` if the field is not set or
362 /// holds a different branch.
363 pub fn yarn_config(
364 &self,
365 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>> {
366 #[allow(unreachable_patterns)]
367 self.config.as_ref().and_then(|v| match v {
368 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v) => {
369 std::option::Option::Some(v)
370 }
371 _ => std::option::Option::None,
372 })
373 }
374
375 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config]
376 /// to hold a `YarnConfig`.
377 ///
378 /// Note that all the setters affecting `config` are
379 /// mutually exclusive.
380 ///
381 /// # Example
382 /// ```ignore,no_run
383 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
384 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
385 /// let x = BasicAutoscalingAlgorithm::new().set_yarn_config(BasicYarnAutoscalingConfig::default()/* use setters */);
386 /// assert!(x.yarn_config().is_some());
387 /// ```
388 pub fn set_yarn_config<
389 T: std::convert::Into<std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>>,
390 >(
391 mut self,
392 v: T,
393 ) -> Self {
394 self.config = std::option::Option::Some(
395 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v.into()),
396 );
397 self
398 }
399}
400
401impl wkt::message::Message for BasicAutoscalingAlgorithm {
402 fn typename() -> &'static str {
403 "type.googleapis.com/google.cloud.dataproc.v1.BasicAutoscalingAlgorithm"
404 }
405}
406
407/// Defines additional types related to [BasicAutoscalingAlgorithm].
408pub mod basic_autoscaling_algorithm {
409 #[allow(unused_imports)]
410 use super::*;
411
412 #[derive(Clone, Debug, PartialEq)]
413 #[non_exhaustive]
414 pub enum Config {
415 /// Required. YARN autoscaling configuration.
416 YarnConfig(std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>),
417 }
418}
419
420/// Basic autoscaling configurations for YARN.
421#[derive(Clone, Default, PartialEq)]
422#[non_exhaustive]
423pub struct BasicYarnAutoscalingConfig {
424 /// Required. Timeout for YARN graceful decommissioning of Node Managers.
425 /// Specifies the duration to wait for jobs to complete before forcefully
426 /// removing workers (and potentially interrupting jobs). Only applicable to
427 /// downscaling operations.
428 ///
429 /// Bounds: [0s, 1d].
430 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
431
432 /// Required. Fraction of average YARN pending memory in the last cooldown
433 /// period for which to add workers. A scale-up factor of 1.0 will result in
434 /// scaling up so that there is no pending memory remaining after the update
435 /// (more aggressive scaling). A scale-up factor closer to 0 will result in a
436 /// smaller magnitude of scaling up (less aggressive scaling). See [How
437 /// autoscaling
438 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
439 /// for more information.
440 ///
441 /// Bounds: [0.0, 1.0].
442 pub scale_up_factor: f64,
443
444 /// Required. Fraction of average YARN pending memory in the last cooldown
445 /// period for which to remove workers. A scale-down factor of 1 will result in
446 /// scaling down so that there is no available memory remaining after the
447 /// update (more aggressive scaling). A scale-down factor of 0 disables
448 /// removing workers, which can be beneficial for autoscaling a single job.
449 /// See [How autoscaling
450 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
451 /// for more information.
452 ///
453 /// Bounds: [0.0, 1.0].
454 pub scale_down_factor: f64,
455
456 /// Optional. Minimum scale-up threshold as a fraction of total cluster size
457 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
458 /// 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
459 /// the cluster to scale. A threshold of 0 means the autoscaler will scale up
460 /// on any recommended change.
461 ///
462 /// Bounds: [0.0, 1.0]. Default: 0.0.
463 pub scale_up_min_worker_fraction: f64,
464
465 /// Optional. Minimum scale-down threshold as a fraction of total cluster size
466 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
467 /// 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
468 /// the cluster to scale. A threshold of 0 means the autoscaler will scale down
469 /// on any recommended change.
470 ///
471 /// Bounds: [0.0, 1.0]. Default: 0.0.
472 pub scale_down_min_worker_fraction: f64,
473
474 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
475}
476
477impl BasicYarnAutoscalingConfig {
478 pub fn new() -> Self {
479 std::default::Default::default()
480 }
481
482 /// Sets the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
483 ///
484 /// # Example
485 /// ```ignore,no_run
486 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
487 /// use wkt::Duration;
488 /// let x = BasicYarnAutoscalingConfig::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
489 /// ```
490 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
491 where
492 T: std::convert::Into<wkt::Duration>,
493 {
494 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
495 self
496 }
497
498 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
499 ///
500 /// # Example
501 /// ```ignore,no_run
502 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
503 /// use wkt::Duration;
504 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
505 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
506 /// ```
507 pub fn set_or_clear_graceful_decommission_timeout<T>(
508 mut self,
509 v: std::option::Option<T>,
510 ) -> Self
511 where
512 T: std::convert::Into<wkt::Duration>,
513 {
514 self.graceful_decommission_timeout = v.map(|x| x.into());
515 self
516 }
517
518 /// Sets the value of [scale_up_factor][crate::model::BasicYarnAutoscalingConfig::scale_up_factor].
519 ///
520 /// # Example
521 /// ```ignore,no_run
522 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
523 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_factor(42.0);
524 /// ```
525 pub fn set_scale_up_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
526 self.scale_up_factor = v.into();
527 self
528 }
529
530 /// Sets the value of [scale_down_factor][crate::model::BasicYarnAutoscalingConfig::scale_down_factor].
531 ///
532 /// # Example
533 /// ```ignore,no_run
534 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
535 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_factor(42.0);
536 /// ```
537 pub fn set_scale_down_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
538 self.scale_down_factor = v.into();
539 self
540 }
541
542 /// Sets the value of [scale_up_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_up_min_worker_fraction].
543 ///
544 /// # Example
545 /// ```ignore,no_run
546 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
547 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_min_worker_fraction(42.0);
548 /// ```
549 pub fn set_scale_up_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
550 self.scale_up_min_worker_fraction = v.into();
551 self
552 }
553
554 /// Sets the value of [scale_down_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_down_min_worker_fraction].
555 ///
556 /// # Example
557 /// ```ignore,no_run
558 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
559 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_min_worker_fraction(42.0);
560 /// ```
561 pub fn set_scale_down_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
562 self.scale_down_min_worker_fraction = v.into();
563 self
564 }
565}
566
567impl wkt::message::Message for BasicYarnAutoscalingConfig {
568 fn typename() -> &'static str {
569 "type.googleapis.com/google.cloud.dataproc.v1.BasicYarnAutoscalingConfig"
570 }
571}
572
573/// Configuration for the size bounds of an instance group, including its
574/// proportional size to other groups.
575#[derive(Clone, Default, PartialEq)]
576#[non_exhaustive]
577pub struct InstanceGroupAutoscalingPolicyConfig {
578 /// Optional. Minimum number of instances for this group.
579 ///
580 /// Primary workers - Bounds: [2, max_instances]. Default: 2.
581 /// Secondary workers - Bounds: [0, max_instances]. Default: 0.
582 pub min_instances: i32,
583
584 /// Required. Maximum number of instances for this group. Required for primary
585 /// workers. Note that by default, clusters will not use secondary workers.
586 /// Required for secondary workers if the minimum secondary instances is set.
587 ///
588 /// Primary workers - Bounds: [min_instances, ).
589 /// Secondary workers - Bounds: [min_instances, ). Default: 0.
590 pub max_instances: i32,
591
592 /// Optional. Weight for the instance group, which is used to determine the
593 /// fraction of total workers in the cluster from this instance group.
594 /// For example, if primary workers have weight 2, and secondary workers have
595 /// weight 1, the cluster will have approximately 2 primary workers for each
596 /// secondary worker.
597 ///
598 /// The cluster may not reach the specified balance if constrained
599 /// by min/max bounds or other autoscaling settings. For example, if
600 /// `max_instances` for secondary workers is 0, then only primary workers will
601 /// be added. The cluster can also be out of balance when created.
602 ///
603 /// If weight is not set on any instance group, the cluster will default to
604 /// equal weight for all groups: the cluster will attempt to maintain an equal
605 /// number of workers in each group within the configured size bounds for each
606 /// group. If weight is set for one group only, the cluster will default to
607 /// zero weight on the unset group. For example if weight is set only on
608 /// primary workers, the cluster will use primary workers only and no
609 /// secondary workers.
610 pub weight: i32,
611
612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
613}
614
615impl InstanceGroupAutoscalingPolicyConfig {
616 pub fn new() -> Self {
617 std::default::Default::default()
618 }
619
620 /// Sets the value of [min_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::min_instances].
621 ///
622 /// # Example
623 /// ```ignore,no_run
624 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
625 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_min_instances(42);
626 /// ```
627 pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
628 self.min_instances = v.into();
629 self
630 }
631
632 /// Sets the value of [max_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::max_instances].
633 ///
634 /// # Example
635 /// ```ignore,no_run
636 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
637 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_max_instances(42);
638 /// ```
639 pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
640 self.max_instances = v.into();
641 self
642 }
643
644 /// Sets the value of [weight][crate::model::InstanceGroupAutoscalingPolicyConfig::weight].
645 ///
646 /// # Example
647 /// ```ignore,no_run
648 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
649 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_weight(42);
650 /// ```
651 pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
652 self.weight = v.into();
653 self
654 }
655}
656
657impl wkt::message::Message for InstanceGroupAutoscalingPolicyConfig {
658 fn typename() -> &'static str {
659 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig"
660 }
661}
662
663/// A request to create an autoscaling policy.
664#[derive(Clone, Default, PartialEq)]
665#[non_exhaustive]
666pub struct CreateAutoscalingPolicyRequest {
667 /// Required. The "resource name" of the region or location, as described
668 /// in <https://cloud.google.com/apis/design/resource_names>.
669 ///
670 /// * For `projects.regions.autoscalingPolicies.create`, the resource name
671 /// of the region has the following format:
672 /// `projects/{project_id}/regions/{region}`
673 ///
674 /// * For `projects.locations.autoscalingPolicies.create`, the resource name
675 /// of the location has the following format:
676 /// `projects/{project_id}/locations/{location}`
677 ///
678 pub parent: std::string::String,
679
680 /// Required. The autoscaling policy to create.
681 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
682
683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
684}
685
686impl CreateAutoscalingPolicyRequest {
687 pub fn new() -> Self {
688 std::default::Default::default()
689 }
690
691 /// Sets the value of [parent][crate::model::CreateAutoscalingPolicyRequest::parent].
692 ///
693 /// # Example
694 /// ```ignore,no_run
695 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
696 /// let x = CreateAutoscalingPolicyRequest::new().set_parent("example");
697 /// ```
698 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
699 self.parent = v.into();
700 self
701 }
702
703 /// Sets the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
704 ///
705 /// # Example
706 /// ```ignore,no_run
707 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
708 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
709 /// let x = CreateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
710 /// ```
711 pub fn set_policy<T>(mut self, v: T) -> Self
712 where
713 T: std::convert::Into<crate::model::AutoscalingPolicy>,
714 {
715 self.policy = std::option::Option::Some(v.into());
716 self
717 }
718
719 /// Sets or clears the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
720 ///
721 /// # Example
722 /// ```ignore,no_run
723 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
724 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
725 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
726 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
727 /// ```
728 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
729 where
730 T: std::convert::Into<crate::model::AutoscalingPolicy>,
731 {
732 self.policy = v.map(|x| x.into());
733 self
734 }
735}
736
737impl wkt::message::Message for CreateAutoscalingPolicyRequest {
738 fn typename() -> &'static str {
739 "type.googleapis.com/google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest"
740 }
741}
742
743/// A request to fetch an autoscaling policy.
744#[derive(Clone, Default, PartialEq)]
745#[non_exhaustive]
746pub struct GetAutoscalingPolicyRequest {
747 /// Required. The "resource name" of the autoscaling policy, as described
748 /// in <https://cloud.google.com/apis/design/resource_names>.
749 ///
750 /// * For `projects.regions.autoscalingPolicies.get`, the resource name
751 /// of the policy has the following format:
752 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
753 ///
754 /// * For `projects.locations.autoscalingPolicies.get`, the resource name
755 /// of the policy has the following format:
756 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
757 ///
758 pub name: std::string::String,
759
760 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
761}
762
763impl GetAutoscalingPolicyRequest {
764 pub fn new() -> Self {
765 std::default::Default::default()
766 }
767
768 /// Sets the value of [name][crate::model::GetAutoscalingPolicyRequest::name].
769 ///
770 /// # Example
771 /// ```ignore,no_run
772 /// # use google_cloud_dataproc_v1::model::GetAutoscalingPolicyRequest;
773 /// let x = GetAutoscalingPolicyRequest::new().set_name("example");
774 /// ```
775 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
776 self.name = v.into();
777 self
778 }
779}
780
781impl wkt::message::Message for GetAutoscalingPolicyRequest {
782 fn typename() -> &'static str {
783 "type.googleapis.com/google.cloud.dataproc.v1.GetAutoscalingPolicyRequest"
784 }
785}
786
787/// A request to update an autoscaling policy.
788#[derive(Clone, Default, PartialEq)]
789#[non_exhaustive]
790pub struct UpdateAutoscalingPolicyRequest {
791 /// Required. The updated autoscaling policy.
792 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
793
794 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
795}
796
797impl UpdateAutoscalingPolicyRequest {
798 pub fn new() -> Self {
799 std::default::Default::default()
800 }
801
802 /// Sets the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
803 ///
804 /// # Example
805 /// ```ignore,no_run
806 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
807 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
808 /// let x = UpdateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
809 /// ```
810 pub fn set_policy<T>(mut self, v: T) -> Self
811 where
812 T: std::convert::Into<crate::model::AutoscalingPolicy>,
813 {
814 self.policy = std::option::Option::Some(v.into());
815 self
816 }
817
818 /// Sets or clears the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
819 ///
820 /// # Example
821 /// ```ignore,no_run
822 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
823 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
824 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
825 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
826 /// ```
827 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
828 where
829 T: std::convert::Into<crate::model::AutoscalingPolicy>,
830 {
831 self.policy = v.map(|x| x.into());
832 self
833 }
834}
835
836impl wkt::message::Message for UpdateAutoscalingPolicyRequest {
837 fn typename() -> &'static str {
838 "type.googleapis.com/google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest"
839 }
840}
841
842/// A request to delete an autoscaling policy.
843///
844/// Autoscaling policies in use by one or more clusters will not be deleted.
845#[derive(Clone, Default, PartialEq)]
846#[non_exhaustive]
847pub struct DeleteAutoscalingPolicyRequest {
848 /// Required. The "resource name" of the autoscaling policy, as described
849 /// in <https://cloud.google.com/apis/design/resource_names>.
850 ///
851 /// * For `projects.regions.autoscalingPolicies.delete`, the resource name
852 /// of the policy has the following format:
853 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
854 ///
855 /// * For `projects.locations.autoscalingPolicies.delete`, the resource name
856 /// of the policy has the following format:
857 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
858 ///
859 pub name: std::string::String,
860
861 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
862}
863
864impl DeleteAutoscalingPolicyRequest {
865 pub fn new() -> Self {
866 std::default::Default::default()
867 }
868
869 /// Sets the value of [name][crate::model::DeleteAutoscalingPolicyRequest::name].
870 ///
871 /// # Example
872 /// ```ignore,no_run
873 /// # use google_cloud_dataproc_v1::model::DeleteAutoscalingPolicyRequest;
874 /// let x = DeleteAutoscalingPolicyRequest::new().set_name("example");
875 /// ```
876 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
877 self.name = v.into();
878 self
879 }
880}
881
882impl wkt::message::Message for DeleteAutoscalingPolicyRequest {
883 fn typename() -> &'static str {
884 "type.googleapis.com/google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest"
885 }
886}
887
888/// A request to list autoscaling policies in a project.
889#[derive(Clone, Default, PartialEq)]
890#[non_exhaustive]
891pub struct ListAutoscalingPoliciesRequest {
892 /// Required. The "resource name" of the region or location, as described
893 /// in <https://cloud.google.com/apis/design/resource_names>.
894 ///
895 /// * For `projects.regions.autoscalingPolicies.list`, the resource name
896 /// of the region has the following format:
897 /// `projects/{project_id}/regions/{region}`
898 ///
899 /// * For `projects.locations.autoscalingPolicies.list`, the resource name
900 /// of the location has the following format:
901 /// `projects/{project_id}/locations/{location}`
902 ///
903 pub parent: std::string::String,
904
905 /// Optional. The maximum number of results to return in each response.
906 /// Must be less than or equal to 1000. Defaults to 100.
907 pub page_size: i32,
908
909 /// Optional. The page token, returned by a previous call, to request the
910 /// next page of results.
911 pub page_token: std::string::String,
912
913 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
914}
915
916impl ListAutoscalingPoliciesRequest {
917 pub fn new() -> Self {
918 std::default::Default::default()
919 }
920
921 /// Sets the value of [parent][crate::model::ListAutoscalingPoliciesRequest::parent].
922 ///
923 /// # Example
924 /// ```ignore,no_run
925 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
926 /// let x = ListAutoscalingPoliciesRequest::new().set_parent("example");
927 /// ```
928 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
929 self.parent = v.into();
930 self
931 }
932
933 /// Sets the value of [page_size][crate::model::ListAutoscalingPoliciesRequest::page_size].
934 ///
935 /// # Example
936 /// ```ignore,no_run
937 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
938 /// let x = ListAutoscalingPoliciesRequest::new().set_page_size(42);
939 /// ```
940 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
941 self.page_size = v.into();
942 self
943 }
944
945 /// Sets the value of [page_token][crate::model::ListAutoscalingPoliciesRequest::page_token].
946 ///
947 /// # Example
948 /// ```ignore,no_run
949 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
950 /// let x = ListAutoscalingPoliciesRequest::new().set_page_token("example");
951 /// ```
952 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
953 self.page_token = v.into();
954 self
955 }
956}
957
958impl wkt::message::Message for ListAutoscalingPoliciesRequest {
959 fn typename() -> &'static str {
960 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest"
961 }
962}
963
964/// A response to a request to list autoscaling policies in a project.
965#[derive(Clone, Default, PartialEq)]
966#[non_exhaustive]
967pub struct ListAutoscalingPoliciesResponse {
968 /// Output only. Autoscaling policies list.
969 pub policies: std::vec::Vec<crate::model::AutoscalingPolicy>,
970
971 /// Output only. This token is included in the response if there are more
972 /// results to fetch.
973 pub next_page_token: std::string::String,
974
975 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
976}
977
978impl ListAutoscalingPoliciesResponse {
979 pub fn new() -> Self {
980 std::default::Default::default()
981 }
982
983 /// Sets the value of [policies][crate::model::ListAutoscalingPoliciesResponse::policies].
984 ///
985 /// # Example
986 /// ```ignore,no_run
987 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
988 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
989 /// let x = ListAutoscalingPoliciesResponse::new()
990 /// .set_policies([
991 /// AutoscalingPolicy::default()/* use setters */,
992 /// AutoscalingPolicy::default()/* use (different) setters */,
993 /// ]);
994 /// ```
995 pub fn set_policies<T, V>(mut self, v: T) -> Self
996 where
997 T: std::iter::IntoIterator<Item = V>,
998 V: std::convert::Into<crate::model::AutoscalingPolicy>,
999 {
1000 use std::iter::Iterator;
1001 self.policies = v.into_iter().map(|i| i.into()).collect();
1002 self
1003 }
1004
1005 /// Sets the value of [next_page_token][crate::model::ListAutoscalingPoliciesResponse::next_page_token].
1006 ///
1007 /// # Example
1008 /// ```ignore,no_run
1009 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1010 /// let x = ListAutoscalingPoliciesResponse::new().set_next_page_token("example");
1011 /// ```
1012 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1013 self.next_page_token = v.into();
1014 self
1015 }
1016}
1017
1018impl wkt::message::Message for ListAutoscalingPoliciesResponse {
1019 fn typename() -> &'static str {
1020 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse"
1021 }
1022}
1023
1024#[doc(hidden)]
1025impl gax::paginator::internal::PageableResponse for ListAutoscalingPoliciesResponse {
1026 type PageItem = crate::model::AutoscalingPolicy;
1027
1028 fn items(self) -> std::vec::Vec<Self::PageItem> {
1029 self.policies
1030 }
1031
1032 fn next_page_token(&self) -> std::string::String {
1033 use std::clone::Clone;
1034 self.next_page_token.clone()
1035 }
1036}
1037
1038/// A request to create a batch workload.
1039#[derive(Clone, Default, PartialEq)]
1040#[non_exhaustive]
1041pub struct CreateBatchRequest {
1042 /// Required. The parent resource where this batch will be created.
1043 pub parent: std::string::String,
1044
1045 /// Required. The batch to create.
1046 pub batch: std::option::Option<crate::model::Batch>,
1047
1048 /// Optional. The ID to use for the batch, which will become the final
1049 /// component of the batch's resource name.
1050 ///
1051 /// This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
1052 pub batch_id: std::string::String,
1053
1054 /// Optional. A unique ID used to identify the request. If the service
1055 /// receives two
1056 /// [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
1057 /// with the same request_id, the second request is ignored and the
1058 /// Operation that corresponds to the first Batch created and stored
1059 /// in the backend is returned.
1060 ///
1061 /// Recommendation: Set this value to a
1062 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
1063 ///
1064 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
1065 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
1066 pub request_id: std::string::String,
1067
1068 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1069}
1070
1071impl CreateBatchRequest {
1072 pub fn new() -> Self {
1073 std::default::Default::default()
1074 }
1075
1076 /// Sets the value of [parent][crate::model::CreateBatchRequest::parent].
1077 ///
1078 /// # Example
1079 /// ```ignore,no_run
1080 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1081 /// let x = CreateBatchRequest::new().set_parent("example");
1082 /// ```
1083 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1084 self.parent = v.into();
1085 self
1086 }
1087
1088 /// Sets the value of [batch][crate::model::CreateBatchRequest::batch].
1089 ///
1090 /// # Example
1091 /// ```ignore,no_run
1092 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1093 /// use google_cloud_dataproc_v1::model::Batch;
1094 /// let x = CreateBatchRequest::new().set_batch(Batch::default()/* use setters */);
1095 /// ```
1096 pub fn set_batch<T>(mut self, v: T) -> Self
1097 where
1098 T: std::convert::Into<crate::model::Batch>,
1099 {
1100 self.batch = std::option::Option::Some(v.into());
1101 self
1102 }
1103
1104 /// Sets or clears the value of [batch][crate::model::CreateBatchRequest::batch].
1105 ///
1106 /// # Example
1107 /// ```ignore,no_run
1108 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1109 /// use google_cloud_dataproc_v1::model::Batch;
1110 /// let x = CreateBatchRequest::new().set_or_clear_batch(Some(Batch::default()/* use setters */));
1111 /// let x = CreateBatchRequest::new().set_or_clear_batch(None::<Batch>);
1112 /// ```
1113 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1114 where
1115 T: std::convert::Into<crate::model::Batch>,
1116 {
1117 self.batch = v.map(|x| x.into());
1118 self
1119 }
1120
1121 /// Sets the value of [batch_id][crate::model::CreateBatchRequest::batch_id].
1122 ///
1123 /// # Example
1124 /// ```ignore,no_run
1125 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1126 /// let x = CreateBatchRequest::new().set_batch_id("example");
1127 /// ```
1128 pub fn set_batch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1129 self.batch_id = v.into();
1130 self
1131 }
1132
1133 /// Sets the value of [request_id][crate::model::CreateBatchRequest::request_id].
1134 ///
1135 /// # Example
1136 /// ```ignore,no_run
1137 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1138 /// let x = CreateBatchRequest::new().set_request_id("example");
1139 /// ```
1140 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1141 self.request_id = v.into();
1142 self
1143 }
1144}
1145
1146impl wkt::message::Message for CreateBatchRequest {
1147 fn typename() -> &'static str {
1148 "type.googleapis.com/google.cloud.dataproc.v1.CreateBatchRequest"
1149 }
1150}
1151
1152/// A request to get the resource representation for a batch workload.
1153#[derive(Clone, Default, PartialEq)]
1154#[non_exhaustive]
1155pub struct GetBatchRequest {
1156 /// Required. The fully qualified name of the batch to retrieve
1157 /// in the format
1158 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1159 pub name: std::string::String,
1160
1161 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1162}
1163
1164impl GetBatchRequest {
1165 pub fn new() -> Self {
1166 std::default::Default::default()
1167 }
1168
1169 /// Sets the value of [name][crate::model::GetBatchRequest::name].
1170 ///
1171 /// # Example
1172 /// ```ignore,no_run
1173 /// # use google_cloud_dataproc_v1::model::GetBatchRequest;
1174 /// let x = GetBatchRequest::new().set_name("example");
1175 /// ```
1176 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1177 self.name = v.into();
1178 self
1179 }
1180}
1181
1182impl wkt::message::Message for GetBatchRequest {
1183 fn typename() -> &'static str {
1184 "type.googleapis.com/google.cloud.dataproc.v1.GetBatchRequest"
1185 }
1186}
1187
1188/// A request to list batch workloads in a project.
1189#[derive(Clone, Default, PartialEq)]
1190#[non_exhaustive]
1191pub struct ListBatchesRequest {
1192 /// Required. The parent, which owns this collection of batches.
1193 pub parent: std::string::String,
1194
1195 /// Optional. The maximum number of batches to return in each response.
1196 /// The service may return fewer than this value.
1197 /// The default page size is 20; the maximum page size is 1000.
1198 pub page_size: i32,
1199
1200 /// Optional. A page token received from a previous `ListBatches` call.
1201 /// Provide this token to retrieve the subsequent page.
1202 pub page_token: std::string::String,
1203
1204 /// Optional. A filter for the batches to return in the response.
1205 ///
1206 /// A filter is a logical expression constraining the values of various fields
1207 /// in each batch resource. Filters are case sensitive, and may contain
1208 /// multiple clauses combined with logical operators (AND/OR).
1209 /// Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`.
1210 ///
1211 /// e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"`
1212 /// filters for batches in state RUNNING that were created before 2023-01-01
1213 ///
1214 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
1215 /// description of the filter syntax and a list of supported comparisons.
1216 pub filter: std::string::String,
1217
1218 /// Optional. Field(s) on which to sort the list of batches.
1219 ///
1220 /// Currently the only supported sort orders are unspecified (empty) and
1221 /// `create_time desc` to sort by most recently created batches first.
1222 ///
1223 /// See <https://google.aip.dev/132#ordering> for more details.
1224 pub order_by: std::string::String,
1225
1226 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1227}
1228
1229impl ListBatchesRequest {
1230 pub fn new() -> Self {
1231 std::default::Default::default()
1232 }
1233
1234 /// Sets the value of [parent][crate::model::ListBatchesRequest::parent].
1235 ///
1236 /// # Example
1237 /// ```ignore,no_run
1238 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1239 /// let x = ListBatchesRequest::new().set_parent("example");
1240 /// ```
1241 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1242 self.parent = v.into();
1243 self
1244 }
1245
1246 /// Sets the value of [page_size][crate::model::ListBatchesRequest::page_size].
1247 ///
1248 /// # Example
1249 /// ```ignore,no_run
1250 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1251 /// let x = ListBatchesRequest::new().set_page_size(42);
1252 /// ```
1253 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1254 self.page_size = v.into();
1255 self
1256 }
1257
1258 /// Sets the value of [page_token][crate::model::ListBatchesRequest::page_token].
1259 ///
1260 /// # Example
1261 /// ```ignore,no_run
1262 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1263 /// let x = ListBatchesRequest::new().set_page_token("example");
1264 /// ```
1265 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1266 self.page_token = v.into();
1267 self
1268 }
1269
1270 /// Sets the value of [filter][crate::model::ListBatchesRequest::filter].
1271 ///
1272 /// # Example
1273 /// ```ignore,no_run
1274 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1275 /// let x = ListBatchesRequest::new().set_filter("example");
1276 /// ```
1277 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1278 self.filter = v.into();
1279 self
1280 }
1281
1282 /// Sets the value of [order_by][crate::model::ListBatchesRequest::order_by].
1283 ///
1284 /// # Example
1285 /// ```ignore,no_run
1286 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1287 /// let x = ListBatchesRequest::new().set_order_by("example");
1288 /// ```
1289 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1290 self.order_by = v.into();
1291 self
1292 }
1293}
1294
1295impl wkt::message::Message for ListBatchesRequest {
1296 fn typename() -> &'static str {
1297 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesRequest"
1298 }
1299}
1300
1301/// A list of batch workloads.
1302#[derive(Clone, Default, PartialEq)]
1303#[non_exhaustive]
1304pub struct ListBatchesResponse {
1305 /// The batches from the specified collection.
1306 pub batches: std::vec::Vec<crate::model::Batch>,
1307
1308 /// A token, which can be sent as `page_token` to retrieve the next page.
1309 /// If this field is omitted, there are no subsequent pages.
1310 pub next_page_token: std::string::String,
1311
1312 /// Output only. List of Batches that could not be included in the response.
1313 /// Attempting to get one of these resources may indicate why it was not
1314 /// included in the list response.
1315 pub unreachable: std::vec::Vec<std::string::String>,
1316
1317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1318}
1319
1320impl ListBatchesResponse {
1321 pub fn new() -> Self {
1322 std::default::Default::default()
1323 }
1324
1325 /// Sets the value of [batches][crate::model::ListBatchesResponse::batches].
1326 ///
1327 /// # Example
1328 /// ```ignore,no_run
1329 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1330 /// use google_cloud_dataproc_v1::model::Batch;
1331 /// let x = ListBatchesResponse::new()
1332 /// .set_batches([
1333 /// Batch::default()/* use setters */,
1334 /// Batch::default()/* use (different) setters */,
1335 /// ]);
1336 /// ```
1337 pub fn set_batches<T, V>(mut self, v: T) -> Self
1338 where
1339 T: std::iter::IntoIterator<Item = V>,
1340 V: std::convert::Into<crate::model::Batch>,
1341 {
1342 use std::iter::Iterator;
1343 self.batches = v.into_iter().map(|i| i.into()).collect();
1344 self
1345 }
1346
1347 /// Sets the value of [next_page_token][crate::model::ListBatchesResponse::next_page_token].
1348 ///
1349 /// # Example
1350 /// ```ignore,no_run
1351 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1352 /// let x = ListBatchesResponse::new().set_next_page_token("example");
1353 /// ```
1354 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1355 self.next_page_token = v.into();
1356 self
1357 }
1358
1359 /// Sets the value of [unreachable][crate::model::ListBatchesResponse::unreachable].
1360 ///
1361 /// # Example
1362 /// ```ignore,no_run
1363 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1364 /// let x = ListBatchesResponse::new().set_unreachable(["a", "b", "c"]);
1365 /// ```
1366 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1367 where
1368 T: std::iter::IntoIterator<Item = V>,
1369 V: std::convert::Into<std::string::String>,
1370 {
1371 use std::iter::Iterator;
1372 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1373 self
1374 }
1375}
1376
1377impl wkt::message::Message for ListBatchesResponse {
1378 fn typename() -> &'static str {
1379 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesResponse"
1380 }
1381}
1382
1383#[doc(hidden)]
1384impl gax::paginator::internal::PageableResponse for ListBatchesResponse {
1385 type PageItem = crate::model::Batch;
1386
1387 fn items(self) -> std::vec::Vec<Self::PageItem> {
1388 self.batches
1389 }
1390
1391 fn next_page_token(&self) -> std::string::String {
1392 use std::clone::Clone;
1393 self.next_page_token.clone()
1394 }
1395}
1396
1397/// A request to delete a batch workload.
1398#[derive(Clone, Default, PartialEq)]
1399#[non_exhaustive]
1400pub struct DeleteBatchRequest {
1401 /// Required. The fully qualified name of the batch to retrieve
1402 /// in the format
1403 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1404 pub name: std::string::String,
1405
1406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1407}
1408
1409impl DeleteBatchRequest {
1410 pub fn new() -> Self {
1411 std::default::Default::default()
1412 }
1413
1414 /// Sets the value of [name][crate::model::DeleteBatchRequest::name].
1415 ///
1416 /// # Example
1417 /// ```ignore,no_run
1418 /// # use google_cloud_dataproc_v1::model::DeleteBatchRequest;
1419 /// let x = DeleteBatchRequest::new().set_name("example");
1420 /// ```
1421 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1422 self.name = v.into();
1423 self
1424 }
1425}
1426
1427impl wkt::message::Message for DeleteBatchRequest {
1428 fn typename() -> &'static str {
1429 "type.googleapis.com/google.cloud.dataproc.v1.DeleteBatchRequest"
1430 }
1431}
1432
1433/// A representation of a batch workload in the service.
1434#[derive(Clone, Default, PartialEq)]
1435#[non_exhaustive]
1436pub struct Batch {
1437 /// Output only. The resource name of the batch.
1438 pub name: std::string::String,
1439
1440 /// Output only. A batch UUID (Unique Universal Identifier). The service
1441 /// generates this value when it creates the batch.
1442 pub uuid: std::string::String,
1443
1444 /// Output only. The time when the batch was created.
1445 pub create_time: std::option::Option<wkt::Timestamp>,
1446
1447 /// Output only. Runtime information about batch execution.
1448 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
1449
1450 /// Output only. The state of the batch.
1451 pub state: crate::model::batch::State,
1452
1453 /// Output only. Batch state details, such as a failure
1454 /// description if the state is `FAILED`.
1455 pub state_message: std::string::String,
1456
1457 /// Output only. The time when the batch entered a current state.
1458 pub state_time: std::option::Option<wkt::Timestamp>,
1459
1460 /// Output only. The email address of the user who created the batch.
1461 pub creator: std::string::String,
1462
1463 /// Optional. The labels to associate with this batch.
1464 /// Label **keys** must contain 1 to 63 characters, and must conform to
1465 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
1466 /// Label **values** may be empty, but, if present, must contain 1 to 63
1467 /// characters, and must conform to [RFC
1468 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
1469 /// associated with a batch.
1470 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1471
1472 /// Optional. Runtime configuration for the batch execution.
1473 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
1474
1475 /// Optional. Environment configuration for the batch execution.
1476 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
1477
1478 /// Output only. The resource name of the operation associated with this batch.
1479 pub operation: std::string::String,
1480
1481 /// Output only. Historical state information for the batch.
1482 pub state_history: std::vec::Vec<crate::model::batch::StateHistory>,
1483
1484 /// The application/framework-specific portion of the batch configuration.
1485 pub batch_config: std::option::Option<crate::model::batch::BatchConfig>,
1486
1487 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1488}
1489
1490impl Batch {
1491 pub fn new() -> Self {
1492 std::default::Default::default()
1493 }
1494
1495 /// Sets the value of [name][crate::model::Batch::name].
1496 ///
1497 /// # Example
1498 /// ```ignore,no_run
1499 /// # use google_cloud_dataproc_v1::model::Batch;
1500 /// let x = Batch::new().set_name("example");
1501 /// ```
1502 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1503 self.name = v.into();
1504 self
1505 }
1506
1507 /// Sets the value of [uuid][crate::model::Batch::uuid].
1508 ///
1509 /// # Example
1510 /// ```ignore,no_run
1511 /// # use google_cloud_dataproc_v1::model::Batch;
1512 /// let x = Batch::new().set_uuid("example");
1513 /// ```
1514 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1515 self.uuid = v.into();
1516 self
1517 }
1518
1519 /// Sets the value of [create_time][crate::model::Batch::create_time].
1520 ///
1521 /// # Example
1522 /// ```ignore,no_run
1523 /// # use google_cloud_dataproc_v1::model::Batch;
1524 /// use wkt::Timestamp;
1525 /// let x = Batch::new().set_create_time(Timestamp::default()/* use setters */);
1526 /// ```
1527 pub fn set_create_time<T>(mut self, v: T) -> Self
1528 where
1529 T: std::convert::Into<wkt::Timestamp>,
1530 {
1531 self.create_time = std::option::Option::Some(v.into());
1532 self
1533 }
1534
1535 /// Sets or clears the value of [create_time][crate::model::Batch::create_time].
1536 ///
1537 /// # Example
1538 /// ```ignore,no_run
1539 /// # use google_cloud_dataproc_v1::model::Batch;
1540 /// use wkt::Timestamp;
1541 /// let x = Batch::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1542 /// let x = Batch::new().set_or_clear_create_time(None::<Timestamp>);
1543 /// ```
1544 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1545 where
1546 T: std::convert::Into<wkt::Timestamp>,
1547 {
1548 self.create_time = v.map(|x| x.into());
1549 self
1550 }
1551
1552 /// Sets the value of [runtime_info][crate::model::Batch::runtime_info].
1553 ///
1554 /// # Example
1555 /// ```ignore,no_run
1556 /// # use google_cloud_dataproc_v1::model::Batch;
1557 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1558 /// let x = Batch::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
1559 /// ```
1560 pub fn set_runtime_info<T>(mut self, v: T) -> Self
1561 where
1562 T: std::convert::Into<crate::model::RuntimeInfo>,
1563 {
1564 self.runtime_info = std::option::Option::Some(v.into());
1565 self
1566 }
1567
1568 /// Sets or clears the value of [runtime_info][crate::model::Batch::runtime_info].
1569 ///
1570 /// # Example
1571 /// ```ignore,no_run
1572 /// # use google_cloud_dataproc_v1::model::Batch;
1573 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1574 /// let x = Batch::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
1575 /// let x = Batch::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
1576 /// ```
1577 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
1578 where
1579 T: std::convert::Into<crate::model::RuntimeInfo>,
1580 {
1581 self.runtime_info = v.map(|x| x.into());
1582 self
1583 }
1584
1585 /// Sets the value of [state][crate::model::Batch::state].
1586 ///
1587 /// # Example
1588 /// ```ignore,no_run
1589 /// # use google_cloud_dataproc_v1::model::Batch;
1590 /// use google_cloud_dataproc_v1::model::batch::State;
1591 /// let x0 = Batch::new().set_state(State::Pending);
1592 /// let x1 = Batch::new().set_state(State::Running);
1593 /// let x2 = Batch::new().set_state(State::Cancelling);
1594 /// ```
1595 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(mut self, v: T) -> Self {
1596 self.state = v.into();
1597 self
1598 }
1599
1600 /// Sets the value of [state_message][crate::model::Batch::state_message].
1601 ///
1602 /// # Example
1603 /// ```ignore,no_run
1604 /// # use google_cloud_dataproc_v1::model::Batch;
1605 /// let x = Batch::new().set_state_message("example");
1606 /// ```
1607 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1608 self.state_message = v.into();
1609 self
1610 }
1611
1612 /// Sets the value of [state_time][crate::model::Batch::state_time].
1613 ///
1614 /// # Example
1615 /// ```ignore,no_run
1616 /// # use google_cloud_dataproc_v1::model::Batch;
1617 /// use wkt::Timestamp;
1618 /// let x = Batch::new().set_state_time(Timestamp::default()/* use setters */);
1619 /// ```
1620 pub fn set_state_time<T>(mut self, v: T) -> Self
1621 where
1622 T: std::convert::Into<wkt::Timestamp>,
1623 {
1624 self.state_time = std::option::Option::Some(v.into());
1625 self
1626 }
1627
1628 /// Sets or clears the value of [state_time][crate::model::Batch::state_time].
1629 ///
1630 /// # Example
1631 /// ```ignore,no_run
1632 /// # use google_cloud_dataproc_v1::model::Batch;
1633 /// use wkt::Timestamp;
1634 /// let x = Batch::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
1635 /// let x = Batch::new().set_or_clear_state_time(None::<Timestamp>);
1636 /// ```
1637 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
1638 where
1639 T: std::convert::Into<wkt::Timestamp>,
1640 {
1641 self.state_time = v.map(|x| x.into());
1642 self
1643 }
1644
1645 /// Sets the value of [creator][crate::model::Batch::creator].
1646 ///
1647 /// # Example
1648 /// ```ignore,no_run
1649 /// # use google_cloud_dataproc_v1::model::Batch;
1650 /// let x = Batch::new().set_creator("example");
1651 /// ```
1652 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1653 self.creator = v.into();
1654 self
1655 }
1656
1657 /// Sets the value of [labels][crate::model::Batch::labels].
1658 ///
1659 /// # Example
1660 /// ```ignore,no_run
1661 /// # use google_cloud_dataproc_v1::model::Batch;
1662 /// let x = Batch::new().set_labels([
1663 /// ("key0", "abc"),
1664 /// ("key1", "xyz"),
1665 /// ]);
1666 /// ```
1667 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1668 where
1669 T: std::iter::IntoIterator<Item = (K, V)>,
1670 K: std::convert::Into<std::string::String>,
1671 V: std::convert::Into<std::string::String>,
1672 {
1673 use std::iter::Iterator;
1674 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1675 self
1676 }
1677
1678 /// Sets the value of [runtime_config][crate::model::Batch::runtime_config].
1679 ///
1680 /// # Example
1681 /// ```ignore,no_run
1682 /// # use google_cloud_dataproc_v1::model::Batch;
1683 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1684 /// let x = Batch::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
1685 /// ```
1686 pub fn set_runtime_config<T>(mut self, v: T) -> Self
1687 where
1688 T: std::convert::Into<crate::model::RuntimeConfig>,
1689 {
1690 self.runtime_config = std::option::Option::Some(v.into());
1691 self
1692 }
1693
1694 /// Sets or clears the value of [runtime_config][crate::model::Batch::runtime_config].
1695 ///
1696 /// # Example
1697 /// ```ignore,no_run
1698 /// # use google_cloud_dataproc_v1::model::Batch;
1699 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1700 /// let x = Batch::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
1701 /// let x = Batch::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
1702 /// ```
1703 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
1704 where
1705 T: std::convert::Into<crate::model::RuntimeConfig>,
1706 {
1707 self.runtime_config = v.map(|x| x.into());
1708 self
1709 }
1710
1711 /// Sets the value of [environment_config][crate::model::Batch::environment_config].
1712 ///
1713 /// # Example
1714 /// ```ignore,no_run
1715 /// # use google_cloud_dataproc_v1::model::Batch;
1716 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1717 /// let x = Batch::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
1718 /// ```
1719 pub fn set_environment_config<T>(mut self, v: T) -> Self
1720 where
1721 T: std::convert::Into<crate::model::EnvironmentConfig>,
1722 {
1723 self.environment_config = std::option::Option::Some(v.into());
1724 self
1725 }
1726
1727 /// Sets or clears the value of [environment_config][crate::model::Batch::environment_config].
1728 ///
1729 /// # Example
1730 /// ```ignore,no_run
1731 /// # use google_cloud_dataproc_v1::model::Batch;
1732 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1733 /// let x = Batch::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
1734 /// let x = Batch::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
1735 /// ```
1736 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
1737 where
1738 T: std::convert::Into<crate::model::EnvironmentConfig>,
1739 {
1740 self.environment_config = v.map(|x| x.into());
1741 self
1742 }
1743
1744 /// Sets the value of [operation][crate::model::Batch::operation].
1745 ///
1746 /// # Example
1747 /// ```ignore,no_run
1748 /// # use google_cloud_dataproc_v1::model::Batch;
1749 /// let x = Batch::new().set_operation("example");
1750 /// ```
1751 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1752 self.operation = v.into();
1753 self
1754 }
1755
1756 /// Sets the value of [state_history][crate::model::Batch::state_history].
1757 ///
1758 /// # Example
1759 /// ```ignore,no_run
1760 /// # use google_cloud_dataproc_v1::model::Batch;
1761 /// use google_cloud_dataproc_v1::model::batch::StateHistory;
1762 /// let x = Batch::new()
1763 /// .set_state_history([
1764 /// StateHistory::default()/* use setters */,
1765 /// StateHistory::default()/* use (different) setters */,
1766 /// ]);
1767 /// ```
1768 pub fn set_state_history<T, V>(mut self, v: T) -> Self
1769 where
1770 T: std::iter::IntoIterator<Item = V>,
1771 V: std::convert::Into<crate::model::batch::StateHistory>,
1772 {
1773 use std::iter::Iterator;
1774 self.state_history = v.into_iter().map(|i| i.into()).collect();
1775 self
1776 }
1777
1778 /// Sets the value of [batch_config][crate::model::Batch::batch_config].
1779 ///
1780 /// Note that all the setters affecting `batch_config` are mutually
1781 /// exclusive.
1782 ///
1783 /// # Example
1784 /// ```ignore,no_run
1785 /// # use google_cloud_dataproc_v1::model::Batch;
1786 /// use google_cloud_dataproc_v1::model::PySparkBatch;
1787 /// let x = Batch::new().set_batch_config(Some(
1788 /// google_cloud_dataproc_v1::model::batch::BatchConfig::PysparkBatch(PySparkBatch::default().into())));
1789 /// ```
1790 pub fn set_batch_config<
1791 T: std::convert::Into<std::option::Option<crate::model::batch::BatchConfig>>,
1792 >(
1793 mut self,
1794 v: T,
1795 ) -> Self {
1796 self.batch_config = v.into();
1797 self
1798 }
1799
1800 /// The value of [batch_config][crate::model::Batch::batch_config]
1801 /// if it holds a `PysparkBatch`, `None` if the field is not set or
1802 /// holds a different branch.
1803 pub fn pyspark_batch(
1804 &self,
1805 ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkBatch>> {
1806 #[allow(unreachable_patterns)]
1807 self.batch_config.as_ref().and_then(|v| match v {
1808 crate::model::batch::BatchConfig::PysparkBatch(v) => std::option::Option::Some(v),
1809 _ => std::option::Option::None,
1810 })
1811 }
1812
1813 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1814 /// to hold a `PysparkBatch`.
1815 ///
1816 /// Note that all the setters affecting `batch_config` are
1817 /// mutually exclusive.
1818 ///
1819 /// # Example
1820 /// ```ignore,no_run
1821 /// # use google_cloud_dataproc_v1::model::Batch;
1822 /// use google_cloud_dataproc_v1::model::PySparkBatch;
1823 /// let x = Batch::new().set_pyspark_batch(PySparkBatch::default()/* use setters */);
1824 /// assert!(x.pyspark_batch().is_some());
1825 /// assert!(x.spark_batch().is_none());
1826 /// assert!(x.spark_r_batch().is_none());
1827 /// assert!(x.spark_sql_batch().is_none());
1828 /// ```
1829 pub fn set_pyspark_batch<T: std::convert::Into<std::boxed::Box<crate::model::PySparkBatch>>>(
1830 mut self,
1831 v: T,
1832 ) -> Self {
1833 self.batch_config =
1834 std::option::Option::Some(crate::model::batch::BatchConfig::PysparkBatch(v.into()));
1835 self
1836 }
1837
1838 /// The value of [batch_config][crate::model::Batch::batch_config]
1839 /// if it holds a `SparkBatch`, `None` if the field is not set or
1840 /// holds a different branch.
1841 pub fn spark_batch(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkBatch>> {
1842 #[allow(unreachable_patterns)]
1843 self.batch_config.as_ref().and_then(|v| match v {
1844 crate::model::batch::BatchConfig::SparkBatch(v) => std::option::Option::Some(v),
1845 _ => std::option::Option::None,
1846 })
1847 }
1848
1849 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1850 /// to hold a `SparkBatch`.
1851 ///
1852 /// Note that all the setters affecting `batch_config` are
1853 /// mutually exclusive.
1854 ///
1855 /// # Example
1856 /// ```ignore,no_run
1857 /// # use google_cloud_dataproc_v1::model::Batch;
1858 /// use google_cloud_dataproc_v1::model::SparkBatch;
1859 /// let x = Batch::new().set_spark_batch(SparkBatch::default()/* use setters */);
1860 /// assert!(x.spark_batch().is_some());
1861 /// assert!(x.pyspark_batch().is_none());
1862 /// assert!(x.spark_r_batch().is_none());
1863 /// assert!(x.spark_sql_batch().is_none());
1864 /// ```
1865 pub fn set_spark_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkBatch>>>(
1866 mut self,
1867 v: T,
1868 ) -> Self {
1869 self.batch_config =
1870 std::option::Option::Some(crate::model::batch::BatchConfig::SparkBatch(v.into()));
1871 self
1872 }
1873
1874 /// The value of [batch_config][crate::model::Batch::batch_config]
1875 /// if it holds a `SparkRBatch`, `None` if the field is not set or
1876 /// holds a different branch.
1877 pub fn spark_r_batch(
1878 &self,
1879 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkRBatch>> {
1880 #[allow(unreachable_patterns)]
1881 self.batch_config.as_ref().and_then(|v| match v {
1882 crate::model::batch::BatchConfig::SparkRBatch(v) => std::option::Option::Some(v),
1883 _ => std::option::Option::None,
1884 })
1885 }
1886
1887 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1888 /// to hold a `SparkRBatch`.
1889 ///
1890 /// Note that all the setters affecting `batch_config` are
1891 /// mutually exclusive.
1892 ///
1893 /// # Example
1894 /// ```ignore,no_run
1895 /// # use google_cloud_dataproc_v1::model::Batch;
1896 /// use google_cloud_dataproc_v1::model::SparkRBatch;
1897 /// let x = Batch::new().set_spark_r_batch(SparkRBatch::default()/* use setters */);
1898 /// assert!(x.spark_r_batch().is_some());
1899 /// assert!(x.pyspark_batch().is_none());
1900 /// assert!(x.spark_batch().is_none());
1901 /// assert!(x.spark_sql_batch().is_none());
1902 /// ```
1903 pub fn set_spark_r_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkRBatch>>>(
1904 mut self,
1905 v: T,
1906 ) -> Self {
1907 self.batch_config =
1908 std::option::Option::Some(crate::model::batch::BatchConfig::SparkRBatch(v.into()));
1909 self
1910 }
1911
1912 /// The value of [batch_config][crate::model::Batch::batch_config]
1913 /// if it holds a `SparkSqlBatch`, `None` if the field is not set or
1914 /// holds a different branch.
1915 pub fn spark_sql_batch(
1916 &self,
1917 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlBatch>> {
1918 #[allow(unreachable_patterns)]
1919 self.batch_config.as_ref().and_then(|v| match v {
1920 crate::model::batch::BatchConfig::SparkSqlBatch(v) => std::option::Option::Some(v),
1921 _ => std::option::Option::None,
1922 })
1923 }
1924
1925 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1926 /// to hold a `SparkSqlBatch`.
1927 ///
1928 /// Note that all the setters affecting `batch_config` are
1929 /// mutually exclusive.
1930 ///
1931 /// # Example
1932 /// ```ignore,no_run
1933 /// # use google_cloud_dataproc_v1::model::Batch;
1934 /// use google_cloud_dataproc_v1::model::SparkSqlBatch;
1935 /// let x = Batch::new().set_spark_sql_batch(SparkSqlBatch::default()/* use setters */);
1936 /// assert!(x.spark_sql_batch().is_some());
1937 /// assert!(x.pyspark_batch().is_none());
1938 /// assert!(x.spark_batch().is_none());
1939 /// assert!(x.spark_r_batch().is_none());
1940 /// ```
1941 pub fn set_spark_sql_batch<
1942 T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlBatch>>,
1943 >(
1944 mut self,
1945 v: T,
1946 ) -> Self {
1947 self.batch_config =
1948 std::option::Option::Some(crate::model::batch::BatchConfig::SparkSqlBatch(v.into()));
1949 self
1950 }
1951}
1952
1953impl wkt::message::Message for Batch {
1954 fn typename() -> &'static str {
1955 "type.googleapis.com/google.cloud.dataproc.v1.Batch"
1956 }
1957}
1958
1959/// Defines additional types related to [Batch].
1960pub mod batch {
1961 #[allow(unused_imports)]
1962 use super::*;
1963
1964 /// Historical state information.
1965 #[derive(Clone, Default, PartialEq)]
1966 #[non_exhaustive]
1967 pub struct StateHistory {
1968 /// Output only. The state of the batch at this point in history.
1969 pub state: crate::model::batch::State,
1970
1971 /// Output only. Details about the state at this point in history.
1972 pub state_message: std::string::String,
1973
1974 /// Output only. The time when the batch entered the historical state.
1975 pub state_start_time: std::option::Option<wkt::Timestamp>,
1976
1977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1978 }
1979
1980 impl StateHistory {
1981 pub fn new() -> Self {
1982 std::default::Default::default()
1983 }
1984
1985 /// Sets the value of [state][crate::model::batch::StateHistory::state].
1986 ///
1987 /// # Example
1988 /// ```ignore,no_run
1989 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
1990 /// use google_cloud_dataproc_v1::model::batch::State;
1991 /// let x0 = StateHistory::new().set_state(State::Pending);
1992 /// let x1 = StateHistory::new().set_state(State::Running);
1993 /// let x2 = StateHistory::new().set_state(State::Cancelling);
1994 /// ```
1995 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(
1996 mut self,
1997 v: T,
1998 ) -> Self {
1999 self.state = v.into();
2000 self
2001 }
2002
2003 /// Sets the value of [state_message][crate::model::batch::StateHistory::state_message].
2004 ///
2005 /// # Example
2006 /// ```ignore,no_run
2007 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2008 /// let x = StateHistory::new().set_state_message("example");
2009 /// ```
2010 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
2011 mut self,
2012 v: T,
2013 ) -> Self {
2014 self.state_message = v.into();
2015 self
2016 }
2017
2018 /// Sets the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2019 ///
2020 /// # Example
2021 /// ```ignore,no_run
2022 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2023 /// use wkt::Timestamp;
2024 /// let x = StateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
2025 /// ```
2026 pub fn set_state_start_time<T>(mut self, v: T) -> Self
2027 where
2028 T: std::convert::Into<wkt::Timestamp>,
2029 {
2030 self.state_start_time = std::option::Option::Some(v.into());
2031 self
2032 }
2033
2034 /// Sets or clears the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2035 ///
2036 /// # Example
2037 /// ```ignore,no_run
2038 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2039 /// use wkt::Timestamp;
2040 /// let x = StateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
2041 /// let x = StateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
2042 /// ```
2043 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2044 where
2045 T: std::convert::Into<wkt::Timestamp>,
2046 {
2047 self.state_start_time = v.map(|x| x.into());
2048 self
2049 }
2050 }
2051
2052 impl wkt::message::Message for StateHistory {
2053 fn typename() -> &'static str {
2054 "type.googleapis.com/google.cloud.dataproc.v1.Batch.StateHistory"
2055 }
2056 }
2057
2058 /// The batch state.
2059 ///
2060 /// # Working with unknown values
2061 ///
2062 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2063 /// additional enum variants at any time. Adding new variants is not considered
2064 /// a breaking change. Applications should write their code in anticipation of:
2065 ///
2066 /// - New values appearing in future releases of the client library, **and**
2067 /// - New values received dynamically, without application changes.
2068 ///
2069 /// Please consult the [Working with enums] section in the user guide for some
2070 /// guidelines.
2071 ///
2072 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2073 #[derive(Clone, Debug, PartialEq)]
2074 #[non_exhaustive]
2075 pub enum State {
2076 /// The batch state is unknown.
2077 Unspecified,
2078 /// The batch is created before running.
2079 Pending,
2080 /// The batch is running.
2081 Running,
2082 /// The batch is cancelling.
2083 Cancelling,
2084 /// The batch cancellation was successful.
2085 Cancelled,
2086 /// The batch completed successfully.
2087 Succeeded,
2088 /// The batch is no longer running due to an error.
2089 Failed,
2090 /// If set, the enum was initialized with an unknown value.
2091 ///
2092 /// Applications can examine the value using [State::value] or
2093 /// [State::name].
2094 UnknownValue(state::UnknownValue),
2095 }
2096
2097 #[doc(hidden)]
2098 pub mod state {
2099 #[allow(unused_imports)]
2100 use super::*;
2101 #[derive(Clone, Debug, PartialEq)]
2102 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2103 }
2104
2105 impl State {
2106 /// Gets the enum value.
2107 ///
2108 /// Returns `None` if the enum contains an unknown value deserialized from
2109 /// the string representation of enums.
2110 pub fn value(&self) -> std::option::Option<i32> {
2111 match self {
2112 Self::Unspecified => std::option::Option::Some(0),
2113 Self::Pending => std::option::Option::Some(1),
2114 Self::Running => std::option::Option::Some(2),
2115 Self::Cancelling => std::option::Option::Some(3),
2116 Self::Cancelled => std::option::Option::Some(4),
2117 Self::Succeeded => std::option::Option::Some(5),
2118 Self::Failed => std::option::Option::Some(6),
2119 Self::UnknownValue(u) => u.0.value(),
2120 }
2121 }
2122
2123 /// Gets the enum value as a string.
2124 ///
2125 /// Returns `None` if the enum contains an unknown value deserialized from
2126 /// the integer representation of enums.
2127 pub fn name(&self) -> std::option::Option<&str> {
2128 match self {
2129 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2130 Self::Pending => std::option::Option::Some("PENDING"),
2131 Self::Running => std::option::Option::Some("RUNNING"),
2132 Self::Cancelling => std::option::Option::Some("CANCELLING"),
2133 Self::Cancelled => std::option::Option::Some("CANCELLED"),
2134 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2135 Self::Failed => std::option::Option::Some("FAILED"),
2136 Self::UnknownValue(u) => u.0.name(),
2137 }
2138 }
2139 }
2140
2141 impl std::default::Default for State {
2142 fn default() -> Self {
2143 use std::convert::From;
2144 Self::from(0)
2145 }
2146 }
2147
2148 impl std::fmt::Display for State {
2149 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2150 wkt::internal::display_enum(f, self.name(), self.value())
2151 }
2152 }
2153
2154 impl std::convert::From<i32> for State {
2155 fn from(value: i32) -> Self {
2156 match value {
2157 0 => Self::Unspecified,
2158 1 => Self::Pending,
2159 2 => Self::Running,
2160 3 => Self::Cancelling,
2161 4 => Self::Cancelled,
2162 5 => Self::Succeeded,
2163 6 => Self::Failed,
2164 _ => Self::UnknownValue(state::UnknownValue(
2165 wkt::internal::UnknownEnumValue::Integer(value),
2166 )),
2167 }
2168 }
2169 }
2170
2171 impl std::convert::From<&str> for State {
2172 fn from(value: &str) -> Self {
2173 use std::string::ToString;
2174 match value {
2175 "STATE_UNSPECIFIED" => Self::Unspecified,
2176 "PENDING" => Self::Pending,
2177 "RUNNING" => Self::Running,
2178 "CANCELLING" => Self::Cancelling,
2179 "CANCELLED" => Self::Cancelled,
2180 "SUCCEEDED" => Self::Succeeded,
2181 "FAILED" => Self::Failed,
2182 _ => Self::UnknownValue(state::UnknownValue(
2183 wkt::internal::UnknownEnumValue::String(value.to_string()),
2184 )),
2185 }
2186 }
2187 }
2188
2189 impl serde::ser::Serialize for State {
2190 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2191 where
2192 S: serde::Serializer,
2193 {
2194 match self {
2195 Self::Unspecified => serializer.serialize_i32(0),
2196 Self::Pending => serializer.serialize_i32(1),
2197 Self::Running => serializer.serialize_i32(2),
2198 Self::Cancelling => serializer.serialize_i32(3),
2199 Self::Cancelled => serializer.serialize_i32(4),
2200 Self::Succeeded => serializer.serialize_i32(5),
2201 Self::Failed => serializer.serialize_i32(6),
2202 Self::UnknownValue(u) => u.0.serialize(serializer),
2203 }
2204 }
2205 }
2206
2207 impl<'de> serde::de::Deserialize<'de> for State {
2208 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2209 where
2210 D: serde::Deserializer<'de>,
2211 {
2212 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2213 ".google.cloud.dataproc.v1.Batch.State",
2214 ))
2215 }
2216 }
2217
2218 /// The application/framework-specific portion of the batch configuration.
2219 #[derive(Clone, Debug, PartialEq)]
2220 #[non_exhaustive]
2221 pub enum BatchConfig {
2222 /// Optional. PySpark batch config.
2223 PysparkBatch(std::boxed::Box<crate::model::PySparkBatch>),
2224 /// Optional. Spark batch config.
2225 SparkBatch(std::boxed::Box<crate::model::SparkBatch>),
2226 /// Optional. SparkR batch config.
2227 SparkRBatch(std::boxed::Box<crate::model::SparkRBatch>),
2228 /// Optional. SparkSql batch config.
2229 SparkSqlBatch(std::boxed::Box<crate::model::SparkSqlBatch>),
2230 }
2231}
2232
2233/// A configuration for running an
2234/// [Apache
2235/// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html)
2236/// batch workload.
2237#[derive(Clone, Default, PartialEq)]
2238#[non_exhaustive]
2239pub struct PySparkBatch {
2240 /// Required. The HCFS URI of the main Python file to use as the Spark driver.
2241 /// Must be a .py file.
2242 pub main_python_file_uri: std::string::String,
2243
2244 /// Optional. The arguments to pass to the driver. Do not include arguments
2245 /// that can be set as batch properties, such as `--conf`, since a collision
2246 /// can occur that causes an incorrect batch submission.
2247 pub args: std::vec::Vec<std::string::String>,
2248
2249 /// Optional. HCFS file URIs of Python files to pass to the PySpark
2250 /// framework. Supported file types: `.py`, `.egg`, and `.zip`.
2251 pub python_file_uris: std::vec::Vec<std::string::String>,
2252
2253 /// Optional. HCFS URIs of jar files to add to the classpath of the
2254 /// Spark driver and tasks.
2255 pub jar_file_uris: std::vec::Vec<std::string::String>,
2256
2257 /// Optional. HCFS URIs of files to be placed in the working directory of
2258 /// each executor.
2259 pub file_uris: std::vec::Vec<std::string::String>,
2260
2261 /// Optional. HCFS URIs of archives to be extracted into the working directory
2262 /// of each executor. Supported file types:
2263 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2264 pub archive_uris: std::vec::Vec<std::string::String>,
2265
2266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2267}
2268
2269impl PySparkBatch {
2270 pub fn new() -> Self {
2271 std::default::Default::default()
2272 }
2273
2274 /// Sets the value of [main_python_file_uri][crate::model::PySparkBatch::main_python_file_uri].
2275 ///
2276 /// # Example
2277 /// ```ignore,no_run
2278 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2279 /// let x = PySparkBatch::new().set_main_python_file_uri("example");
2280 /// ```
2281 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
2282 mut self,
2283 v: T,
2284 ) -> Self {
2285 self.main_python_file_uri = v.into();
2286 self
2287 }
2288
2289 /// Sets the value of [args][crate::model::PySparkBatch::args].
2290 ///
2291 /// # Example
2292 /// ```ignore,no_run
2293 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2294 /// let x = PySparkBatch::new().set_args(["a", "b", "c"]);
2295 /// ```
2296 pub fn set_args<T, V>(mut self, v: T) -> Self
2297 where
2298 T: std::iter::IntoIterator<Item = V>,
2299 V: std::convert::Into<std::string::String>,
2300 {
2301 use std::iter::Iterator;
2302 self.args = v.into_iter().map(|i| i.into()).collect();
2303 self
2304 }
2305
2306 /// Sets the value of [python_file_uris][crate::model::PySparkBatch::python_file_uris].
2307 ///
2308 /// # Example
2309 /// ```ignore,no_run
2310 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2311 /// let x = PySparkBatch::new().set_python_file_uris(["a", "b", "c"]);
2312 /// ```
2313 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
2314 where
2315 T: std::iter::IntoIterator<Item = V>,
2316 V: std::convert::Into<std::string::String>,
2317 {
2318 use std::iter::Iterator;
2319 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
2320 self
2321 }
2322
2323 /// Sets the value of [jar_file_uris][crate::model::PySparkBatch::jar_file_uris].
2324 ///
2325 /// # Example
2326 /// ```ignore,no_run
2327 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2328 /// let x = PySparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2329 /// ```
2330 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2331 where
2332 T: std::iter::IntoIterator<Item = V>,
2333 V: std::convert::Into<std::string::String>,
2334 {
2335 use std::iter::Iterator;
2336 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2337 self
2338 }
2339
2340 /// Sets the value of [file_uris][crate::model::PySparkBatch::file_uris].
2341 ///
2342 /// # Example
2343 /// ```ignore,no_run
2344 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2345 /// let x = PySparkBatch::new().set_file_uris(["a", "b", "c"]);
2346 /// ```
2347 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2348 where
2349 T: std::iter::IntoIterator<Item = V>,
2350 V: std::convert::Into<std::string::String>,
2351 {
2352 use std::iter::Iterator;
2353 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2354 self
2355 }
2356
2357 /// Sets the value of [archive_uris][crate::model::PySparkBatch::archive_uris].
2358 ///
2359 /// # Example
2360 /// ```ignore,no_run
2361 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2362 /// let x = PySparkBatch::new().set_archive_uris(["a", "b", "c"]);
2363 /// ```
2364 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2365 where
2366 T: std::iter::IntoIterator<Item = V>,
2367 V: std::convert::Into<std::string::String>,
2368 {
2369 use std::iter::Iterator;
2370 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2371 self
2372 }
2373}
2374
2375impl wkt::message::Message for PySparkBatch {
2376 fn typename() -> &'static str {
2377 "type.googleapis.com/google.cloud.dataproc.v1.PySparkBatch"
2378 }
2379}
2380
2381/// A configuration for running an [Apache Spark](https://spark.apache.org/)
2382/// batch workload.
2383#[derive(Clone, Default, PartialEq)]
2384#[non_exhaustive]
2385pub struct SparkBatch {
2386 /// Optional. The arguments to pass to the driver. Do not include arguments
2387 /// that can be set as batch properties, such as `--conf`, since a collision
2388 /// can occur that causes an incorrect batch submission.
2389 pub args: std::vec::Vec<std::string::String>,
2390
2391 /// Optional. HCFS URIs of jar files to add to the classpath of the
2392 /// Spark driver and tasks.
2393 pub jar_file_uris: std::vec::Vec<std::string::String>,
2394
2395 /// Optional. HCFS URIs of files to be placed in the working directory of
2396 /// each executor.
2397 pub file_uris: std::vec::Vec<std::string::String>,
2398
2399 /// Optional. HCFS URIs of archives to be extracted into the working directory
2400 /// of each executor. Supported file types:
2401 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2402 pub archive_uris: std::vec::Vec<std::string::String>,
2403
2404 /// The specification of the main method to call to drive the Spark
2405 /// workload. Specify either the jar file that contains the main class or the
2406 /// main class name. To pass both a main jar and a main class in that jar, add
2407 /// the jar to `jar_file_uris`, and then specify the main class
2408 /// name in `main_class`.
2409 pub driver: std::option::Option<crate::model::spark_batch::Driver>,
2410
2411 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2412}
2413
2414impl SparkBatch {
2415 pub fn new() -> Self {
2416 std::default::Default::default()
2417 }
2418
2419 /// Sets the value of [args][crate::model::SparkBatch::args].
2420 ///
2421 /// # Example
2422 /// ```ignore,no_run
2423 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2424 /// let x = SparkBatch::new().set_args(["a", "b", "c"]);
2425 /// ```
2426 pub fn set_args<T, V>(mut self, v: T) -> Self
2427 where
2428 T: std::iter::IntoIterator<Item = V>,
2429 V: std::convert::Into<std::string::String>,
2430 {
2431 use std::iter::Iterator;
2432 self.args = v.into_iter().map(|i| i.into()).collect();
2433 self
2434 }
2435
2436 /// Sets the value of [jar_file_uris][crate::model::SparkBatch::jar_file_uris].
2437 ///
2438 /// # Example
2439 /// ```ignore,no_run
2440 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2441 /// let x = SparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2442 /// ```
2443 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2444 where
2445 T: std::iter::IntoIterator<Item = V>,
2446 V: std::convert::Into<std::string::String>,
2447 {
2448 use std::iter::Iterator;
2449 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2450 self
2451 }
2452
2453 /// Sets the value of [file_uris][crate::model::SparkBatch::file_uris].
2454 ///
2455 /// # Example
2456 /// ```ignore,no_run
2457 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2458 /// let x = SparkBatch::new().set_file_uris(["a", "b", "c"]);
2459 /// ```
2460 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2461 where
2462 T: std::iter::IntoIterator<Item = V>,
2463 V: std::convert::Into<std::string::String>,
2464 {
2465 use std::iter::Iterator;
2466 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2467 self
2468 }
2469
2470 /// Sets the value of [archive_uris][crate::model::SparkBatch::archive_uris].
2471 ///
2472 /// # Example
2473 /// ```ignore,no_run
2474 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2475 /// let x = SparkBatch::new().set_archive_uris(["a", "b", "c"]);
2476 /// ```
2477 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2478 where
2479 T: std::iter::IntoIterator<Item = V>,
2480 V: std::convert::Into<std::string::String>,
2481 {
2482 use std::iter::Iterator;
2483 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2484 self
2485 }
2486
2487 /// Sets the value of [driver][crate::model::SparkBatch::driver].
2488 ///
2489 /// Note that all the setters affecting `driver` are mutually
2490 /// exclusive.
2491 ///
2492 /// # Example
2493 /// ```ignore,no_run
2494 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2495 /// use google_cloud_dataproc_v1::model::spark_batch::Driver;
2496 /// let x = SparkBatch::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
2497 /// ```
2498 pub fn set_driver<
2499 T: std::convert::Into<std::option::Option<crate::model::spark_batch::Driver>>,
2500 >(
2501 mut self,
2502 v: T,
2503 ) -> Self {
2504 self.driver = v.into();
2505 self
2506 }
2507
2508 /// The value of [driver][crate::model::SparkBatch::driver]
2509 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
2510 /// holds a different branch.
2511 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
2512 #[allow(unreachable_patterns)]
2513 self.driver.as_ref().and_then(|v| match v {
2514 crate::model::spark_batch::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
2515 _ => std::option::Option::None,
2516 })
2517 }
2518
2519 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2520 /// to hold a `MainJarFileUri`.
2521 ///
2522 /// Note that all the setters affecting `driver` are
2523 /// mutually exclusive.
2524 ///
2525 /// # Example
2526 /// ```ignore,no_run
2527 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2528 /// let x = SparkBatch::new().set_main_jar_file_uri("example");
2529 /// assert!(x.main_jar_file_uri().is_some());
2530 /// assert!(x.main_class().is_none());
2531 /// ```
2532 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
2533 mut self,
2534 v: T,
2535 ) -> Self {
2536 self.driver =
2537 std::option::Option::Some(crate::model::spark_batch::Driver::MainJarFileUri(v.into()));
2538 self
2539 }
2540
2541 /// The value of [driver][crate::model::SparkBatch::driver]
2542 /// if it holds a `MainClass`, `None` if the field is not set or
2543 /// holds a different branch.
2544 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
2545 #[allow(unreachable_patterns)]
2546 self.driver.as_ref().and_then(|v| match v {
2547 crate::model::spark_batch::Driver::MainClass(v) => std::option::Option::Some(v),
2548 _ => std::option::Option::None,
2549 })
2550 }
2551
2552 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2553 /// to hold a `MainClass`.
2554 ///
2555 /// Note that all the setters affecting `driver` are
2556 /// mutually exclusive.
2557 ///
2558 /// # Example
2559 /// ```ignore,no_run
2560 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2561 /// let x = SparkBatch::new().set_main_class("example");
2562 /// assert!(x.main_class().is_some());
2563 /// assert!(x.main_jar_file_uri().is_none());
2564 /// ```
2565 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2566 self.driver =
2567 std::option::Option::Some(crate::model::spark_batch::Driver::MainClass(v.into()));
2568 self
2569 }
2570}
2571
2572impl wkt::message::Message for SparkBatch {
2573 fn typename() -> &'static str {
2574 "type.googleapis.com/google.cloud.dataproc.v1.SparkBatch"
2575 }
2576}
2577
2578/// Defines additional types related to [SparkBatch].
2579pub mod spark_batch {
2580 #[allow(unused_imports)]
2581 use super::*;
2582
2583 /// The specification of the main method to call to drive the Spark
2584 /// workload. Specify either the jar file that contains the main class or the
2585 /// main class name. To pass both a main jar and a main class in that jar, add
2586 /// the jar to `jar_file_uris`, and then specify the main class
2587 /// name in `main_class`.
2588 #[derive(Clone, Debug, PartialEq)]
2589 #[non_exhaustive]
2590 pub enum Driver {
2591 /// Optional. The HCFS URI of the jar file that contains the main class.
2592 MainJarFileUri(std::string::String),
2593 /// Optional. The name of the driver main class. The jar file that contains
2594 /// the class must be in the classpath or specified in `jar_file_uris`.
2595 MainClass(std::string::String),
2596 }
2597}
2598
2599/// A configuration for running an
2600/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
2601/// batch workload.
2602#[derive(Clone, Default, PartialEq)]
2603#[non_exhaustive]
2604pub struct SparkRBatch {
2605 /// Required. The HCFS URI of the main R file to use as the driver.
2606 /// Must be a `.R` or `.r` file.
2607 pub main_r_file_uri: std::string::String,
2608
2609 /// Optional. The arguments to pass to the Spark driver. Do not include
2610 /// arguments that can be set as batch properties, such as `--conf`, since a
2611 /// collision can occur that causes an incorrect batch submission.
2612 pub args: std::vec::Vec<std::string::String>,
2613
2614 /// Optional. HCFS URIs of files to be placed in the working directory of
2615 /// each executor.
2616 pub file_uris: std::vec::Vec<std::string::String>,
2617
2618 /// Optional. HCFS URIs of archives to be extracted into the working directory
2619 /// of each executor. Supported file types:
2620 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2621 pub archive_uris: std::vec::Vec<std::string::String>,
2622
2623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2624}
2625
2626impl SparkRBatch {
2627 pub fn new() -> Self {
2628 std::default::Default::default()
2629 }
2630
2631 /// Sets the value of [main_r_file_uri][crate::model::SparkRBatch::main_r_file_uri].
2632 ///
2633 /// # Example
2634 /// ```ignore,no_run
2635 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2636 /// let x = SparkRBatch::new().set_main_r_file_uri("example");
2637 /// ```
2638 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2639 self.main_r_file_uri = v.into();
2640 self
2641 }
2642
2643 /// Sets the value of [args][crate::model::SparkRBatch::args].
2644 ///
2645 /// # Example
2646 /// ```ignore,no_run
2647 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2648 /// let x = SparkRBatch::new().set_args(["a", "b", "c"]);
2649 /// ```
2650 pub fn set_args<T, V>(mut self, v: T) -> Self
2651 where
2652 T: std::iter::IntoIterator<Item = V>,
2653 V: std::convert::Into<std::string::String>,
2654 {
2655 use std::iter::Iterator;
2656 self.args = v.into_iter().map(|i| i.into()).collect();
2657 self
2658 }
2659
2660 /// Sets the value of [file_uris][crate::model::SparkRBatch::file_uris].
2661 ///
2662 /// # Example
2663 /// ```ignore,no_run
2664 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2665 /// let x = SparkRBatch::new().set_file_uris(["a", "b", "c"]);
2666 /// ```
2667 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2668 where
2669 T: std::iter::IntoIterator<Item = V>,
2670 V: std::convert::Into<std::string::String>,
2671 {
2672 use std::iter::Iterator;
2673 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2674 self
2675 }
2676
2677 /// Sets the value of [archive_uris][crate::model::SparkRBatch::archive_uris].
2678 ///
2679 /// # Example
2680 /// ```ignore,no_run
2681 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2682 /// let x = SparkRBatch::new().set_archive_uris(["a", "b", "c"]);
2683 /// ```
2684 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2685 where
2686 T: std::iter::IntoIterator<Item = V>,
2687 V: std::convert::Into<std::string::String>,
2688 {
2689 use std::iter::Iterator;
2690 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2691 self
2692 }
2693}
2694
2695impl wkt::message::Message for SparkRBatch {
2696 fn typename() -> &'static str {
2697 "type.googleapis.com/google.cloud.dataproc.v1.SparkRBatch"
2698 }
2699}
2700
2701/// A configuration for running
2702/// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch
2703/// workload.
2704#[derive(Clone, Default, PartialEq)]
2705#[non_exhaustive]
2706pub struct SparkSqlBatch {
2707 /// Required. The HCFS URI of the script that contains Spark SQL queries to
2708 /// execute.
2709 pub query_file_uri: std::string::String,
2710
2711 /// Optional. Mapping of query variable names to values (equivalent to the
2712 /// Spark SQL command: `SET name="value";`).
2713 pub query_variables: std::collections::HashMap<std::string::String, std::string::String>,
2714
2715 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2716 pub jar_file_uris: std::vec::Vec<std::string::String>,
2717
2718 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2719}
2720
2721impl SparkSqlBatch {
2722 pub fn new() -> Self {
2723 std::default::Default::default()
2724 }
2725
2726 /// Sets the value of [query_file_uri][crate::model::SparkSqlBatch::query_file_uri].
2727 ///
2728 /// # Example
2729 /// ```ignore,no_run
2730 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2731 /// let x = SparkSqlBatch::new().set_query_file_uri("example");
2732 /// ```
2733 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2734 self.query_file_uri = v.into();
2735 self
2736 }
2737
2738 /// Sets the value of [query_variables][crate::model::SparkSqlBatch::query_variables].
2739 ///
2740 /// # Example
2741 /// ```ignore,no_run
2742 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2743 /// let x = SparkSqlBatch::new().set_query_variables([
2744 /// ("key0", "abc"),
2745 /// ("key1", "xyz"),
2746 /// ]);
2747 /// ```
2748 pub fn set_query_variables<T, K, V>(mut self, v: T) -> Self
2749 where
2750 T: std::iter::IntoIterator<Item = (K, V)>,
2751 K: std::convert::Into<std::string::String>,
2752 V: std::convert::Into<std::string::String>,
2753 {
2754 use std::iter::Iterator;
2755 self.query_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2756 self
2757 }
2758
2759 /// Sets the value of [jar_file_uris][crate::model::SparkSqlBatch::jar_file_uris].
2760 ///
2761 /// # Example
2762 /// ```ignore,no_run
2763 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2764 /// let x = SparkSqlBatch::new().set_jar_file_uris(["a", "b", "c"]);
2765 /// ```
2766 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2767 where
2768 T: std::iter::IntoIterator<Item = V>,
2769 V: std::convert::Into<std::string::String>,
2770 {
2771 use std::iter::Iterator;
2772 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2773 self
2774 }
2775}
2776
2777impl wkt::message::Message for SparkSqlBatch {
2778 fn typename() -> &'static str {
2779 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlBatch"
2780 }
2781}
2782
2783/// Describes the identifying information, config, and status of
2784/// a Dataproc cluster
2785#[derive(Clone, Default, PartialEq)]
2786#[non_exhaustive]
2787pub struct Cluster {
2788 /// Required. The Google Cloud Platform project ID that the cluster belongs to.
2789 pub project_id: std::string::String,
2790
2791 /// Required. The cluster name, which must be unique within a project.
2792 /// The name must start with a lowercase letter, and can contain
2793 /// up to 51 lowercase letters, numbers, and hyphens. It cannot end
2794 /// with a hyphen. The name of a deleted cluster can be reused.
2795 pub cluster_name: std::string::String,
2796
2797 /// Optional. The cluster config for a cluster of Compute Engine Instances.
2798 /// Note that Dataproc may set default values, and values may change
2799 /// when clusters are updated.
2800 ///
2801 /// Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
2802 pub config: std::option::Option<crate::model::ClusterConfig>,
2803
2804 /// Optional. The virtual cluster config is used when creating a Dataproc
2805 /// cluster that does not directly control the underlying compute resources,
2806 /// for example, when creating a [Dataproc-on-GKE
2807 /// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
2808 /// Dataproc may set default values, and values may change when
2809 /// clusters are updated. Exactly one of
2810 /// [config][google.cloud.dataproc.v1.Cluster.config] or
2811 /// [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config]
2812 /// must be specified.
2813 ///
2814 /// [google.cloud.dataproc.v1.Cluster.config]: crate::model::Cluster::config
2815 /// [google.cloud.dataproc.v1.Cluster.virtual_cluster_config]: crate::model::Cluster::virtual_cluster_config
2816 pub virtual_cluster_config: std::option::Option<crate::model::VirtualClusterConfig>,
2817
2818 /// Optional. The labels to associate with this cluster.
2819 /// Label **keys** must contain 1 to 63 characters, and must conform to
2820 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
2821 /// Label **values** may be empty, but, if present, must contain 1 to 63
2822 /// characters, and must conform to [RFC
2823 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
2824 /// associated with a cluster.
2825 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2826
2827 /// Output only. Cluster status.
2828 pub status: std::option::Option<crate::model::ClusterStatus>,
2829
2830 /// Output only. The previous cluster status.
2831 pub status_history: std::vec::Vec<crate::model::ClusterStatus>,
2832
2833 /// Output only. A cluster UUID (Unique Universal Identifier). Dataproc
2834 /// generates this value when it creates the cluster.
2835 pub cluster_uuid: std::string::String,
2836
2837 /// Output only. Contains cluster daemon metrics such as HDFS and YARN stats.
2838 ///
2839 /// **Beta Feature**: This report is available for testing purposes only. It
2840 /// may be changed before final release.
2841 pub metrics: std::option::Option<crate::model::ClusterMetrics>,
2842
2843 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2844}
2845
2846impl Cluster {
2847 pub fn new() -> Self {
2848 std::default::Default::default()
2849 }
2850
2851 /// Sets the value of [project_id][crate::model::Cluster::project_id].
2852 ///
2853 /// # Example
2854 /// ```ignore,no_run
2855 /// # use google_cloud_dataproc_v1::model::Cluster;
2856 /// let x = Cluster::new().set_project_id("example");
2857 /// ```
2858 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2859 self.project_id = v.into();
2860 self
2861 }
2862
2863 /// Sets the value of [cluster_name][crate::model::Cluster::cluster_name].
2864 ///
2865 /// # Example
2866 /// ```ignore,no_run
2867 /// # use google_cloud_dataproc_v1::model::Cluster;
2868 /// let x = Cluster::new().set_cluster_name("example");
2869 /// ```
2870 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2871 self.cluster_name = v.into();
2872 self
2873 }
2874
2875 /// Sets the value of [config][crate::model::Cluster::config].
2876 ///
2877 /// # Example
2878 /// ```ignore,no_run
2879 /// # use google_cloud_dataproc_v1::model::Cluster;
2880 /// use google_cloud_dataproc_v1::model::ClusterConfig;
2881 /// let x = Cluster::new().set_config(ClusterConfig::default()/* use setters */);
2882 /// ```
2883 pub fn set_config<T>(mut self, v: T) -> Self
2884 where
2885 T: std::convert::Into<crate::model::ClusterConfig>,
2886 {
2887 self.config = std::option::Option::Some(v.into());
2888 self
2889 }
2890
2891 /// Sets or clears the value of [config][crate::model::Cluster::config].
2892 ///
2893 /// # Example
2894 /// ```ignore,no_run
2895 /// # use google_cloud_dataproc_v1::model::Cluster;
2896 /// use google_cloud_dataproc_v1::model::ClusterConfig;
2897 /// let x = Cluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
2898 /// let x = Cluster::new().set_or_clear_config(None::<ClusterConfig>);
2899 /// ```
2900 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
2901 where
2902 T: std::convert::Into<crate::model::ClusterConfig>,
2903 {
2904 self.config = v.map(|x| x.into());
2905 self
2906 }
2907
2908 /// Sets the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
2909 ///
2910 /// # Example
2911 /// ```ignore,no_run
2912 /// # use google_cloud_dataproc_v1::model::Cluster;
2913 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
2914 /// let x = Cluster::new().set_virtual_cluster_config(VirtualClusterConfig::default()/* use setters */);
2915 /// ```
2916 pub fn set_virtual_cluster_config<T>(mut self, v: T) -> Self
2917 where
2918 T: std::convert::Into<crate::model::VirtualClusterConfig>,
2919 {
2920 self.virtual_cluster_config = std::option::Option::Some(v.into());
2921 self
2922 }
2923
2924 /// Sets or clears the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
2925 ///
2926 /// # Example
2927 /// ```ignore,no_run
2928 /// # use google_cloud_dataproc_v1::model::Cluster;
2929 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
2930 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(Some(VirtualClusterConfig::default()/* use setters */));
2931 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(None::<VirtualClusterConfig>);
2932 /// ```
2933 pub fn set_or_clear_virtual_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
2934 where
2935 T: std::convert::Into<crate::model::VirtualClusterConfig>,
2936 {
2937 self.virtual_cluster_config = v.map(|x| x.into());
2938 self
2939 }
2940
2941 /// Sets the value of [labels][crate::model::Cluster::labels].
2942 ///
2943 /// # Example
2944 /// ```ignore,no_run
2945 /// # use google_cloud_dataproc_v1::model::Cluster;
2946 /// let x = Cluster::new().set_labels([
2947 /// ("key0", "abc"),
2948 /// ("key1", "xyz"),
2949 /// ]);
2950 /// ```
2951 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2952 where
2953 T: std::iter::IntoIterator<Item = (K, V)>,
2954 K: std::convert::Into<std::string::String>,
2955 V: std::convert::Into<std::string::String>,
2956 {
2957 use std::iter::Iterator;
2958 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2959 self
2960 }
2961
2962 /// Sets the value of [status][crate::model::Cluster::status].
2963 ///
2964 /// # Example
2965 /// ```ignore,no_run
2966 /// # use google_cloud_dataproc_v1::model::Cluster;
2967 /// use google_cloud_dataproc_v1::model::ClusterStatus;
2968 /// let x = Cluster::new().set_status(ClusterStatus::default()/* use setters */);
2969 /// ```
2970 pub fn set_status<T>(mut self, v: T) -> Self
2971 where
2972 T: std::convert::Into<crate::model::ClusterStatus>,
2973 {
2974 self.status = std::option::Option::Some(v.into());
2975 self
2976 }
2977
2978 /// Sets or clears the value of [status][crate::model::Cluster::status].
2979 ///
2980 /// # Example
2981 /// ```ignore,no_run
2982 /// # use google_cloud_dataproc_v1::model::Cluster;
2983 /// use google_cloud_dataproc_v1::model::ClusterStatus;
2984 /// let x = Cluster::new().set_or_clear_status(Some(ClusterStatus::default()/* use setters */));
2985 /// let x = Cluster::new().set_or_clear_status(None::<ClusterStatus>);
2986 /// ```
2987 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
2988 where
2989 T: std::convert::Into<crate::model::ClusterStatus>,
2990 {
2991 self.status = v.map(|x| x.into());
2992 self
2993 }
2994
2995 /// Sets the value of [status_history][crate::model::Cluster::status_history].
2996 ///
2997 /// # Example
2998 /// ```ignore,no_run
2999 /// # use google_cloud_dataproc_v1::model::Cluster;
3000 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3001 /// let x = Cluster::new()
3002 /// .set_status_history([
3003 /// ClusterStatus::default()/* use setters */,
3004 /// ClusterStatus::default()/* use (different) setters */,
3005 /// ]);
3006 /// ```
3007 pub fn set_status_history<T, V>(mut self, v: T) -> Self
3008 where
3009 T: std::iter::IntoIterator<Item = V>,
3010 V: std::convert::Into<crate::model::ClusterStatus>,
3011 {
3012 use std::iter::Iterator;
3013 self.status_history = v.into_iter().map(|i| i.into()).collect();
3014 self
3015 }
3016
3017 /// Sets the value of [cluster_uuid][crate::model::Cluster::cluster_uuid].
3018 ///
3019 /// # Example
3020 /// ```ignore,no_run
3021 /// # use google_cloud_dataproc_v1::model::Cluster;
3022 /// let x = Cluster::new().set_cluster_uuid("example");
3023 /// ```
3024 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3025 self.cluster_uuid = v.into();
3026 self
3027 }
3028
3029 /// Sets the value of [metrics][crate::model::Cluster::metrics].
3030 ///
3031 /// # Example
3032 /// ```ignore,no_run
3033 /// # use google_cloud_dataproc_v1::model::Cluster;
3034 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3035 /// let x = Cluster::new().set_metrics(ClusterMetrics::default()/* use setters */);
3036 /// ```
3037 pub fn set_metrics<T>(mut self, v: T) -> Self
3038 where
3039 T: std::convert::Into<crate::model::ClusterMetrics>,
3040 {
3041 self.metrics = std::option::Option::Some(v.into());
3042 self
3043 }
3044
3045 /// Sets or clears the value of [metrics][crate::model::Cluster::metrics].
3046 ///
3047 /// # Example
3048 /// ```ignore,no_run
3049 /// # use google_cloud_dataproc_v1::model::Cluster;
3050 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3051 /// let x = Cluster::new().set_or_clear_metrics(Some(ClusterMetrics::default()/* use setters */));
3052 /// let x = Cluster::new().set_or_clear_metrics(None::<ClusterMetrics>);
3053 /// ```
3054 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
3055 where
3056 T: std::convert::Into<crate::model::ClusterMetrics>,
3057 {
3058 self.metrics = v.map(|x| x.into());
3059 self
3060 }
3061}
3062
3063impl wkt::message::Message for Cluster {
3064 fn typename() -> &'static str {
3065 "type.googleapis.com/google.cloud.dataproc.v1.Cluster"
3066 }
3067}
3068
3069/// The cluster config.
3070#[derive(Clone, Default, PartialEq)]
3071#[non_exhaustive]
3072pub struct ClusterConfig {
3073 /// Optional. The cluster tier.
3074 pub cluster_tier: crate::model::cluster_config::ClusterTier,
3075
3076 /// Optional. A Cloud Storage bucket used to stage job
3077 /// dependencies, config files, and job driver console output.
3078 /// If you do not specify a staging bucket, Cloud
3079 /// Dataproc will determine a Cloud Storage location (US,
3080 /// ASIA, or EU) for your cluster's staging bucket according to the
3081 /// Compute Engine zone where your cluster is deployed, and then create
3082 /// and manage this project-level, per-location bucket (see
3083 /// [Dataproc staging and temp
3084 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3085 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3086 /// a Cloud Storage bucket.**
3087 pub config_bucket: std::string::String,
3088
3089 /// Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs
3090 /// data, such as Spark and MapReduce history files. If you do not specify a
3091 /// temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or
3092 /// EU) for your cluster's temp bucket according to the Compute Engine zone
3093 /// where your cluster is deployed, and then create and manage this
3094 /// project-level, per-location bucket. The default bucket has a TTL of 90
3095 /// days, but you can use any TTL (or none) if you specify a bucket (see
3096 /// [Dataproc staging and temp
3097 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3098 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3099 /// a Cloud Storage bucket.**
3100 pub temp_bucket: std::string::String,
3101
3102 /// Optional. The shared Compute Engine config settings for
3103 /// all instances in a cluster.
3104 pub gce_cluster_config: std::option::Option<crate::model::GceClusterConfig>,
3105
3106 /// Optional. The Compute Engine config settings for
3107 /// the cluster's master instance.
3108 pub master_config: std::option::Option<crate::model::InstanceGroupConfig>,
3109
3110 /// Optional. The Compute Engine config settings for
3111 /// the cluster's worker instances.
3112 pub worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3113
3114 /// Optional. The Compute Engine config settings for
3115 /// a cluster's secondary worker instances
3116 pub secondary_worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3117
3118 /// Optional. The config settings for cluster software.
3119 pub software_config: std::option::Option<crate::model::SoftwareConfig>,
3120
3121 /// Optional. Commands to execute on each node after config is
3122 /// completed. By default, executables are run on master and all worker nodes.
3123 /// You can test a node's `role` metadata to run an executable on
3124 /// a master or worker node, as shown below using `curl` (you can also use
3125 /// `wget`):
3126 ///
3127 /// ```norust
3128 /// ROLE=$(curl -H Metadata-Flavor:Google
3129 /// http://metadata/computeMetadata/v1/instance/attributes/dataproc-role)
3130 /// if [[ "${ROLE}" == 'Master' ]]; then
3131 /// ... master specific actions ...
3132 /// else
3133 /// ... worker specific actions ...
3134 /// fi
3135 /// ```
3136 pub initialization_actions: std::vec::Vec<crate::model::NodeInitializationAction>,
3137
3138 /// Optional. Encryption settings for the cluster.
3139 pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
3140
3141 /// Optional. Autoscaling config for the policy associated with the cluster.
3142 /// Cluster does not autoscale if this field is unset.
3143 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
3144
3145 /// Optional. Security settings for the cluster.
3146 pub security_config: std::option::Option<crate::model::SecurityConfig>,
3147
3148 /// Optional. Lifecycle setting for the cluster.
3149 pub lifecycle_config: std::option::Option<crate::model::LifecycleConfig>,
3150
3151 /// Optional. Port/endpoint configuration for this cluster
3152 pub endpoint_config: std::option::Option<crate::model::EndpointConfig>,
3153
3154 /// Optional. Metastore configuration.
3155 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3156
3157 /// Optional. The config for Dataproc metrics.
3158 pub dataproc_metric_config: std::option::Option<crate::model::DataprocMetricConfig>,
3159
3160 /// Optional. The node group settings.
3161 pub auxiliary_node_groups: std::vec::Vec<crate::model::AuxiliaryNodeGroup>,
3162
3163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3164}
3165
3166impl ClusterConfig {
3167 pub fn new() -> Self {
3168 std::default::Default::default()
3169 }
3170
3171 /// Sets the value of [cluster_tier][crate::model::ClusterConfig::cluster_tier].
3172 ///
3173 /// # Example
3174 /// ```ignore,no_run
3175 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3176 /// use google_cloud_dataproc_v1::model::cluster_config::ClusterTier;
3177 /// let x0 = ClusterConfig::new().set_cluster_tier(ClusterTier::Standard);
3178 /// let x1 = ClusterConfig::new().set_cluster_tier(ClusterTier::Premium);
3179 /// ```
3180 pub fn set_cluster_tier<T: std::convert::Into<crate::model::cluster_config::ClusterTier>>(
3181 mut self,
3182 v: T,
3183 ) -> Self {
3184 self.cluster_tier = v.into();
3185 self
3186 }
3187
3188 /// Sets the value of [config_bucket][crate::model::ClusterConfig::config_bucket].
3189 ///
3190 /// # Example
3191 /// ```ignore,no_run
3192 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3193 /// let x = ClusterConfig::new().set_config_bucket("example");
3194 /// ```
3195 pub fn set_config_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3196 self.config_bucket = v.into();
3197 self
3198 }
3199
3200 /// Sets the value of [temp_bucket][crate::model::ClusterConfig::temp_bucket].
3201 ///
3202 /// # Example
3203 /// ```ignore,no_run
3204 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3205 /// let x = ClusterConfig::new().set_temp_bucket("example");
3206 /// ```
3207 pub fn set_temp_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3208 self.temp_bucket = v.into();
3209 self
3210 }
3211
3212 /// Sets the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3213 ///
3214 /// # Example
3215 /// ```ignore,no_run
3216 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3217 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3218 /// let x = ClusterConfig::new().set_gce_cluster_config(GceClusterConfig::default()/* use setters */);
3219 /// ```
3220 pub fn set_gce_cluster_config<T>(mut self, v: T) -> Self
3221 where
3222 T: std::convert::Into<crate::model::GceClusterConfig>,
3223 {
3224 self.gce_cluster_config = std::option::Option::Some(v.into());
3225 self
3226 }
3227
3228 /// Sets or clears the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3229 ///
3230 /// # Example
3231 /// ```ignore,no_run
3232 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3233 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3234 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(Some(GceClusterConfig::default()/* use setters */));
3235 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(None::<GceClusterConfig>);
3236 /// ```
3237 pub fn set_or_clear_gce_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3238 where
3239 T: std::convert::Into<crate::model::GceClusterConfig>,
3240 {
3241 self.gce_cluster_config = v.map(|x| x.into());
3242 self
3243 }
3244
3245 /// Sets the value of [master_config][crate::model::ClusterConfig::master_config].
3246 ///
3247 /// # Example
3248 /// ```ignore,no_run
3249 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3250 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3251 /// let x = ClusterConfig::new().set_master_config(InstanceGroupConfig::default()/* use setters */);
3252 /// ```
3253 pub fn set_master_config<T>(mut self, v: T) -> Self
3254 where
3255 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3256 {
3257 self.master_config = std::option::Option::Some(v.into());
3258 self
3259 }
3260
3261 /// Sets or clears the value of [master_config][crate::model::ClusterConfig::master_config].
3262 ///
3263 /// # Example
3264 /// ```ignore,no_run
3265 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3266 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3267 /// let x = ClusterConfig::new().set_or_clear_master_config(Some(InstanceGroupConfig::default()/* use setters */));
3268 /// let x = ClusterConfig::new().set_or_clear_master_config(None::<InstanceGroupConfig>);
3269 /// ```
3270 pub fn set_or_clear_master_config<T>(mut self, v: std::option::Option<T>) -> Self
3271 where
3272 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3273 {
3274 self.master_config = v.map(|x| x.into());
3275 self
3276 }
3277
3278 /// Sets the value of [worker_config][crate::model::ClusterConfig::worker_config].
3279 ///
3280 /// # Example
3281 /// ```ignore,no_run
3282 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3283 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3284 /// let x = ClusterConfig::new().set_worker_config(InstanceGroupConfig::default()/* use setters */);
3285 /// ```
3286 pub fn set_worker_config<T>(mut self, v: T) -> Self
3287 where
3288 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3289 {
3290 self.worker_config = std::option::Option::Some(v.into());
3291 self
3292 }
3293
3294 /// Sets or clears the value of [worker_config][crate::model::ClusterConfig::worker_config].
3295 ///
3296 /// # Example
3297 /// ```ignore,no_run
3298 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3299 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3300 /// let x = ClusterConfig::new().set_or_clear_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3301 /// let x = ClusterConfig::new().set_or_clear_worker_config(None::<InstanceGroupConfig>);
3302 /// ```
3303 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3304 where
3305 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3306 {
3307 self.worker_config = v.map(|x| x.into());
3308 self
3309 }
3310
3311 /// Sets the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3312 ///
3313 /// # Example
3314 /// ```ignore,no_run
3315 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3316 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3317 /// let x = ClusterConfig::new().set_secondary_worker_config(InstanceGroupConfig::default()/* use setters */);
3318 /// ```
3319 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
3320 where
3321 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3322 {
3323 self.secondary_worker_config = std::option::Option::Some(v.into());
3324 self
3325 }
3326
3327 /// Sets or clears the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3328 ///
3329 /// # Example
3330 /// ```ignore,no_run
3331 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3332 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3333 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3334 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(None::<InstanceGroupConfig>);
3335 /// ```
3336 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3337 where
3338 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3339 {
3340 self.secondary_worker_config = v.map(|x| x.into());
3341 self
3342 }
3343
3344 /// Sets the value of [software_config][crate::model::ClusterConfig::software_config].
3345 ///
3346 /// # Example
3347 /// ```ignore,no_run
3348 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3349 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3350 /// let x = ClusterConfig::new().set_software_config(SoftwareConfig::default()/* use setters */);
3351 /// ```
3352 pub fn set_software_config<T>(mut self, v: T) -> Self
3353 where
3354 T: std::convert::Into<crate::model::SoftwareConfig>,
3355 {
3356 self.software_config = std::option::Option::Some(v.into());
3357 self
3358 }
3359
3360 /// Sets or clears the value of [software_config][crate::model::ClusterConfig::software_config].
3361 ///
3362 /// # Example
3363 /// ```ignore,no_run
3364 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3365 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3366 /// let x = ClusterConfig::new().set_or_clear_software_config(Some(SoftwareConfig::default()/* use setters */));
3367 /// let x = ClusterConfig::new().set_or_clear_software_config(None::<SoftwareConfig>);
3368 /// ```
3369 pub fn set_or_clear_software_config<T>(mut self, v: std::option::Option<T>) -> Self
3370 where
3371 T: std::convert::Into<crate::model::SoftwareConfig>,
3372 {
3373 self.software_config = v.map(|x| x.into());
3374 self
3375 }
3376
3377 /// Sets the value of [initialization_actions][crate::model::ClusterConfig::initialization_actions].
3378 ///
3379 /// # Example
3380 /// ```ignore,no_run
3381 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3382 /// use google_cloud_dataproc_v1::model::NodeInitializationAction;
3383 /// let x = ClusterConfig::new()
3384 /// .set_initialization_actions([
3385 /// NodeInitializationAction::default()/* use setters */,
3386 /// NodeInitializationAction::default()/* use (different) setters */,
3387 /// ]);
3388 /// ```
3389 pub fn set_initialization_actions<T, V>(mut self, v: T) -> Self
3390 where
3391 T: std::iter::IntoIterator<Item = V>,
3392 V: std::convert::Into<crate::model::NodeInitializationAction>,
3393 {
3394 use std::iter::Iterator;
3395 self.initialization_actions = v.into_iter().map(|i| i.into()).collect();
3396 self
3397 }
3398
3399 /// Sets the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3400 ///
3401 /// # Example
3402 /// ```ignore,no_run
3403 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3404 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3405 /// let x = ClusterConfig::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
3406 /// ```
3407 pub fn set_encryption_config<T>(mut self, v: T) -> Self
3408 where
3409 T: std::convert::Into<crate::model::EncryptionConfig>,
3410 {
3411 self.encryption_config = std::option::Option::Some(v.into());
3412 self
3413 }
3414
3415 /// Sets or clears the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3416 ///
3417 /// # Example
3418 /// ```ignore,no_run
3419 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3420 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3421 /// let x = ClusterConfig::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
3422 /// let x = ClusterConfig::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
3423 /// ```
3424 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3425 where
3426 T: std::convert::Into<crate::model::EncryptionConfig>,
3427 {
3428 self.encryption_config = v.map(|x| x.into());
3429 self
3430 }
3431
3432 /// Sets the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3433 ///
3434 /// # Example
3435 /// ```ignore,no_run
3436 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3437 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3438 /// let x = ClusterConfig::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
3439 /// ```
3440 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
3441 where
3442 T: std::convert::Into<crate::model::AutoscalingConfig>,
3443 {
3444 self.autoscaling_config = std::option::Option::Some(v.into());
3445 self
3446 }
3447
3448 /// Sets or clears the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3449 ///
3450 /// # Example
3451 /// ```ignore,no_run
3452 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3453 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3454 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
3455 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
3456 /// ```
3457 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
3458 where
3459 T: std::convert::Into<crate::model::AutoscalingConfig>,
3460 {
3461 self.autoscaling_config = v.map(|x| x.into());
3462 self
3463 }
3464
3465 /// Sets the value of [security_config][crate::model::ClusterConfig::security_config].
3466 ///
3467 /// # Example
3468 /// ```ignore,no_run
3469 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3470 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3471 /// let x = ClusterConfig::new().set_security_config(SecurityConfig::default()/* use setters */);
3472 /// ```
3473 pub fn set_security_config<T>(mut self, v: T) -> Self
3474 where
3475 T: std::convert::Into<crate::model::SecurityConfig>,
3476 {
3477 self.security_config = std::option::Option::Some(v.into());
3478 self
3479 }
3480
3481 /// Sets or clears the value of [security_config][crate::model::ClusterConfig::security_config].
3482 ///
3483 /// # Example
3484 /// ```ignore,no_run
3485 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3486 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3487 /// let x = ClusterConfig::new().set_or_clear_security_config(Some(SecurityConfig::default()/* use setters */));
3488 /// let x = ClusterConfig::new().set_or_clear_security_config(None::<SecurityConfig>);
3489 /// ```
3490 pub fn set_or_clear_security_config<T>(mut self, v: std::option::Option<T>) -> Self
3491 where
3492 T: std::convert::Into<crate::model::SecurityConfig>,
3493 {
3494 self.security_config = v.map(|x| x.into());
3495 self
3496 }
3497
3498 /// Sets the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3499 ///
3500 /// # Example
3501 /// ```ignore,no_run
3502 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3503 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3504 /// let x = ClusterConfig::new().set_lifecycle_config(LifecycleConfig::default()/* use setters */);
3505 /// ```
3506 pub fn set_lifecycle_config<T>(mut self, v: T) -> Self
3507 where
3508 T: std::convert::Into<crate::model::LifecycleConfig>,
3509 {
3510 self.lifecycle_config = std::option::Option::Some(v.into());
3511 self
3512 }
3513
3514 /// Sets or clears the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3515 ///
3516 /// # Example
3517 /// ```ignore,no_run
3518 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3519 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3520 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(Some(LifecycleConfig::default()/* use setters */));
3521 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(None::<LifecycleConfig>);
3522 /// ```
3523 pub fn set_or_clear_lifecycle_config<T>(mut self, v: std::option::Option<T>) -> Self
3524 where
3525 T: std::convert::Into<crate::model::LifecycleConfig>,
3526 {
3527 self.lifecycle_config = v.map(|x| x.into());
3528 self
3529 }
3530
3531 /// Sets the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3532 ///
3533 /// # Example
3534 /// ```ignore,no_run
3535 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3536 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3537 /// let x = ClusterConfig::new().set_endpoint_config(EndpointConfig::default()/* use setters */);
3538 /// ```
3539 pub fn set_endpoint_config<T>(mut self, v: T) -> Self
3540 where
3541 T: std::convert::Into<crate::model::EndpointConfig>,
3542 {
3543 self.endpoint_config = std::option::Option::Some(v.into());
3544 self
3545 }
3546
3547 /// Sets or clears the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3548 ///
3549 /// # Example
3550 /// ```ignore,no_run
3551 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3552 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3553 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(Some(EndpointConfig::default()/* use setters */));
3554 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(None::<EndpointConfig>);
3555 /// ```
3556 pub fn set_or_clear_endpoint_config<T>(mut self, v: std::option::Option<T>) -> Self
3557 where
3558 T: std::convert::Into<crate::model::EndpointConfig>,
3559 {
3560 self.endpoint_config = v.map(|x| x.into());
3561 self
3562 }
3563
3564 /// Sets the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3565 ///
3566 /// # Example
3567 /// ```ignore,no_run
3568 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3569 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3570 /// let x = ClusterConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
3571 /// ```
3572 pub fn set_metastore_config<T>(mut self, v: T) -> Self
3573 where
3574 T: std::convert::Into<crate::model::MetastoreConfig>,
3575 {
3576 self.metastore_config = std::option::Option::Some(v.into());
3577 self
3578 }
3579
3580 /// Sets or clears the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3581 ///
3582 /// # Example
3583 /// ```ignore,no_run
3584 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3585 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3586 /// let x = ClusterConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
3587 /// let x = ClusterConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
3588 /// ```
3589 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
3590 where
3591 T: std::convert::Into<crate::model::MetastoreConfig>,
3592 {
3593 self.metastore_config = v.map(|x| x.into());
3594 self
3595 }
3596
3597 /// Sets the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3598 ///
3599 /// # Example
3600 /// ```ignore,no_run
3601 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3602 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3603 /// let x = ClusterConfig::new().set_dataproc_metric_config(DataprocMetricConfig::default()/* use setters */);
3604 /// ```
3605 pub fn set_dataproc_metric_config<T>(mut self, v: T) -> Self
3606 where
3607 T: std::convert::Into<crate::model::DataprocMetricConfig>,
3608 {
3609 self.dataproc_metric_config = std::option::Option::Some(v.into());
3610 self
3611 }
3612
3613 /// Sets or clears the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3614 ///
3615 /// # Example
3616 /// ```ignore,no_run
3617 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3618 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3619 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(Some(DataprocMetricConfig::default()/* use setters */));
3620 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(None::<DataprocMetricConfig>);
3621 /// ```
3622 pub fn set_or_clear_dataproc_metric_config<T>(mut self, v: std::option::Option<T>) -> Self
3623 where
3624 T: std::convert::Into<crate::model::DataprocMetricConfig>,
3625 {
3626 self.dataproc_metric_config = v.map(|x| x.into());
3627 self
3628 }
3629
3630 /// Sets the value of [auxiliary_node_groups][crate::model::ClusterConfig::auxiliary_node_groups].
3631 ///
3632 /// # Example
3633 /// ```ignore,no_run
3634 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3635 /// use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
3636 /// let x = ClusterConfig::new()
3637 /// .set_auxiliary_node_groups([
3638 /// AuxiliaryNodeGroup::default()/* use setters */,
3639 /// AuxiliaryNodeGroup::default()/* use (different) setters */,
3640 /// ]);
3641 /// ```
3642 pub fn set_auxiliary_node_groups<T, V>(mut self, v: T) -> Self
3643 where
3644 T: std::iter::IntoIterator<Item = V>,
3645 V: std::convert::Into<crate::model::AuxiliaryNodeGroup>,
3646 {
3647 use std::iter::Iterator;
3648 self.auxiliary_node_groups = v.into_iter().map(|i| i.into()).collect();
3649 self
3650 }
3651}
3652
3653impl wkt::message::Message for ClusterConfig {
3654 fn typename() -> &'static str {
3655 "type.googleapis.com/google.cloud.dataproc.v1.ClusterConfig"
3656 }
3657}
3658
3659/// Defines additional types related to [ClusterConfig].
3660pub mod cluster_config {
3661 #[allow(unused_imports)]
3662 use super::*;
3663
3664 /// The cluster tier.
3665 ///
3666 /// # Working with unknown values
3667 ///
3668 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3669 /// additional enum variants at any time. Adding new variants is not considered
3670 /// a breaking change. Applications should write their code in anticipation of:
3671 ///
3672 /// - New values appearing in future releases of the client library, **and**
3673 /// - New values received dynamically, without application changes.
3674 ///
3675 /// Please consult the [Working with enums] section in the user guide for some
3676 /// guidelines.
3677 ///
3678 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3679 #[derive(Clone, Debug, PartialEq)]
3680 #[non_exhaustive]
3681 pub enum ClusterTier {
3682 /// Not set. Works the same as CLUSTER_TIER_STANDARD.
3683 Unspecified,
3684 /// Standard Dataproc cluster.
3685 Standard,
3686 /// Premium Dataproc cluster.
3687 Premium,
3688 /// If set, the enum was initialized with an unknown value.
3689 ///
3690 /// Applications can examine the value using [ClusterTier::value] or
3691 /// [ClusterTier::name].
3692 UnknownValue(cluster_tier::UnknownValue),
3693 }
3694
3695 #[doc(hidden)]
3696 pub mod cluster_tier {
3697 #[allow(unused_imports)]
3698 use super::*;
3699 #[derive(Clone, Debug, PartialEq)]
3700 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3701 }
3702
3703 impl ClusterTier {
3704 /// Gets the enum value.
3705 ///
3706 /// Returns `None` if the enum contains an unknown value deserialized from
3707 /// the string representation of enums.
3708 pub fn value(&self) -> std::option::Option<i32> {
3709 match self {
3710 Self::Unspecified => std::option::Option::Some(0),
3711 Self::Standard => std::option::Option::Some(1),
3712 Self::Premium => std::option::Option::Some(2),
3713 Self::UnknownValue(u) => u.0.value(),
3714 }
3715 }
3716
3717 /// Gets the enum value as a string.
3718 ///
3719 /// Returns `None` if the enum contains an unknown value deserialized from
3720 /// the integer representation of enums.
3721 pub fn name(&self) -> std::option::Option<&str> {
3722 match self {
3723 Self::Unspecified => std::option::Option::Some("CLUSTER_TIER_UNSPECIFIED"),
3724 Self::Standard => std::option::Option::Some("CLUSTER_TIER_STANDARD"),
3725 Self::Premium => std::option::Option::Some("CLUSTER_TIER_PREMIUM"),
3726 Self::UnknownValue(u) => u.0.name(),
3727 }
3728 }
3729 }
3730
3731 impl std::default::Default for ClusterTier {
3732 fn default() -> Self {
3733 use std::convert::From;
3734 Self::from(0)
3735 }
3736 }
3737
3738 impl std::fmt::Display for ClusterTier {
3739 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3740 wkt::internal::display_enum(f, self.name(), self.value())
3741 }
3742 }
3743
3744 impl std::convert::From<i32> for ClusterTier {
3745 fn from(value: i32) -> Self {
3746 match value {
3747 0 => Self::Unspecified,
3748 1 => Self::Standard,
3749 2 => Self::Premium,
3750 _ => Self::UnknownValue(cluster_tier::UnknownValue(
3751 wkt::internal::UnknownEnumValue::Integer(value),
3752 )),
3753 }
3754 }
3755 }
3756
3757 impl std::convert::From<&str> for ClusterTier {
3758 fn from(value: &str) -> Self {
3759 use std::string::ToString;
3760 match value {
3761 "CLUSTER_TIER_UNSPECIFIED" => Self::Unspecified,
3762 "CLUSTER_TIER_STANDARD" => Self::Standard,
3763 "CLUSTER_TIER_PREMIUM" => Self::Premium,
3764 _ => Self::UnknownValue(cluster_tier::UnknownValue(
3765 wkt::internal::UnknownEnumValue::String(value.to_string()),
3766 )),
3767 }
3768 }
3769 }
3770
3771 impl serde::ser::Serialize for ClusterTier {
3772 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3773 where
3774 S: serde::Serializer,
3775 {
3776 match self {
3777 Self::Unspecified => serializer.serialize_i32(0),
3778 Self::Standard => serializer.serialize_i32(1),
3779 Self::Premium => serializer.serialize_i32(2),
3780 Self::UnknownValue(u) => u.0.serialize(serializer),
3781 }
3782 }
3783 }
3784
3785 impl<'de> serde::de::Deserialize<'de> for ClusterTier {
3786 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3787 where
3788 D: serde::Deserializer<'de>,
3789 {
3790 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterTier>::new(
3791 ".google.cloud.dataproc.v1.ClusterConfig.ClusterTier",
3792 ))
3793 }
3794 }
3795}
3796
3797/// The Dataproc cluster config for a cluster that does not directly control the
3798/// underlying compute resources, such as a [Dataproc-on-GKE
3799/// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
3800#[derive(Clone, Default, PartialEq)]
3801#[non_exhaustive]
3802pub struct VirtualClusterConfig {
3803 /// Optional. A Cloud Storage bucket used to stage job
3804 /// dependencies, config files, and job driver console output.
3805 /// If you do not specify a staging bucket, Cloud
3806 /// Dataproc will determine a Cloud Storage location (US,
3807 /// ASIA, or EU) for your cluster's staging bucket according to the
3808 /// Compute Engine zone where your cluster is deployed, and then create
3809 /// and manage this project-level, per-location bucket (see
3810 /// [Dataproc staging and temp
3811 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3812 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3813 /// a Cloud Storage bucket.**
3814 pub staging_bucket: std::string::String,
3815
3816 /// Optional. Configuration of auxiliary services used by this cluster.
3817 pub auxiliary_services_config: std::option::Option<crate::model::AuxiliaryServicesConfig>,
3818
3819 pub infrastructure_config:
3820 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
3821
3822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3823}
3824
3825impl VirtualClusterConfig {
3826 pub fn new() -> Self {
3827 std::default::Default::default()
3828 }
3829
3830 /// Sets the value of [staging_bucket][crate::model::VirtualClusterConfig::staging_bucket].
3831 ///
3832 /// # Example
3833 /// ```ignore,no_run
3834 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3835 /// let x = VirtualClusterConfig::new().set_staging_bucket("example");
3836 /// ```
3837 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3838 self.staging_bucket = v.into();
3839 self
3840 }
3841
3842 /// Sets the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
3843 ///
3844 /// # Example
3845 /// ```ignore,no_run
3846 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3847 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
3848 /// let x = VirtualClusterConfig::new().set_auxiliary_services_config(AuxiliaryServicesConfig::default()/* use setters */);
3849 /// ```
3850 pub fn set_auxiliary_services_config<T>(mut self, v: T) -> Self
3851 where
3852 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
3853 {
3854 self.auxiliary_services_config = std::option::Option::Some(v.into());
3855 self
3856 }
3857
3858 /// Sets or clears the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
3859 ///
3860 /// # Example
3861 /// ```ignore,no_run
3862 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3863 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
3864 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(Some(AuxiliaryServicesConfig::default()/* use setters */));
3865 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(None::<AuxiliaryServicesConfig>);
3866 /// ```
3867 pub fn set_or_clear_auxiliary_services_config<T>(mut self, v: std::option::Option<T>) -> Self
3868 where
3869 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
3870 {
3871 self.auxiliary_services_config = v.map(|x| x.into());
3872 self
3873 }
3874
3875 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config].
3876 ///
3877 /// Note that all the setters affecting `infrastructure_config` are mutually
3878 /// exclusive.
3879 ///
3880 /// # Example
3881 /// ```ignore,no_run
3882 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3883 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
3884 /// let x = VirtualClusterConfig::new().set_infrastructure_config(Some(
3885 /// google_cloud_dataproc_v1::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(KubernetesClusterConfig::default().into())));
3886 /// ```
3887 pub fn set_infrastructure_config<
3888 T: std::convert::Into<
3889 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
3890 >,
3891 >(
3892 mut self,
3893 v: T,
3894 ) -> Self {
3895 self.infrastructure_config = v.into();
3896 self
3897 }
3898
3899 /// The value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
3900 /// if it holds a `KubernetesClusterConfig`, `None` if the field is not set or
3901 /// holds a different branch.
3902 pub fn kubernetes_cluster_config(
3903 &self,
3904 ) -> std::option::Option<&std::boxed::Box<crate::model::KubernetesClusterConfig>> {
3905 #[allow(unreachable_patterns)]
3906 self.infrastructure_config.as_ref().and_then(|v| match v {
3907 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
3908 v,
3909 ) => std::option::Option::Some(v),
3910 _ => std::option::Option::None,
3911 })
3912 }
3913
3914 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
3915 /// to hold a `KubernetesClusterConfig`.
3916 ///
3917 /// Note that all the setters affecting `infrastructure_config` are
3918 /// mutually exclusive.
3919 ///
3920 /// # Example
3921 /// ```ignore,no_run
3922 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3923 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
3924 /// let x = VirtualClusterConfig::new().set_kubernetes_cluster_config(KubernetesClusterConfig::default()/* use setters */);
3925 /// assert!(x.kubernetes_cluster_config().is_some());
3926 /// ```
3927 pub fn set_kubernetes_cluster_config<
3928 T: std::convert::Into<std::boxed::Box<crate::model::KubernetesClusterConfig>>,
3929 >(
3930 mut self,
3931 v: T,
3932 ) -> Self {
3933 self.infrastructure_config = std::option::Option::Some(
3934 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
3935 v.into(),
3936 ),
3937 );
3938 self
3939 }
3940}
3941
3942impl wkt::message::Message for VirtualClusterConfig {
3943 fn typename() -> &'static str {
3944 "type.googleapis.com/google.cloud.dataproc.v1.VirtualClusterConfig"
3945 }
3946}
3947
3948/// Defines additional types related to [VirtualClusterConfig].
3949pub mod virtual_cluster_config {
3950 #[allow(unused_imports)]
3951 use super::*;
3952
3953 #[derive(Clone, Debug, PartialEq)]
3954 #[non_exhaustive]
3955 pub enum InfrastructureConfig {
3956 /// Required. The configuration for running the Dataproc cluster on
3957 /// Kubernetes.
3958 KubernetesClusterConfig(std::boxed::Box<crate::model::KubernetesClusterConfig>),
3959 }
3960}
3961
3962/// Auxiliary services configuration for a Cluster.
3963#[derive(Clone, Default, PartialEq)]
3964#[non_exhaustive]
3965pub struct AuxiliaryServicesConfig {
3966 /// Optional. The Hive Metastore configuration for this workload.
3967 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3968
3969 /// Optional. The Spark History Server configuration for the workload.
3970 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
3971
3972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3973}
3974
3975impl AuxiliaryServicesConfig {
3976 pub fn new() -> Self {
3977 std::default::Default::default()
3978 }
3979
3980 /// Sets the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
3981 ///
3982 /// # Example
3983 /// ```ignore,no_run
3984 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
3985 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3986 /// let x = AuxiliaryServicesConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
3987 /// ```
3988 pub fn set_metastore_config<T>(mut self, v: T) -> Self
3989 where
3990 T: std::convert::Into<crate::model::MetastoreConfig>,
3991 {
3992 self.metastore_config = std::option::Option::Some(v.into());
3993 self
3994 }
3995
3996 /// Sets or clears the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
3997 ///
3998 /// # Example
3999 /// ```ignore,no_run
4000 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4001 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4002 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4003 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4004 /// ```
4005 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4006 where
4007 T: std::convert::Into<crate::model::MetastoreConfig>,
4008 {
4009 self.metastore_config = v.map(|x| x.into());
4010 self
4011 }
4012
4013 /// Sets the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4014 ///
4015 /// # Example
4016 /// ```ignore,no_run
4017 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4018 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4019 /// let x = AuxiliaryServicesConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
4020 /// ```
4021 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
4022 where
4023 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4024 {
4025 self.spark_history_server_config = std::option::Option::Some(v.into());
4026 self
4027 }
4028
4029 /// Sets or clears the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4030 ///
4031 /// # Example
4032 /// ```ignore,no_run
4033 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4034 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4035 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
4036 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
4037 /// ```
4038 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
4039 where
4040 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4041 {
4042 self.spark_history_server_config = v.map(|x| x.into());
4043 self
4044 }
4045}
4046
4047impl wkt::message::Message for AuxiliaryServicesConfig {
4048 fn typename() -> &'static str {
4049 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryServicesConfig"
4050 }
4051}
4052
4053/// Endpoint config for this cluster
4054#[derive(Clone, Default, PartialEq)]
4055#[non_exhaustive]
4056pub struct EndpointConfig {
4057 /// Output only. The map of port descriptions to URLs. Will only be populated
4058 /// if enable_http_port_access is true.
4059 pub http_ports: std::collections::HashMap<std::string::String, std::string::String>,
4060
4061 /// Optional. If true, enable http access to specific ports on the cluster
4062 /// from external sources. Defaults to false.
4063 pub enable_http_port_access: bool,
4064
4065 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4066}
4067
4068impl EndpointConfig {
4069 pub fn new() -> Self {
4070 std::default::Default::default()
4071 }
4072
4073 /// Sets the value of [http_ports][crate::model::EndpointConfig::http_ports].
4074 ///
4075 /// # Example
4076 /// ```ignore,no_run
4077 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4078 /// let x = EndpointConfig::new().set_http_ports([
4079 /// ("key0", "abc"),
4080 /// ("key1", "xyz"),
4081 /// ]);
4082 /// ```
4083 pub fn set_http_ports<T, K, V>(mut self, v: T) -> Self
4084 where
4085 T: std::iter::IntoIterator<Item = (K, V)>,
4086 K: std::convert::Into<std::string::String>,
4087 V: std::convert::Into<std::string::String>,
4088 {
4089 use std::iter::Iterator;
4090 self.http_ports = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4091 self
4092 }
4093
4094 /// Sets the value of [enable_http_port_access][crate::model::EndpointConfig::enable_http_port_access].
4095 ///
4096 /// # Example
4097 /// ```ignore,no_run
4098 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4099 /// let x = EndpointConfig::new().set_enable_http_port_access(true);
4100 /// ```
4101 pub fn set_enable_http_port_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4102 self.enable_http_port_access = v.into();
4103 self
4104 }
4105}
4106
4107impl wkt::message::Message for EndpointConfig {
4108 fn typename() -> &'static str {
4109 "type.googleapis.com/google.cloud.dataproc.v1.EndpointConfig"
4110 }
4111}
4112
4113/// Autoscaling Policy config associated with the cluster.
4114#[derive(Clone, Default, PartialEq)]
4115#[non_exhaustive]
4116pub struct AutoscalingConfig {
4117 /// Optional. The autoscaling policy used by the cluster.
4118 ///
4119 /// Only resource names including projectid and location (region) are valid.
4120 /// Examples:
4121 ///
4122 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4123 /// * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4124 ///
4125 /// Note that the policy must be in the same project and Dataproc region.
4126 pub policy_uri: std::string::String,
4127
4128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4129}
4130
4131impl AutoscalingConfig {
4132 pub fn new() -> Self {
4133 std::default::Default::default()
4134 }
4135
4136 /// Sets the value of [policy_uri][crate::model::AutoscalingConfig::policy_uri].
4137 ///
4138 /// # Example
4139 /// ```ignore,no_run
4140 /// # use google_cloud_dataproc_v1::model::AutoscalingConfig;
4141 /// let x = AutoscalingConfig::new().set_policy_uri("example");
4142 /// ```
4143 pub fn set_policy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4144 self.policy_uri = v.into();
4145 self
4146 }
4147}
4148
4149impl wkt::message::Message for AutoscalingConfig {
4150 fn typename() -> &'static str {
4151 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingConfig"
4152 }
4153}
4154
4155/// Encryption settings for the cluster.
4156#[derive(Clone, Default, PartialEq)]
4157#[non_exhaustive]
4158pub struct EncryptionConfig {
4159 /// Optional. The Cloud KMS key resource name to use for persistent disk
4160 /// encryption for all instances in the cluster. See [Use CMEK with cluster
4161 /// data]
4162 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4163 /// for more information.
4164 pub gce_pd_kms_key_name: std::string::String,
4165
4166 /// Optional. The Cloud KMS key resource name to use for cluster persistent
4167 /// disk and job argument encryption. See [Use CMEK with cluster data]
4168 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4169 /// for more information.
4170 ///
4171 /// When this key resource name is provided, the following job arguments of
4172 /// the following job types submitted to the cluster are encrypted using CMEK:
4173 ///
4174 /// * [FlinkJob
4175 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
4176 /// * [HadoopJob
4177 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
4178 /// * [SparkJob
4179 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
4180 /// * [SparkRJob
4181 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
4182 /// * [PySparkJob
4183 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
4184 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
4185 /// scriptVariables and queryList.queries
4186 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
4187 /// scriptVariables and queryList.queries
4188 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
4189 /// scriptVariables and queryList.queries
4190 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
4191 /// scriptVariables and queryList.queries
4192 pub kms_key: std::string::String,
4193
4194 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4195}
4196
4197impl EncryptionConfig {
4198 pub fn new() -> Self {
4199 std::default::Default::default()
4200 }
4201
4202 /// Sets the value of [gce_pd_kms_key_name][crate::model::EncryptionConfig::gce_pd_kms_key_name].
4203 ///
4204 /// # Example
4205 /// ```ignore,no_run
4206 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4207 /// let x = EncryptionConfig::new().set_gce_pd_kms_key_name("example");
4208 /// ```
4209 pub fn set_gce_pd_kms_key_name<T: std::convert::Into<std::string::String>>(
4210 mut self,
4211 v: T,
4212 ) -> Self {
4213 self.gce_pd_kms_key_name = v.into();
4214 self
4215 }
4216
4217 /// Sets the value of [kms_key][crate::model::EncryptionConfig::kms_key].
4218 ///
4219 /// # Example
4220 /// ```ignore,no_run
4221 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4222 /// let x = EncryptionConfig::new().set_kms_key("example");
4223 /// ```
4224 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4225 self.kms_key = v.into();
4226 self
4227 }
4228}
4229
4230impl wkt::message::Message for EncryptionConfig {
4231 fn typename() -> &'static str {
4232 "type.googleapis.com/google.cloud.dataproc.v1.EncryptionConfig"
4233 }
4234}
4235
4236/// Common config settings for resources of Compute Engine cluster
4237/// instances, applicable to all instances in the cluster.
4238#[derive(Clone, Default, PartialEq)]
4239#[non_exhaustive]
4240pub struct GceClusterConfig {
4241 /// Optional. The Compute Engine zone where the Dataproc cluster will be
4242 /// located. If omitted, the service will pick a zone in the cluster's Compute
4243 /// Engine region. On a get request, zone will always be present.
4244 ///
4245 /// A full URL, partial URI, or short name are valid. Examples:
4246 ///
4247 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]`
4248 /// * `projects/[project_id]/zones/[zone]`
4249 /// * `[zone]`
4250 pub zone_uri: std::string::String,
4251
4252 /// Optional. The Compute Engine network to be used for machine
4253 /// communications. Cannot be specified with subnetwork_uri. If neither
4254 /// `network_uri` nor `subnetwork_uri` is specified, the "default" network of
4255 /// the project is used, if it exists. Cannot be a "Custom Subnet Network" (see
4256 /// [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for
4257 /// more information).
4258 ///
4259 /// A full URL, partial URI, or short name are valid. Examples:
4260 ///
4261 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/networks/default`
4262 /// * `projects/[project_id]/global/networks/default`
4263 /// * `default`
4264 pub network_uri: std::string::String,
4265
4266 /// Optional. The Compute Engine subnetwork to be used for machine
4267 /// communications. Cannot be specified with network_uri.
4268 ///
4269 /// A full URL, partial URI, or short name are valid. Examples:
4270 ///
4271 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/regions/[region]/subnetworks/sub0`
4272 /// * `projects/[project_id]/regions/[region]/subnetworks/sub0`
4273 /// * `sub0`
4274 pub subnetwork_uri: std::string::String,
4275
4276 /// Optional. This setting applies to subnetwork-enabled networks. It is set to
4277 /// `true` by default in clusters created with image versions 2.2.x.
4278 ///
4279 /// When set to `true`:
4280 ///
4281 /// * All cluster VMs have internal IP addresses.
4282 /// * [Google Private Access]
4283 /// (<https://cloud.google.com/vpc/docs/private-google-access>)
4284 /// must be enabled to access Dataproc and other Google Cloud APIs.
4285 /// * Off-cluster dependencies must be configured to be accessible
4286 /// without external IP addresses.
4287 ///
4288 /// When set to `false`:
4289 ///
4290 /// * Cluster VMs are not restricted to internal IP addresses.
4291 /// * Ephemeral external IP addresses are assigned to each cluster VM.
4292 pub internal_ip_only: std::option::Option<bool>,
4293
4294 /// Optional. The type of IPv6 access for a cluster.
4295 pub private_ipv6_google_access: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess,
4296
4297 /// Optional. The [Dataproc service
4298 /// account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc)
4299 /// (also see [VM Data Plane
4300 /// identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity))
4301 /// used by Dataproc cluster VM instances to access Google Cloud Platform
4302 /// services.
4303 ///
4304 /// If not specified, the
4305 /// [Compute Engine default service
4306 /// account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
4307 /// is used.
4308 pub service_account: std::string::String,
4309
4310 /// Optional. The URIs of service account scopes to be included in
4311 /// Compute Engine instances. The following base set of scopes is always
4312 /// included:
4313 ///
4314 /// * <https://www.googleapis.com/auth/cloud.useraccounts.readonly>
4315 /// * <https://www.googleapis.com/auth/devstorage.read_write>
4316 /// * <https://www.googleapis.com/auth/logging.write>
4317 ///
4318 /// If no scopes are specified, the following defaults are also provided:
4319 ///
4320 /// * <https://www.googleapis.com/auth/bigquery>
4321 /// * <https://www.googleapis.com/auth/bigtable.admin.table>
4322 /// * <https://www.googleapis.com/auth/bigtable.data>
4323 /// * <https://www.googleapis.com/auth/devstorage.full_control>
4324 pub service_account_scopes: std::vec::Vec<std::string::String>,
4325
4326 /// The Compute Engine network tags to add to all instances (see [Tagging
4327 /// instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)).
4328 pub tags: std::vec::Vec<std::string::String>,
4329
4330 /// Optional. The Compute Engine metadata entries to add to all instances (see
4331 /// [Project and instance
4332 /// metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
4333 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
4334
4335 /// Optional. Reservation Affinity for consuming Zonal reservation.
4336 pub reservation_affinity: std::option::Option<crate::model::ReservationAffinity>,
4337
4338 /// Optional. Node Group Affinity for sole-tenant clusters.
4339 pub node_group_affinity: std::option::Option<crate::model::NodeGroupAffinity>,
4340
4341 /// Optional. Shielded Instance Config for clusters using [Compute Engine
4342 /// Shielded
4343 /// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
4344 pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
4345
4346 /// Optional. Confidential Instance Config for clusters using [Confidential
4347 /// VMs](https://cloud.google.com/compute/confidential-vm/docs).
4348 pub confidential_instance_config: std::option::Option<crate::model::ConfidentialInstanceConfig>,
4349
4350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4351}
4352
4353impl GceClusterConfig {
4354 pub fn new() -> Self {
4355 std::default::Default::default()
4356 }
4357
4358 /// Sets the value of [zone_uri][crate::model::GceClusterConfig::zone_uri].
4359 ///
4360 /// # Example
4361 /// ```ignore,no_run
4362 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4363 /// let x = GceClusterConfig::new().set_zone_uri("example");
4364 /// ```
4365 pub fn set_zone_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4366 self.zone_uri = v.into();
4367 self
4368 }
4369
4370 /// Sets the value of [network_uri][crate::model::GceClusterConfig::network_uri].
4371 ///
4372 /// # Example
4373 /// ```ignore,no_run
4374 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4375 /// let x = GceClusterConfig::new().set_network_uri("example");
4376 /// ```
4377 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4378 self.network_uri = v.into();
4379 self
4380 }
4381
4382 /// Sets the value of [subnetwork_uri][crate::model::GceClusterConfig::subnetwork_uri].
4383 ///
4384 /// # Example
4385 /// ```ignore,no_run
4386 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4387 /// let x = GceClusterConfig::new().set_subnetwork_uri("example");
4388 /// ```
4389 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4390 self.subnetwork_uri = v.into();
4391 self
4392 }
4393
4394 /// Sets the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4395 ///
4396 /// # Example
4397 /// ```ignore,no_run
4398 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4399 /// let x = GceClusterConfig::new().set_internal_ip_only(true);
4400 /// ```
4401 pub fn set_internal_ip_only<T>(mut self, v: T) -> Self
4402 where
4403 T: std::convert::Into<bool>,
4404 {
4405 self.internal_ip_only = std::option::Option::Some(v.into());
4406 self
4407 }
4408
4409 /// Sets or clears the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4410 ///
4411 /// # Example
4412 /// ```ignore,no_run
4413 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4414 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(Some(false));
4415 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(None::<bool>);
4416 /// ```
4417 pub fn set_or_clear_internal_ip_only<T>(mut self, v: std::option::Option<T>) -> Self
4418 where
4419 T: std::convert::Into<bool>,
4420 {
4421 self.internal_ip_only = v.map(|x| x.into());
4422 self
4423 }
4424
4425 /// Sets the value of [private_ipv6_google_access][crate::model::GceClusterConfig::private_ipv6_google_access].
4426 ///
4427 /// # Example
4428 /// ```ignore,no_run
4429 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4430 /// use google_cloud_dataproc_v1::model::gce_cluster_config::PrivateIpv6GoogleAccess;
4431 /// let x0 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::InheritFromSubnetwork);
4432 /// let x1 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Outbound);
4433 /// let x2 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Bidirectional);
4434 /// ```
4435 pub fn set_private_ipv6_google_access<
4436 T: std::convert::Into<crate::model::gce_cluster_config::PrivateIpv6GoogleAccess>,
4437 >(
4438 mut self,
4439 v: T,
4440 ) -> Self {
4441 self.private_ipv6_google_access = v.into();
4442 self
4443 }
4444
4445 /// Sets the value of [service_account][crate::model::GceClusterConfig::service_account].
4446 ///
4447 /// # Example
4448 /// ```ignore,no_run
4449 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4450 /// let x = GceClusterConfig::new().set_service_account("example");
4451 /// ```
4452 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4453 self.service_account = v.into();
4454 self
4455 }
4456
4457 /// Sets the value of [service_account_scopes][crate::model::GceClusterConfig::service_account_scopes].
4458 ///
4459 /// # Example
4460 /// ```ignore,no_run
4461 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4462 /// let x = GceClusterConfig::new().set_service_account_scopes(["a", "b", "c"]);
4463 /// ```
4464 pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
4465 where
4466 T: std::iter::IntoIterator<Item = V>,
4467 V: std::convert::Into<std::string::String>,
4468 {
4469 use std::iter::Iterator;
4470 self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
4471 self
4472 }
4473
4474 /// Sets the value of [tags][crate::model::GceClusterConfig::tags].
4475 ///
4476 /// # Example
4477 /// ```ignore,no_run
4478 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4479 /// let x = GceClusterConfig::new().set_tags(["a", "b", "c"]);
4480 /// ```
4481 pub fn set_tags<T, V>(mut self, v: T) -> Self
4482 where
4483 T: std::iter::IntoIterator<Item = V>,
4484 V: std::convert::Into<std::string::String>,
4485 {
4486 use std::iter::Iterator;
4487 self.tags = v.into_iter().map(|i| i.into()).collect();
4488 self
4489 }
4490
4491 /// Sets the value of [metadata][crate::model::GceClusterConfig::metadata].
4492 ///
4493 /// # Example
4494 /// ```ignore,no_run
4495 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4496 /// let x = GceClusterConfig::new().set_metadata([
4497 /// ("key0", "abc"),
4498 /// ("key1", "xyz"),
4499 /// ]);
4500 /// ```
4501 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
4502 where
4503 T: std::iter::IntoIterator<Item = (K, V)>,
4504 K: std::convert::Into<std::string::String>,
4505 V: std::convert::Into<std::string::String>,
4506 {
4507 use std::iter::Iterator;
4508 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4509 self
4510 }
4511
4512 /// Sets the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
4513 ///
4514 /// # Example
4515 /// ```ignore,no_run
4516 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4517 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
4518 /// let x = GceClusterConfig::new().set_reservation_affinity(ReservationAffinity::default()/* use setters */);
4519 /// ```
4520 pub fn set_reservation_affinity<T>(mut self, v: T) -> Self
4521 where
4522 T: std::convert::Into<crate::model::ReservationAffinity>,
4523 {
4524 self.reservation_affinity = std::option::Option::Some(v.into());
4525 self
4526 }
4527
4528 /// Sets or clears the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
4529 ///
4530 /// # Example
4531 /// ```ignore,no_run
4532 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4533 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
4534 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(Some(ReservationAffinity::default()/* use setters */));
4535 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(None::<ReservationAffinity>);
4536 /// ```
4537 pub fn set_or_clear_reservation_affinity<T>(mut self, v: std::option::Option<T>) -> Self
4538 where
4539 T: std::convert::Into<crate::model::ReservationAffinity>,
4540 {
4541 self.reservation_affinity = v.map(|x| x.into());
4542 self
4543 }
4544
4545 /// Sets the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
4546 ///
4547 /// # Example
4548 /// ```ignore,no_run
4549 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4550 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4551 /// let x = GceClusterConfig::new().set_node_group_affinity(NodeGroupAffinity::default()/* use setters */);
4552 /// ```
4553 pub fn set_node_group_affinity<T>(mut self, v: T) -> Self
4554 where
4555 T: std::convert::Into<crate::model::NodeGroupAffinity>,
4556 {
4557 self.node_group_affinity = std::option::Option::Some(v.into());
4558 self
4559 }
4560
4561 /// Sets or clears the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
4562 ///
4563 /// # Example
4564 /// ```ignore,no_run
4565 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4566 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4567 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(Some(NodeGroupAffinity::default()/* use setters */));
4568 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(None::<NodeGroupAffinity>);
4569 /// ```
4570 pub fn set_or_clear_node_group_affinity<T>(mut self, v: std::option::Option<T>) -> Self
4571 where
4572 T: std::convert::Into<crate::model::NodeGroupAffinity>,
4573 {
4574 self.node_group_affinity = v.map(|x| x.into());
4575 self
4576 }
4577
4578 /// Sets the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
4579 ///
4580 /// # Example
4581 /// ```ignore,no_run
4582 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4583 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4584 /// let x = GceClusterConfig::new().set_shielded_instance_config(ShieldedInstanceConfig::default()/* use setters */);
4585 /// ```
4586 pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
4587 where
4588 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
4589 {
4590 self.shielded_instance_config = std::option::Option::Some(v.into());
4591 self
4592 }
4593
4594 /// Sets or clears the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
4595 ///
4596 /// # Example
4597 /// ```ignore,no_run
4598 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4599 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4600 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(Some(ShieldedInstanceConfig::default()/* use setters */));
4601 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(None::<ShieldedInstanceConfig>);
4602 /// ```
4603 pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4604 where
4605 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
4606 {
4607 self.shielded_instance_config = v.map(|x| x.into());
4608 self
4609 }
4610
4611 /// Sets the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
4612 ///
4613 /// # Example
4614 /// ```ignore,no_run
4615 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4616 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
4617 /// let x = GceClusterConfig::new().set_confidential_instance_config(ConfidentialInstanceConfig::default()/* use setters */);
4618 /// ```
4619 pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
4620 where
4621 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
4622 {
4623 self.confidential_instance_config = std::option::Option::Some(v.into());
4624 self
4625 }
4626
4627 /// Sets or clears the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
4628 ///
4629 /// # Example
4630 /// ```ignore,no_run
4631 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4632 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
4633 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(Some(ConfidentialInstanceConfig::default()/* use setters */));
4634 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(None::<ConfidentialInstanceConfig>);
4635 /// ```
4636 pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4637 where
4638 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
4639 {
4640 self.confidential_instance_config = v.map(|x| x.into());
4641 self
4642 }
4643}
4644
4645impl wkt::message::Message for GceClusterConfig {
4646 fn typename() -> &'static str {
4647 "type.googleapis.com/google.cloud.dataproc.v1.GceClusterConfig"
4648 }
4649}
4650
4651/// Defines additional types related to [GceClusterConfig].
4652pub mod gce_cluster_config {
4653 #[allow(unused_imports)]
4654 use super::*;
4655
4656 /// `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes
4657 /// can communicate with Google Services through gRPC over IPv6.
4658 /// These values are directly mapped to corresponding values in the
4659 /// [Compute Engine Instance
4660 /// fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
4661 ///
4662 /// # Working with unknown values
4663 ///
4664 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4665 /// additional enum variants at any time. Adding new variants is not considered
4666 /// a breaking change. Applications should write their code in anticipation of:
4667 ///
4668 /// - New values appearing in future releases of the client library, **and**
4669 /// - New values received dynamically, without application changes.
4670 ///
4671 /// Please consult the [Working with enums] section in the user guide for some
4672 /// guidelines.
4673 ///
4674 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4675 #[derive(Clone, Debug, PartialEq)]
4676 #[non_exhaustive]
4677 pub enum PrivateIpv6GoogleAccess {
4678 /// If unspecified, Compute Engine default behavior will apply, which
4679 /// is the same as
4680 /// [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK].
4681 ///
4682 /// [google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess::InheritFromSubnetwork
4683 Unspecified,
4684 /// Private access to and from Google Services configuration
4685 /// inherited from the subnetwork configuration. This is the
4686 /// default Compute Engine behavior.
4687 InheritFromSubnetwork,
4688 /// Enables outbound private IPv6 access to Google Services from the Dataproc
4689 /// cluster.
4690 Outbound,
4691 /// Enables bidirectional private IPv6 access between Google Services and the
4692 /// Dataproc cluster.
4693 Bidirectional,
4694 /// If set, the enum was initialized with an unknown value.
4695 ///
4696 /// Applications can examine the value using [PrivateIpv6GoogleAccess::value] or
4697 /// [PrivateIpv6GoogleAccess::name].
4698 UnknownValue(private_ipv_6_google_access::UnknownValue),
4699 }
4700
4701 #[doc(hidden)]
4702 pub mod private_ipv_6_google_access {
4703 #[allow(unused_imports)]
4704 use super::*;
4705 #[derive(Clone, Debug, PartialEq)]
4706 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4707 }
4708
4709 impl PrivateIpv6GoogleAccess {
4710 /// Gets the enum value.
4711 ///
4712 /// Returns `None` if the enum contains an unknown value deserialized from
4713 /// the string representation of enums.
4714 pub fn value(&self) -> std::option::Option<i32> {
4715 match self {
4716 Self::Unspecified => std::option::Option::Some(0),
4717 Self::InheritFromSubnetwork => std::option::Option::Some(1),
4718 Self::Outbound => std::option::Option::Some(2),
4719 Self::Bidirectional => std::option::Option::Some(3),
4720 Self::UnknownValue(u) => u.0.value(),
4721 }
4722 }
4723
4724 /// Gets the enum value as a string.
4725 ///
4726 /// Returns `None` if the enum contains an unknown value deserialized from
4727 /// the integer representation of enums.
4728 pub fn name(&self) -> std::option::Option<&str> {
4729 match self {
4730 Self::Unspecified => {
4731 std::option::Option::Some("PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED")
4732 }
4733 Self::InheritFromSubnetwork => std::option::Option::Some("INHERIT_FROM_SUBNETWORK"),
4734 Self::Outbound => std::option::Option::Some("OUTBOUND"),
4735 Self::Bidirectional => std::option::Option::Some("BIDIRECTIONAL"),
4736 Self::UnknownValue(u) => u.0.name(),
4737 }
4738 }
4739 }
4740
4741 impl std::default::Default for PrivateIpv6GoogleAccess {
4742 fn default() -> Self {
4743 use std::convert::From;
4744 Self::from(0)
4745 }
4746 }
4747
4748 impl std::fmt::Display for PrivateIpv6GoogleAccess {
4749 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4750 wkt::internal::display_enum(f, self.name(), self.value())
4751 }
4752 }
4753
4754 impl std::convert::From<i32> for PrivateIpv6GoogleAccess {
4755 fn from(value: i32) -> Self {
4756 match value {
4757 0 => Self::Unspecified,
4758 1 => Self::InheritFromSubnetwork,
4759 2 => Self::Outbound,
4760 3 => Self::Bidirectional,
4761 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
4762 wkt::internal::UnknownEnumValue::Integer(value),
4763 )),
4764 }
4765 }
4766 }
4767
4768 impl std::convert::From<&str> for PrivateIpv6GoogleAccess {
4769 fn from(value: &str) -> Self {
4770 use std::string::ToString;
4771 match value {
4772 "PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED" => Self::Unspecified,
4773 "INHERIT_FROM_SUBNETWORK" => Self::InheritFromSubnetwork,
4774 "OUTBOUND" => Self::Outbound,
4775 "BIDIRECTIONAL" => Self::Bidirectional,
4776 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
4777 wkt::internal::UnknownEnumValue::String(value.to_string()),
4778 )),
4779 }
4780 }
4781 }
4782
4783 impl serde::ser::Serialize for PrivateIpv6GoogleAccess {
4784 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4785 where
4786 S: serde::Serializer,
4787 {
4788 match self {
4789 Self::Unspecified => serializer.serialize_i32(0),
4790 Self::InheritFromSubnetwork => serializer.serialize_i32(1),
4791 Self::Outbound => serializer.serialize_i32(2),
4792 Self::Bidirectional => serializer.serialize_i32(3),
4793 Self::UnknownValue(u) => u.0.serialize(serializer),
4794 }
4795 }
4796 }
4797
4798 impl<'de> serde::de::Deserialize<'de> for PrivateIpv6GoogleAccess {
4799 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4800 where
4801 D: serde::Deserializer<'de>,
4802 {
4803 deserializer.deserialize_any(
4804 wkt::internal::EnumVisitor::<PrivateIpv6GoogleAccess>::new(
4805 ".google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess",
4806 ),
4807 )
4808 }
4809 }
4810}
4811
4812/// Node Group Affinity for clusters using sole-tenant node groups.
4813/// **The Dataproc `NodeGroupAffinity` resource is not related to the
4814/// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.**
4815///
4816/// [google.cloud.dataproc.v1.NodeGroup]: crate::model::NodeGroup
4817#[derive(Clone, Default, PartialEq)]
4818#[non_exhaustive]
4819pub struct NodeGroupAffinity {
4820 /// Required. The URI of a
4821 /// sole-tenant [node group
4822 /// resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups)
4823 /// that the cluster will be created on.
4824 ///
4825 /// A full URL, partial URI, or node group name are valid. Examples:
4826 ///
4827 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/nodeGroups/node-group-1`
4828 /// * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1`
4829 /// * `node-group-1`
4830 pub node_group_uri: std::string::String,
4831
4832 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4833}
4834
4835impl NodeGroupAffinity {
4836 pub fn new() -> Self {
4837 std::default::Default::default()
4838 }
4839
4840 /// Sets the value of [node_group_uri][crate::model::NodeGroupAffinity::node_group_uri].
4841 ///
4842 /// # Example
4843 /// ```ignore,no_run
4844 /// # use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4845 /// let x = NodeGroupAffinity::new().set_node_group_uri("example");
4846 /// ```
4847 pub fn set_node_group_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4848 self.node_group_uri = v.into();
4849 self
4850 }
4851}
4852
4853impl wkt::message::Message for NodeGroupAffinity {
4854 fn typename() -> &'static str {
4855 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupAffinity"
4856 }
4857}
4858
4859/// Shielded Instance Config for clusters using [Compute Engine Shielded
4860/// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
4861#[derive(Clone, Default, PartialEq)]
4862#[non_exhaustive]
4863pub struct ShieldedInstanceConfig {
4864 /// Optional. Defines whether instances have Secure Boot enabled.
4865 pub enable_secure_boot: std::option::Option<bool>,
4866
4867 /// Optional. Defines whether instances have the vTPM enabled.
4868 pub enable_vtpm: std::option::Option<bool>,
4869
4870 /// Optional. Defines whether instances have integrity monitoring enabled.
4871 pub enable_integrity_monitoring: std::option::Option<bool>,
4872
4873 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4874}
4875
4876impl ShieldedInstanceConfig {
4877 pub fn new() -> Self {
4878 std::default::Default::default()
4879 }
4880
4881 /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
4882 ///
4883 /// # Example
4884 /// ```ignore,no_run
4885 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4886 /// let x = ShieldedInstanceConfig::new().set_enable_secure_boot(true);
4887 /// ```
4888 pub fn set_enable_secure_boot<T>(mut self, v: T) -> Self
4889 where
4890 T: std::convert::Into<bool>,
4891 {
4892 self.enable_secure_boot = std::option::Option::Some(v.into());
4893 self
4894 }
4895
4896 /// Sets or clears the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
4897 ///
4898 /// # Example
4899 /// ```ignore,no_run
4900 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4901 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(Some(false));
4902 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(None::<bool>);
4903 /// ```
4904 pub fn set_or_clear_enable_secure_boot<T>(mut self, v: std::option::Option<T>) -> Self
4905 where
4906 T: std::convert::Into<bool>,
4907 {
4908 self.enable_secure_boot = v.map(|x| x.into());
4909 self
4910 }
4911
4912 /// Sets the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
4913 ///
4914 /// # Example
4915 /// ```ignore,no_run
4916 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4917 /// let x = ShieldedInstanceConfig::new().set_enable_vtpm(true);
4918 /// ```
4919 pub fn set_enable_vtpm<T>(mut self, v: T) -> Self
4920 where
4921 T: std::convert::Into<bool>,
4922 {
4923 self.enable_vtpm = std::option::Option::Some(v.into());
4924 self
4925 }
4926
4927 /// Sets or clears the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
4928 ///
4929 /// # Example
4930 /// ```ignore,no_run
4931 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4932 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(Some(false));
4933 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(None::<bool>);
4934 /// ```
4935 pub fn set_or_clear_enable_vtpm<T>(mut self, v: std::option::Option<T>) -> Self
4936 where
4937 T: std::convert::Into<bool>,
4938 {
4939 self.enable_vtpm = v.map(|x| x.into());
4940 self
4941 }
4942
4943 /// Sets the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
4944 ///
4945 /// # Example
4946 /// ```ignore,no_run
4947 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4948 /// let x = ShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
4949 /// ```
4950 pub fn set_enable_integrity_monitoring<T>(mut self, v: T) -> Self
4951 where
4952 T: std::convert::Into<bool>,
4953 {
4954 self.enable_integrity_monitoring = std::option::Option::Some(v.into());
4955 self
4956 }
4957
4958 /// Sets or clears the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
4959 ///
4960 /// # Example
4961 /// ```ignore,no_run
4962 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4963 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(Some(false));
4964 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(None::<bool>);
4965 /// ```
4966 pub fn set_or_clear_enable_integrity_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
4967 where
4968 T: std::convert::Into<bool>,
4969 {
4970 self.enable_integrity_monitoring = v.map(|x| x.into());
4971 self
4972 }
4973}
4974
4975impl wkt::message::Message for ShieldedInstanceConfig {
4976 fn typename() -> &'static str {
4977 "type.googleapis.com/google.cloud.dataproc.v1.ShieldedInstanceConfig"
4978 }
4979}
4980
4981/// Confidential Instance Config for clusters using [Confidential
4982/// VMs](https://cloud.google.com/compute/confidential-vm/docs)
4983#[derive(Clone, Default, PartialEq)]
4984#[non_exhaustive]
4985pub struct ConfidentialInstanceConfig {
4986 /// Optional. Defines whether the instance should have confidential compute
4987 /// enabled.
4988 pub enable_confidential_compute: bool,
4989
4990 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4991}
4992
4993impl ConfidentialInstanceConfig {
4994 pub fn new() -> Self {
4995 std::default::Default::default()
4996 }
4997
4998 /// Sets the value of [enable_confidential_compute][crate::model::ConfidentialInstanceConfig::enable_confidential_compute].
4999 ///
5000 /// # Example
5001 /// ```ignore,no_run
5002 /// # use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5003 /// let x = ConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
5004 /// ```
5005 pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5006 self.enable_confidential_compute = v.into();
5007 self
5008 }
5009}
5010
5011impl wkt::message::Message for ConfidentialInstanceConfig {
5012 fn typename() -> &'static str {
5013 "type.googleapis.com/google.cloud.dataproc.v1.ConfidentialInstanceConfig"
5014 }
5015}
5016
5017/// The config settings for Compute Engine resources in
5018/// an instance group, such as a master or worker group.
5019#[derive(Clone, Default, PartialEq)]
5020#[non_exhaustive]
5021pub struct InstanceGroupConfig {
5022 /// Optional. The number of VM instances in the instance group.
5023 /// For [HA
5024 /// cluster](/dataproc/docs/concepts/configuring-clusters/high-availability)
5025 /// [master_config](#FIELDS.master_config) groups, **must be set to 3**.
5026 /// For standard cluster [master_config](#FIELDS.master_config) groups,
5027 /// **must be set to 1**.
5028 pub num_instances: i32,
5029
5030 /// Output only. The list of instance names. Dataproc derives the names
5031 /// from `cluster_name`, `num_instances`, and the instance group.
5032 pub instance_names: std::vec::Vec<std::string::String>,
5033
5034 /// Output only. List of references to Compute Engine instances.
5035 pub instance_references: std::vec::Vec<crate::model::InstanceReference>,
5036
5037 /// Optional. The Compute Engine image resource used for cluster instances.
5038 ///
5039 /// The URI can represent an image or image family.
5040 ///
5041 /// Image examples:
5042 ///
5043 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/[image-id]`
5044 /// * `projects/[project_id]/global/images/[image-id]`
5045 /// * `image-id`
5046 ///
5047 /// Image family examples. Dataproc will use the most recent
5048 /// image from the family:
5049 ///
5050 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/family/[custom-image-family-name]`
5051 /// * `projects/[project_id]/global/images/family/[custom-image-family-name]`
5052 ///
5053 /// If the URI is unspecified, it will be inferred from
5054 /// `SoftwareConfig.image_version` or the system default.
5055 pub image_uri: std::string::String,
5056
5057 /// Optional. The Compute Engine machine type used for cluster instances.
5058 ///
5059 /// A full URL, partial URI, or short name are valid. Examples:
5060 ///
5061 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5062 /// * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5063 /// * `n1-standard-2`
5064 ///
5065 /// **Auto Zone Exception**: If you are using the Dataproc
5066 /// [Auto Zone
5067 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
5068 /// feature, you must use the short name of the machine type
5069 /// resource, for example, `n1-standard-2`.
5070 pub machine_type_uri: std::string::String,
5071
5072 /// Optional. Disk option config settings.
5073 pub disk_config: std::option::Option<crate::model::DiskConfig>,
5074
5075 /// Output only. Specifies that this instance group contains preemptible
5076 /// instances.
5077 pub is_preemptible: bool,
5078
5079 /// Optional. Specifies the preemptibility of the instance group.
5080 ///
5081 /// The default value for master and worker groups is
5082 /// `NON_PREEMPTIBLE`. This default cannot be changed.
5083 ///
5084 /// The default value for secondary instances is
5085 /// `PREEMPTIBLE`.
5086 pub preemptibility: crate::model::instance_group_config::Preemptibility,
5087
5088 /// Output only. The config for Compute Engine Instance Group
5089 /// Manager that manages this group.
5090 /// This is only used for preemptible instance groups.
5091 pub managed_group_config: std::option::Option<crate::model::ManagedGroupConfig>,
5092
5093 /// Optional. The Compute Engine accelerator configuration for these
5094 /// instances.
5095 pub accelerators: std::vec::Vec<crate::model::AcceleratorConfig>,
5096
5097 /// Optional. Specifies the minimum cpu platform for the Instance Group.
5098 /// See [Dataproc -> Minimum CPU
5099 /// Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu).
5100 pub min_cpu_platform: std::string::String,
5101
5102 /// Optional. The minimum number of primary worker instances to create.
5103 /// If `min_num_instances` is set, cluster creation will succeed if
5104 /// the number of primary workers created is at least equal to the
5105 /// `min_num_instances` number.
5106 ///
5107 /// Example: Cluster creation request with `num_instances` = `5` and
5108 /// `min_num_instances` = `3`:
5109 ///
5110 /// * If 4 VMs are created and 1 instance fails,
5111 /// the failed VM is deleted. The cluster is
5112 /// resized to 4 instances and placed in a `RUNNING` state.
5113 /// * If 2 instances are created and 3 instances fail,
5114 /// the cluster in placed in an `ERROR` state. The failed VMs
5115 /// are not deleted.
5116 pub min_num_instances: i32,
5117
5118 /// Optional. Instance flexibility Policy allowing a mixture of VM shapes and
5119 /// provisioning models.
5120 pub instance_flexibility_policy: std::option::Option<crate::model::InstanceFlexibilityPolicy>,
5121
5122 /// Optional. Configuration to handle the startup of instances during cluster
5123 /// create and update process.
5124 pub startup_config: std::option::Option<crate::model::StartupConfig>,
5125
5126 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5127}
5128
5129impl InstanceGroupConfig {
5130 pub fn new() -> Self {
5131 std::default::Default::default()
5132 }
5133
5134 /// Sets the value of [num_instances][crate::model::InstanceGroupConfig::num_instances].
5135 ///
5136 /// # Example
5137 /// ```ignore,no_run
5138 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5139 /// let x = InstanceGroupConfig::new().set_num_instances(42);
5140 /// ```
5141 pub fn set_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5142 self.num_instances = v.into();
5143 self
5144 }
5145
5146 /// Sets the value of [instance_names][crate::model::InstanceGroupConfig::instance_names].
5147 ///
5148 /// # Example
5149 /// ```ignore,no_run
5150 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5151 /// let x = InstanceGroupConfig::new().set_instance_names(["a", "b", "c"]);
5152 /// ```
5153 pub fn set_instance_names<T, V>(mut self, v: T) -> Self
5154 where
5155 T: std::iter::IntoIterator<Item = V>,
5156 V: std::convert::Into<std::string::String>,
5157 {
5158 use std::iter::Iterator;
5159 self.instance_names = v.into_iter().map(|i| i.into()).collect();
5160 self
5161 }
5162
5163 /// Sets the value of [instance_references][crate::model::InstanceGroupConfig::instance_references].
5164 ///
5165 /// # Example
5166 /// ```ignore,no_run
5167 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5168 /// use google_cloud_dataproc_v1::model::InstanceReference;
5169 /// let x = InstanceGroupConfig::new()
5170 /// .set_instance_references([
5171 /// InstanceReference::default()/* use setters */,
5172 /// InstanceReference::default()/* use (different) setters */,
5173 /// ]);
5174 /// ```
5175 pub fn set_instance_references<T, V>(mut self, v: T) -> Self
5176 where
5177 T: std::iter::IntoIterator<Item = V>,
5178 V: std::convert::Into<crate::model::InstanceReference>,
5179 {
5180 use std::iter::Iterator;
5181 self.instance_references = v.into_iter().map(|i| i.into()).collect();
5182 self
5183 }
5184
5185 /// Sets the value of [image_uri][crate::model::InstanceGroupConfig::image_uri].
5186 ///
5187 /// # Example
5188 /// ```ignore,no_run
5189 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5190 /// let x = InstanceGroupConfig::new().set_image_uri("example");
5191 /// ```
5192 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5193 self.image_uri = v.into();
5194 self
5195 }
5196
5197 /// Sets the value of [machine_type_uri][crate::model::InstanceGroupConfig::machine_type_uri].
5198 ///
5199 /// # Example
5200 /// ```ignore,no_run
5201 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5202 /// let x = InstanceGroupConfig::new().set_machine_type_uri("example");
5203 /// ```
5204 pub fn set_machine_type_uri<T: std::convert::Into<std::string::String>>(
5205 mut self,
5206 v: T,
5207 ) -> Self {
5208 self.machine_type_uri = v.into();
5209 self
5210 }
5211
5212 /// Sets the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5213 ///
5214 /// # Example
5215 /// ```ignore,no_run
5216 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5217 /// use google_cloud_dataproc_v1::model::DiskConfig;
5218 /// let x = InstanceGroupConfig::new().set_disk_config(DiskConfig::default()/* use setters */);
5219 /// ```
5220 pub fn set_disk_config<T>(mut self, v: T) -> Self
5221 where
5222 T: std::convert::Into<crate::model::DiskConfig>,
5223 {
5224 self.disk_config = std::option::Option::Some(v.into());
5225 self
5226 }
5227
5228 /// Sets or clears the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5229 ///
5230 /// # Example
5231 /// ```ignore,no_run
5232 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5233 /// use google_cloud_dataproc_v1::model::DiskConfig;
5234 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(Some(DiskConfig::default()/* use setters */));
5235 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(None::<DiskConfig>);
5236 /// ```
5237 pub fn set_or_clear_disk_config<T>(mut self, v: std::option::Option<T>) -> Self
5238 where
5239 T: std::convert::Into<crate::model::DiskConfig>,
5240 {
5241 self.disk_config = v.map(|x| x.into());
5242 self
5243 }
5244
5245 /// Sets the value of [is_preemptible][crate::model::InstanceGroupConfig::is_preemptible].
5246 ///
5247 /// # Example
5248 /// ```ignore,no_run
5249 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5250 /// let x = InstanceGroupConfig::new().set_is_preemptible(true);
5251 /// ```
5252 pub fn set_is_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5253 self.is_preemptible = v.into();
5254 self
5255 }
5256
5257 /// Sets the value of [preemptibility][crate::model::InstanceGroupConfig::preemptibility].
5258 ///
5259 /// # Example
5260 /// ```ignore,no_run
5261 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5262 /// use google_cloud_dataproc_v1::model::instance_group_config::Preemptibility;
5263 /// let x0 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::NonPreemptible);
5264 /// let x1 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Preemptible);
5265 /// let x2 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Spot);
5266 /// ```
5267 pub fn set_preemptibility<
5268 T: std::convert::Into<crate::model::instance_group_config::Preemptibility>,
5269 >(
5270 mut self,
5271 v: T,
5272 ) -> Self {
5273 self.preemptibility = v.into();
5274 self
5275 }
5276
5277 /// Sets the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5278 ///
5279 /// # Example
5280 /// ```ignore,no_run
5281 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5282 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5283 /// let x = InstanceGroupConfig::new().set_managed_group_config(ManagedGroupConfig::default()/* use setters */);
5284 /// ```
5285 pub fn set_managed_group_config<T>(mut self, v: T) -> Self
5286 where
5287 T: std::convert::Into<crate::model::ManagedGroupConfig>,
5288 {
5289 self.managed_group_config = std::option::Option::Some(v.into());
5290 self
5291 }
5292
5293 /// Sets or clears the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5294 ///
5295 /// # Example
5296 /// ```ignore,no_run
5297 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5298 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5299 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(Some(ManagedGroupConfig::default()/* use setters */));
5300 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(None::<ManagedGroupConfig>);
5301 /// ```
5302 pub fn set_or_clear_managed_group_config<T>(mut self, v: std::option::Option<T>) -> Self
5303 where
5304 T: std::convert::Into<crate::model::ManagedGroupConfig>,
5305 {
5306 self.managed_group_config = v.map(|x| x.into());
5307 self
5308 }
5309
5310 /// Sets the value of [accelerators][crate::model::InstanceGroupConfig::accelerators].
5311 ///
5312 /// # Example
5313 /// ```ignore,no_run
5314 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5315 /// use google_cloud_dataproc_v1::model::AcceleratorConfig;
5316 /// let x = InstanceGroupConfig::new()
5317 /// .set_accelerators([
5318 /// AcceleratorConfig::default()/* use setters */,
5319 /// AcceleratorConfig::default()/* use (different) setters */,
5320 /// ]);
5321 /// ```
5322 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
5323 where
5324 T: std::iter::IntoIterator<Item = V>,
5325 V: std::convert::Into<crate::model::AcceleratorConfig>,
5326 {
5327 use std::iter::Iterator;
5328 self.accelerators = v.into_iter().map(|i| i.into()).collect();
5329 self
5330 }
5331
5332 /// Sets the value of [min_cpu_platform][crate::model::InstanceGroupConfig::min_cpu_platform].
5333 ///
5334 /// # Example
5335 /// ```ignore,no_run
5336 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5337 /// let x = InstanceGroupConfig::new().set_min_cpu_platform("example");
5338 /// ```
5339 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
5340 mut self,
5341 v: T,
5342 ) -> Self {
5343 self.min_cpu_platform = v.into();
5344 self
5345 }
5346
5347 /// Sets the value of [min_num_instances][crate::model::InstanceGroupConfig::min_num_instances].
5348 ///
5349 /// # Example
5350 /// ```ignore,no_run
5351 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5352 /// let x = InstanceGroupConfig::new().set_min_num_instances(42);
5353 /// ```
5354 pub fn set_min_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5355 self.min_num_instances = v.into();
5356 self
5357 }
5358
5359 /// Sets the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5360 ///
5361 /// # Example
5362 /// ```ignore,no_run
5363 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5364 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5365 /// let x = InstanceGroupConfig::new().set_instance_flexibility_policy(InstanceFlexibilityPolicy::default()/* use setters */);
5366 /// ```
5367 pub fn set_instance_flexibility_policy<T>(mut self, v: T) -> Self
5368 where
5369 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5370 {
5371 self.instance_flexibility_policy = std::option::Option::Some(v.into());
5372 self
5373 }
5374
5375 /// Sets or clears the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5376 ///
5377 /// # Example
5378 /// ```ignore,no_run
5379 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5380 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5381 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(Some(InstanceFlexibilityPolicy::default()/* use setters */));
5382 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(None::<InstanceFlexibilityPolicy>);
5383 /// ```
5384 pub fn set_or_clear_instance_flexibility_policy<T>(mut self, v: std::option::Option<T>) -> Self
5385 where
5386 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5387 {
5388 self.instance_flexibility_policy = v.map(|x| x.into());
5389 self
5390 }
5391
5392 /// Sets the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5393 ///
5394 /// # Example
5395 /// ```ignore,no_run
5396 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5397 /// use google_cloud_dataproc_v1::model::StartupConfig;
5398 /// let x = InstanceGroupConfig::new().set_startup_config(StartupConfig::default()/* use setters */);
5399 /// ```
5400 pub fn set_startup_config<T>(mut self, v: T) -> Self
5401 where
5402 T: std::convert::Into<crate::model::StartupConfig>,
5403 {
5404 self.startup_config = std::option::Option::Some(v.into());
5405 self
5406 }
5407
5408 /// Sets or clears the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5409 ///
5410 /// # Example
5411 /// ```ignore,no_run
5412 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5413 /// use google_cloud_dataproc_v1::model::StartupConfig;
5414 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(Some(StartupConfig::default()/* use setters */));
5415 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(None::<StartupConfig>);
5416 /// ```
5417 pub fn set_or_clear_startup_config<T>(mut self, v: std::option::Option<T>) -> Self
5418 where
5419 T: std::convert::Into<crate::model::StartupConfig>,
5420 {
5421 self.startup_config = v.map(|x| x.into());
5422 self
5423 }
5424}
5425
5426impl wkt::message::Message for InstanceGroupConfig {
5427 fn typename() -> &'static str {
5428 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupConfig"
5429 }
5430}
5431
5432/// Defines additional types related to [InstanceGroupConfig].
5433pub mod instance_group_config {
5434 #[allow(unused_imports)]
5435 use super::*;
5436
5437 /// Controls the use of preemptible instances within the group.
5438 ///
5439 /// # Working with unknown values
5440 ///
5441 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5442 /// additional enum variants at any time. Adding new variants is not considered
5443 /// a breaking change. Applications should write their code in anticipation of:
5444 ///
5445 /// - New values appearing in future releases of the client library, **and**
5446 /// - New values received dynamically, without application changes.
5447 ///
5448 /// Please consult the [Working with enums] section in the user guide for some
5449 /// guidelines.
5450 ///
5451 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5452 #[derive(Clone, Debug, PartialEq)]
5453 #[non_exhaustive]
5454 pub enum Preemptibility {
5455 /// Preemptibility is unspecified, the system will choose the
5456 /// appropriate setting for each instance group.
5457 Unspecified,
5458 /// Instances are non-preemptible.
5459 ///
5460 /// This option is allowed for all instance groups and is the only valid
5461 /// value for Master and Worker instance groups.
5462 NonPreemptible,
5463 /// Instances are [preemptible]
5464 /// (<https://cloud.google.com/compute/docs/instances/preemptible>).
5465 ///
5466 /// This option is allowed only for [secondary worker]
5467 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5468 /// groups.
5469 Preemptible,
5470 /// Instances are [Spot VMs]
5471 /// (<https://cloud.google.com/compute/docs/instances/spot>).
5472 ///
5473 /// This option is allowed only for [secondary worker]
5474 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5475 /// groups. Spot VMs are the latest version of [preemptible VMs]
5476 /// (<https://cloud.google.com/compute/docs/instances/preemptible>), and
5477 /// provide additional features.
5478 Spot,
5479 /// If set, the enum was initialized with an unknown value.
5480 ///
5481 /// Applications can examine the value using [Preemptibility::value] or
5482 /// [Preemptibility::name].
5483 UnknownValue(preemptibility::UnknownValue),
5484 }
5485
5486 #[doc(hidden)]
5487 pub mod preemptibility {
5488 #[allow(unused_imports)]
5489 use super::*;
5490 #[derive(Clone, Debug, PartialEq)]
5491 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5492 }
5493
5494 impl Preemptibility {
5495 /// Gets the enum value.
5496 ///
5497 /// Returns `None` if the enum contains an unknown value deserialized from
5498 /// the string representation of enums.
5499 pub fn value(&self) -> std::option::Option<i32> {
5500 match self {
5501 Self::Unspecified => std::option::Option::Some(0),
5502 Self::NonPreemptible => std::option::Option::Some(1),
5503 Self::Preemptible => std::option::Option::Some(2),
5504 Self::Spot => std::option::Option::Some(3),
5505 Self::UnknownValue(u) => u.0.value(),
5506 }
5507 }
5508
5509 /// Gets the enum value as a string.
5510 ///
5511 /// Returns `None` if the enum contains an unknown value deserialized from
5512 /// the integer representation of enums.
5513 pub fn name(&self) -> std::option::Option<&str> {
5514 match self {
5515 Self::Unspecified => std::option::Option::Some("PREEMPTIBILITY_UNSPECIFIED"),
5516 Self::NonPreemptible => std::option::Option::Some("NON_PREEMPTIBLE"),
5517 Self::Preemptible => std::option::Option::Some("PREEMPTIBLE"),
5518 Self::Spot => std::option::Option::Some("SPOT"),
5519 Self::UnknownValue(u) => u.0.name(),
5520 }
5521 }
5522 }
5523
5524 impl std::default::Default for Preemptibility {
5525 fn default() -> Self {
5526 use std::convert::From;
5527 Self::from(0)
5528 }
5529 }
5530
5531 impl std::fmt::Display for Preemptibility {
5532 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5533 wkt::internal::display_enum(f, self.name(), self.value())
5534 }
5535 }
5536
5537 impl std::convert::From<i32> for Preemptibility {
5538 fn from(value: i32) -> Self {
5539 match value {
5540 0 => Self::Unspecified,
5541 1 => Self::NonPreemptible,
5542 2 => Self::Preemptible,
5543 3 => Self::Spot,
5544 _ => Self::UnknownValue(preemptibility::UnknownValue(
5545 wkt::internal::UnknownEnumValue::Integer(value),
5546 )),
5547 }
5548 }
5549 }
5550
5551 impl std::convert::From<&str> for Preemptibility {
5552 fn from(value: &str) -> Self {
5553 use std::string::ToString;
5554 match value {
5555 "PREEMPTIBILITY_UNSPECIFIED" => Self::Unspecified,
5556 "NON_PREEMPTIBLE" => Self::NonPreemptible,
5557 "PREEMPTIBLE" => Self::Preemptible,
5558 "SPOT" => Self::Spot,
5559 _ => Self::UnknownValue(preemptibility::UnknownValue(
5560 wkt::internal::UnknownEnumValue::String(value.to_string()),
5561 )),
5562 }
5563 }
5564 }
5565
5566 impl serde::ser::Serialize for Preemptibility {
5567 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5568 where
5569 S: serde::Serializer,
5570 {
5571 match self {
5572 Self::Unspecified => serializer.serialize_i32(0),
5573 Self::NonPreemptible => serializer.serialize_i32(1),
5574 Self::Preemptible => serializer.serialize_i32(2),
5575 Self::Spot => serializer.serialize_i32(3),
5576 Self::UnknownValue(u) => u.0.serialize(serializer),
5577 }
5578 }
5579 }
5580
5581 impl<'de> serde::de::Deserialize<'de> for Preemptibility {
5582 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5583 where
5584 D: serde::Deserializer<'de>,
5585 {
5586 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Preemptibility>::new(
5587 ".google.cloud.dataproc.v1.InstanceGroupConfig.Preemptibility",
5588 ))
5589 }
5590 }
5591}
5592
5593/// Configuration to handle the startup of instances during cluster create and
5594/// update process.
5595#[derive(Clone, Default, PartialEq)]
5596#[non_exhaustive]
5597pub struct StartupConfig {
5598 /// Optional. The config setting to enable cluster creation/ updation to be
5599 /// successful only after required_registration_fraction of instances are up
5600 /// and running. This configuration is applicable to only secondary workers for
5601 /// now. The cluster will fail if required_registration_fraction of instances
5602 /// are not available. This will include instance creation, agent registration,
5603 /// and service registration (if enabled).
5604 pub required_registration_fraction: std::option::Option<f64>,
5605
5606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5607}
5608
5609impl StartupConfig {
5610 pub fn new() -> Self {
5611 std::default::Default::default()
5612 }
5613
5614 /// Sets the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
5615 ///
5616 /// # Example
5617 /// ```ignore,no_run
5618 /// # use google_cloud_dataproc_v1::model::StartupConfig;
5619 /// let x = StartupConfig::new().set_required_registration_fraction(42.0);
5620 /// ```
5621 pub fn set_required_registration_fraction<T>(mut self, v: T) -> Self
5622 where
5623 T: std::convert::Into<f64>,
5624 {
5625 self.required_registration_fraction = std::option::Option::Some(v.into());
5626 self
5627 }
5628
5629 /// Sets or clears the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
5630 ///
5631 /// # Example
5632 /// ```ignore,no_run
5633 /// # use google_cloud_dataproc_v1::model::StartupConfig;
5634 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(Some(42.0));
5635 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(None::<f32>);
5636 /// ```
5637 pub fn set_or_clear_required_registration_fraction<T>(
5638 mut self,
5639 v: std::option::Option<T>,
5640 ) -> Self
5641 where
5642 T: std::convert::Into<f64>,
5643 {
5644 self.required_registration_fraction = v.map(|x| x.into());
5645 self
5646 }
5647}
5648
5649impl wkt::message::Message for StartupConfig {
5650 fn typename() -> &'static str {
5651 "type.googleapis.com/google.cloud.dataproc.v1.StartupConfig"
5652 }
5653}
5654
5655/// A reference to a Compute Engine instance.
5656#[derive(Clone, Default, PartialEq)]
5657#[non_exhaustive]
5658pub struct InstanceReference {
5659 /// The user-friendly name of the Compute Engine instance.
5660 pub instance_name: std::string::String,
5661
5662 /// The unique identifier of the Compute Engine instance.
5663 pub instance_id: std::string::String,
5664
5665 /// The public RSA key used for sharing data with this instance.
5666 pub public_key: std::string::String,
5667
5668 /// The public ECIES key used for sharing data with this instance.
5669 pub public_ecies_key: std::string::String,
5670
5671 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5672}
5673
5674impl InstanceReference {
5675 pub fn new() -> Self {
5676 std::default::Default::default()
5677 }
5678
5679 /// Sets the value of [instance_name][crate::model::InstanceReference::instance_name].
5680 ///
5681 /// # Example
5682 /// ```ignore,no_run
5683 /// # use google_cloud_dataproc_v1::model::InstanceReference;
5684 /// let x = InstanceReference::new().set_instance_name("example");
5685 /// ```
5686 pub fn set_instance_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5687 self.instance_name = v.into();
5688 self
5689 }
5690
5691 /// Sets the value of [instance_id][crate::model::InstanceReference::instance_id].
5692 ///
5693 /// # Example
5694 /// ```ignore,no_run
5695 /// # use google_cloud_dataproc_v1::model::InstanceReference;
5696 /// let x = InstanceReference::new().set_instance_id("example");
5697 /// ```
5698 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5699 self.instance_id = v.into();
5700 self
5701 }
5702
5703 /// Sets the value of [public_key][crate::model::InstanceReference::public_key].
5704 ///
5705 /// # Example
5706 /// ```ignore,no_run
5707 /// # use google_cloud_dataproc_v1::model::InstanceReference;
5708 /// let x = InstanceReference::new().set_public_key("example");
5709 /// ```
5710 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5711 self.public_key = v.into();
5712 self
5713 }
5714
5715 /// Sets the value of [public_ecies_key][crate::model::InstanceReference::public_ecies_key].
5716 ///
5717 /// # Example
5718 /// ```ignore,no_run
5719 /// # use google_cloud_dataproc_v1::model::InstanceReference;
5720 /// let x = InstanceReference::new().set_public_ecies_key("example");
5721 /// ```
5722 pub fn set_public_ecies_key<T: std::convert::Into<std::string::String>>(
5723 mut self,
5724 v: T,
5725 ) -> Self {
5726 self.public_ecies_key = v.into();
5727 self
5728 }
5729}
5730
5731impl wkt::message::Message for InstanceReference {
5732 fn typename() -> &'static str {
5733 "type.googleapis.com/google.cloud.dataproc.v1.InstanceReference"
5734 }
5735}
5736
5737/// Specifies the resources used to actively manage an instance group.
5738#[derive(Clone, Default, PartialEq)]
5739#[non_exhaustive]
5740pub struct ManagedGroupConfig {
5741 /// Output only. The name of the Instance Template used for the Managed
5742 /// Instance Group.
5743 pub instance_template_name: std::string::String,
5744
5745 /// Output only. The name of the Instance Group Manager for this group.
5746 pub instance_group_manager_name: std::string::String,
5747
5748 /// Output only. The partial URI to the instance group manager for this group.
5749 /// E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm.
5750 pub instance_group_manager_uri: std::string::String,
5751
5752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5753}
5754
5755impl ManagedGroupConfig {
5756 pub fn new() -> Self {
5757 std::default::Default::default()
5758 }
5759
5760 /// Sets the value of [instance_template_name][crate::model::ManagedGroupConfig::instance_template_name].
5761 ///
5762 /// # Example
5763 /// ```ignore,no_run
5764 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5765 /// let x = ManagedGroupConfig::new().set_instance_template_name("example");
5766 /// ```
5767 pub fn set_instance_template_name<T: std::convert::Into<std::string::String>>(
5768 mut self,
5769 v: T,
5770 ) -> Self {
5771 self.instance_template_name = v.into();
5772 self
5773 }
5774
5775 /// Sets the value of [instance_group_manager_name][crate::model::ManagedGroupConfig::instance_group_manager_name].
5776 ///
5777 /// # Example
5778 /// ```ignore,no_run
5779 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5780 /// let x = ManagedGroupConfig::new().set_instance_group_manager_name("example");
5781 /// ```
5782 pub fn set_instance_group_manager_name<T: std::convert::Into<std::string::String>>(
5783 mut self,
5784 v: T,
5785 ) -> Self {
5786 self.instance_group_manager_name = v.into();
5787 self
5788 }
5789
5790 /// Sets the value of [instance_group_manager_uri][crate::model::ManagedGroupConfig::instance_group_manager_uri].
5791 ///
5792 /// # Example
5793 /// ```ignore,no_run
5794 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5795 /// let x = ManagedGroupConfig::new().set_instance_group_manager_uri("example");
5796 /// ```
5797 pub fn set_instance_group_manager_uri<T: std::convert::Into<std::string::String>>(
5798 mut self,
5799 v: T,
5800 ) -> Self {
5801 self.instance_group_manager_uri = v.into();
5802 self
5803 }
5804}
5805
5806impl wkt::message::Message for ManagedGroupConfig {
5807 fn typename() -> &'static str {
5808 "type.googleapis.com/google.cloud.dataproc.v1.ManagedGroupConfig"
5809 }
5810}
5811
5812/// Instance flexibility Policy allowing a mixture of VM shapes and provisioning
5813/// models.
5814#[derive(Clone, Default, PartialEq)]
5815#[non_exhaustive]
5816pub struct InstanceFlexibilityPolicy {
5817 /// Optional. Defines how the Group selects the provisioning model to ensure
5818 /// required reliability.
5819 pub provisioning_model_mix:
5820 std::option::Option<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
5821
5822 /// Optional. List of instance selection options that the group will use when
5823 /// creating new VMs.
5824 pub instance_selection_list:
5825 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelection>,
5826
5827 /// Output only. A list of instance selection results in the group.
5828 pub instance_selection_results:
5829 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
5830
5831 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5832}
5833
5834impl InstanceFlexibilityPolicy {
5835 pub fn new() -> Self {
5836 std::default::Default::default()
5837 }
5838
5839 /// Sets the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
5840 ///
5841 /// # Example
5842 /// ```ignore,no_run
5843 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5844 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5845 /// let x = InstanceFlexibilityPolicy::new().set_provisioning_model_mix(ProvisioningModelMix::default()/* use setters */);
5846 /// ```
5847 pub fn set_provisioning_model_mix<T>(mut self, v: T) -> Self
5848 where
5849 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
5850 {
5851 self.provisioning_model_mix = std::option::Option::Some(v.into());
5852 self
5853 }
5854
5855 /// Sets or clears the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
5856 ///
5857 /// # Example
5858 /// ```ignore,no_run
5859 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5860 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5861 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(Some(ProvisioningModelMix::default()/* use setters */));
5862 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(None::<ProvisioningModelMix>);
5863 /// ```
5864 pub fn set_or_clear_provisioning_model_mix<T>(mut self, v: std::option::Option<T>) -> Self
5865 where
5866 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
5867 {
5868 self.provisioning_model_mix = v.map(|x| x.into());
5869 self
5870 }
5871
5872 /// Sets the value of [instance_selection_list][crate::model::InstanceFlexibilityPolicy::instance_selection_list].
5873 ///
5874 /// # Example
5875 /// ```ignore,no_run
5876 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5877 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
5878 /// let x = InstanceFlexibilityPolicy::new()
5879 /// .set_instance_selection_list([
5880 /// InstanceSelection::default()/* use setters */,
5881 /// InstanceSelection::default()/* use (different) setters */,
5882 /// ]);
5883 /// ```
5884 pub fn set_instance_selection_list<T, V>(mut self, v: T) -> Self
5885 where
5886 T: std::iter::IntoIterator<Item = V>,
5887 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelection>,
5888 {
5889 use std::iter::Iterator;
5890 self.instance_selection_list = v.into_iter().map(|i| i.into()).collect();
5891 self
5892 }
5893
5894 /// Sets the value of [instance_selection_results][crate::model::InstanceFlexibilityPolicy::instance_selection_results].
5895 ///
5896 /// # Example
5897 /// ```ignore,no_run
5898 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5899 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
5900 /// let x = InstanceFlexibilityPolicy::new()
5901 /// .set_instance_selection_results([
5902 /// InstanceSelectionResult::default()/* use setters */,
5903 /// InstanceSelectionResult::default()/* use (different) setters */,
5904 /// ]);
5905 /// ```
5906 pub fn set_instance_selection_results<T, V>(mut self, v: T) -> Self
5907 where
5908 T: std::iter::IntoIterator<Item = V>,
5909 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
5910 {
5911 use std::iter::Iterator;
5912 self.instance_selection_results = v.into_iter().map(|i| i.into()).collect();
5913 self
5914 }
5915}
5916
5917impl wkt::message::Message for InstanceFlexibilityPolicy {
5918 fn typename() -> &'static str {
5919 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy"
5920 }
5921}
5922
5923/// Defines additional types related to [InstanceFlexibilityPolicy].
5924pub mod instance_flexibility_policy {
5925 #[allow(unused_imports)]
5926 use super::*;
5927
5928 /// Defines how Dataproc should create VMs with a mixture of provisioning
5929 /// models.
5930 #[derive(Clone, Default, PartialEq)]
5931 #[non_exhaustive]
5932 pub struct ProvisioningModelMix {
5933 /// Optional. The base capacity that will always use Standard VMs to avoid
5934 /// risk of more preemption than the minimum capacity you need. Dataproc will
5935 /// create only standard VMs until it reaches standard_capacity_base, then it
5936 /// will start using standard_capacity_percent_above_base to mix Spot with
5937 /// Standard VMs. eg. If 15 instances are requested and
5938 /// standard_capacity_base is 5, Dataproc will create 5 standard VMs and then
5939 /// start mixing spot and standard VMs for remaining 10 instances.
5940 pub standard_capacity_base: std::option::Option<i32>,
5941
5942 /// Optional. The percentage of target capacity that should use Standard VM.
5943 /// The remaining percentage will use Spot VMs. The percentage applies only
5944 /// to the capacity above standard_capacity_base. eg. If 15 instances are
5945 /// requested and standard_capacity_base is 5 and
5946 /// standard_capacity_percent_above_base is 30, Dataproc will create 5
5947 /// standard VMs and then start mixing spot and standard VMs for remaining 10
5948 /// instances. The mix will be 30% standard and 70% spot.
5949 pub standard_capacity_percent_above_base: std::option::Option<i32>,
5950
5951 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5952 }
5953
5954 impl ProvisioningModelMix {
5955 pub fn new() -> Self {
5956 std::default::Default::default()
5957 }
5958
5959 /// Sets the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
5960 ///
5961 /// # Example
5962 /// ```ignore,no_run
5963 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5964 /// let x = ProvisioningModelMix::new().set_standard_capacity_base(42);
5965 /// ```
5966 pub fn set_standard_capacity_base<T>(mut self, v: T) -> Self
5967 where
5968 T: std::convert::Into<i32>,
5969 {
5970 self.standard_capacity_base = std::option::Option::Some(v.into());
5971 self
5972 }
5973
5974 /// Sets or clears the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
5975 ///
5976 /// # Example
5977 /// ```ignore,no_run
5978 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5979 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(Some(42));
5980 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(None::<i32>);
5981 /// ```
5982 pub fn set_or_clear_standard_capacity_base<T>(mut self, v: std::option::Option<T>) -> Self
5983 where
5984 T: std::convert::Into<i32>,
5985 {
5986 self.standard_capacity_base = v.map(|x| x.into());
5987 self
5988 }
5989
5990 /// Sets the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
5991 ///
5992 /// # Example
5993 /// ```ignore,no_run
5994 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5995 /// let x = ProvisioningModelMix::new().set_standard_capacity_percent_above_base(42);
5996 /// ```
5997 pub fn set_standard_capacity_percent_above_base<T>(mut self, v: T) -> Self
5998 where
5999 T: std::convert::Into<i32>,
6000 {
6001 self.standard_capacity_percent_above_base = std::option::Option::Some(v.into());
6002 self
6003 }
6004
6005 /// Sets or clears the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6006 ///
6007 /// # Example
6008 /// ```ignore,no_run
6009 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6010 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(Some(42));
6011 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(None::<i32>);
6012 /// ```
6013 pub fn set_or_clear_standard_capacity_percent_above_base<T>(
6014 mut self,
6015 v: std::option::Option<T>,
6016 ) -> Self
6017 where
6018 T: std::convert::Into<i32>,
6019 {
6020 self.standard_capacity_percent_above_base = v.map(|x| x.into());
6021 self
6022 }
6023 }
6024
6025 impl wkt::message::Message for ProvisioningModelMix {
6026 fn typename() -> &'static str {
6027 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.ProvisioningModelMix"
6028 }
6029 }
6030
6031 /// Defines machines types and a rank to which the machines types belong.
6032 #[derive(Clone, Default, PartialEq)]
6033 #[non_exhaustive]
6034 pub struct InstanceSelection {
6035 /// Optional. Full machine-type names, e.g. "n1-standard-16".
6036 pub machine_types: std::vec::Vec<std::string::String>,
6037
6038 /// Optional. Preference of this instance selection. Lower number means
6039 /// higher preference. Dataproc will first try to create a VM based on the
6040 /// machine-type with priority rank and fallback to next rank based on
6041 /// availability. Machine types and instance selections with the same
6042 /// priority have the same preference.
6043 pub rank: i32,
6044
6045 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6046 }
6047
6048 impl InstanceSelection {
6049 pub fn new() -> Self {
6050 std::default::Default::default()
6051 }
6052
6053 /// Sets the value of [machine_types][crate::model::instance_flexibility_policy::InstanceSelection::machine_types].
6054 ///
6055 /// # Example
6056 /// ```ignore,no_run
6057 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6058 /// let x = InstanceSelection::new().set_machine_types(["a", "b", "c"]);
6059 /// ```
6060 pub fn set_machine_types<T, V>(mut self, v: T) -> Self
6061 where
6062 T: std::iter::IntoIterator<Item = V>,
6063 V: std::convert::Into<std::string::String>,
6064 {
6065 use std::iter::Iterator;
6066 self.machine_types = v.into_iter().map(|i| i.into()).collect();
6067 self
6068 }
6069
6070 /// Sets the value of [rank][crate::model::instance_flexibility_policy::InstanceSelection::rank].
6071 ///
6072 /// # Example
6073 /// ```ignore,no_run
6074 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6075 /// let x = InstanceSelection::new().set_rank(42);
6076 /// ```
6077 pub fn set_rank<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6078 self.rank = v.into();
6079 self
6080 }
6081 }
6082
6083 impl wkt::message::Message for InstanceSelection {
6084 fn typename() -> &'static str {
6085 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelection"
6086 }
6087 }
6088
6089 /// Defines a mapping from machine types to the number of VMs that are created
6090 /// with each machine type.
6091 #[derive(Clone, Default, PartialEq)]
6092 #[non_exhaustive]
6093 pub struct InstanceSelectionResult {
6094 /// Output only. Full machine-type names, e.g. "n1-standard-16".
6095 pub machine_type: std::option::Option<std::string::String>,
6096
6097 /// Output only. Number of VM provisioned with the machine_type.
6098 pub vm_count: std::option::Option<i32>,
6099
6100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6101 }
6102
6103 impl InstanceSelectionResult {
6104 pub fn new() -> Self {
6105 std::default::Default::default()
6106 }
6107
6108 /// Sets the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6109 ///
6110 /// # Example
6111 /// ```ignore,no_run
6112 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6113 /// let x = InstanceSelectionResult::new().set_machine_type("example");
6114 /// ```
6115 pub fn set_machine_type<T>(mut self, v: T) -> Self
6116 where
6117 T: std::convert::Into<std::string::String>,
6118 {
6119 self.machine_type = std::option::Option::Some(v.into());
6120 self
6121 }
6122
6123 /// Sets or clears the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6124 ///
6125 /// # Example
6126 /// ```ignore,no_run
6127 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6128 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(Some("example"));
6129 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(None::<String>);
6130 /// ```
6131 pub fn set_or_clear_machine_type<T>(mut self, v: std::option::Option<T>) -> Self
6132 where
6133 T: std::convert::Into<std::string::String>,
6134 {
6135 self.machine_type = v.map(|x| x.into());
6136 self
6137 }
6138
6139 /// Sets the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6140 ///
6141 /// # Example
6142 /// ```ignore,no_run
6143 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6144 /// let x = InstanceSelectionResult::new().set_vm_count(42);
6145 /// ```
6146 pub fn set_vm_count<T>(mut self, v: T) -> Self
6147 where
6148 T: std::convert::Into<i32>,
6149 {
6150 self.vm_count = std::option::Option::Some(v.into());
6151 self
6152 }
6153
6154 /// Sets or clears the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6155 ///
6156 /// # Example
6157 /// ```ignore,no_run
6158 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6159 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(Some(42));
6160 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(None::<i32>);
6161 /// ```
6162 pub fn set_or_clear_vm_count<T>(mut self, v: std::option::Option<T>) -> Self
6163 where
6164 T: std::convert::Into<i32>,
6165 {
6166 self.vm_count = v.map(|x| x.into());
6167 self
6168 }
6169 }
6170
6171 impl wkt::message::Message for InstanceSelectionResult {
6172 fn typename() -> &'static str {
6173 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelectionResult"
6174 }
6175 }
6176}
6177
6178/// Specifies the type and number of accelerator cards attached to the instances
6179/// of an instance. See [GPUs on Compute
6180/// Engine](https://cloud.google.com/compute/docs/gpus/).
6181#[derive(Clone, Default, PartialEq)]
6182#[non_exhaustive]
6183pub struct AcceleratorConfig {
6184 /// Full URL, partial URI, or short name of the accelerator type resource to
6185 /// expose to this instance. See
6186 /// [Compute Engine
6187 /// AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes).
6188 ///
6189 /// Examples:
6190 ///
6191 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6192 /// * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6193 /// * `nvidia-tesla-t4`
6194 ///
6195 /// **Auto Zone Exception**: If you are using the Dataproc
6196 /// [Auto Zone
6197 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
6198 /// feature, you must use the short name of the accelerator type
6199 /// resource, for example, `nvidia-tesla-t4`.
6200 pub accelerator_type_uri: std::string::String,
6201
6202 /// The number of the accelerator cards of this type exposed to this instance.
6203 pub accelerator_count: i32,
6204
6205 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6206}
6207
6208impl AcceleratorConfig {
6209 pub fn new() -> Self {
6210 std::default::Default::default()
6211 }
6212
6213 /// Sets the value of [accelerator_type_uri][crate::model::AcceleratorConfig::accelerator_type_uri].
6214 ///
6215 /// # Example
6216 /// ```ignore,no_run
6217 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6218 /// let x = AcceleratorConfig::new().set_accelerator_type_uri("example");
6219 /// ```
6220 pub fn set_accelerator_type_uri<T: std::convert::Into<std::string::String>>(
6221 mut self,
6222 v: T,
6223 ) -> Self {
6224 self.accelerator_type_uri = v.into();
6225 self
6226 }
6227
6228 /// Sets the value of [accelerator_count][crate::model::AcceleratorConfig::accelerator_count].
6229 ///
6230 /// # Example
6231 /// ```ignore,no_run
6232 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6233 /// let x = AcceleratorConfig::new().set_accelerator_count(42);
6234 /// ```
6235 pub fn set_accelerator_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6236 self.accelerator_count = v.into();
6237 self
6238 }
6239}
6240
6241impl wkt::message::Message for AcceleratorConfig {
6242 fn typename() -> &'static str {
6243 "type.googleapis.com/google.cloud.dataproc.v1.AcceleratorConfig"
6244 }
6245}
6246
6247/// Specifies the config of disk options for a group of VM instances.
6248#[derive(Clone, Default, PartialEq)]
6249#[non_exhaustive]
6250pub struct DiskConfig {
6251 /// Optional. Type of the boot disk (default is "pd-standard").
6252 /// Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive),
6253 /// "pd-ssd" (Persistent Disk Solid State Drive),
6254 /// or "pd-standard" (Persistent Disk Hard Disk Drive).
6255 /// See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types).
6256 pub boot_disk_type: std::string::String,
6257
6258 /// Optional. Size in GB of the boot disk (default is 500GB).
6259 pub boot_disk_size_gb: i32,
6260
6261 /// Optional. Number of attached SSDs, from 0 to 8 (default is 0).
6262 /// If SSDs are not attached, the boot disk is used to store runtime logs and
6263 /// [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data.
6264 /// If one or more SSDs are attached, this runtime bulk
6265 /// data is spread across them, and the boot disk contains only basic
6266 /// config and installed binaries.
6267 ///
6268 /// Note: Local SSD options may vary by machine type and number of vCPUs
6269 /// selected.
6270 pub num_local_ssds: i32,
6271
6272 /// Optional. Interface type of local SSDs (default is "scsi").
6273 /// Valid values: "scsi" (Small Computer System Interface),
6274 /// "nvme" (Non-Volatile Memory Express).
6275 /// See [local SSD
6276 /// performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance).
6277 pub local_ssd_interface: std::string::String,
6278
6279 /// Optional. Indicates how many IOPS to provision for the disk. This sets the
6280 /// number of I/O operations per second that the disk can handle. Note: This
6281 /// field is only supported if boot_disk_type is hyperdisk-balanced.
6282 pub boot_disk_provisioned_iops: std::option::Option<i64>,
6283
6284 /// Optional. Indicates how much throughput to provision for the disk. This
6285 /// sets the number of throughput mb per second that the disk can handle.
6286 /// Values must be greater than or equal to 1. Note: This field is only
6287 /// supported if boot_disk_type is hyperdisk-balanced.
6288 pub boot_disk_provisioned_throughput: std::option::Option<i64>,
6289
6290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6291}
6292
6293impl DiskConfig {
6294 pub fn new() -> Self {
6295 std::default::Default::default()
6296 }
6297
6298 /// Sets the value of [boot_disk_type][crate::model::DiskConfig::boot_disk_type].
6299 ///
6300 /// # Example
6301 /// ```ignore,no_run
6302 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6303 /// let x = DiskConfig::new().set_boot_disk_type("example");
6304 /// ```
6305 pub fn set_boot_disk_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6306 self.boot_disk_type = v.into();
6307 self
6308 }
6309
6310 /// Sets the value of [boot_disk_size_gb][crate::model::DiskConfig::boot_disk_size_gb].
6311 ///
6312 /// # Example
6313 /// ```ignore,no_run
6314 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6315 /// let x = DiskConfig::new().set_boot_disk_size_gb(42);
6316 /// ```
6317 pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6318 self.boot_disk_size_gb = v.into();
6319 self
6320 }
6321
6322 /// Sets the value of [num_local_ssds][crate::model::DiskConfig::num_local_ssds].
6323 ///
6324 /// # Example
6325 /// ```ignore,no_run
6326 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6327 /// let x = DiskConfig::new().set_num_local_ssds(42);
6328 /// ```
6329 pub fn set_num_local_ssds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6330 self.num_local_ssds = v.into();
6331 self
6332 }
6333
6334 /// Sets the value of [local_ssd_interface][crate::model::DiskConfig::local_ssd_interface].
6335 ///
6336 /// # Example
6337 /// ```ignore,no_run
6338 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6339 /// let x = DiskConfig::new().set_local_ssd_interface("example");
6340 /// ```
6341 pub fn set_local_ssd_interface<T: std::convert::Into<std::string::String>>(
6342 mut self,
6343 v: T,
6344 ) -> Self {
6345 self.local_ssd_interface = v.into();
6346 self
6347 }
6348
6349 /// Sets the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6350 ///
6351 /// # Example
6352 /// ```ignore,no_run
6353 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6354 /// let x = DiskConfig::new().set_boot_disk_provisioned_iops(42);
6355 /// ```
6356 pub fn set_boot_disk_provisioned_iops<T>(mut self, v: T) -> Self
6357 where
6358 T: std::convert::Into<i64>,
6359 {
6360 self.boot_disk_provisioned_iops = std::option::Option::Some(v.into());
6361 self
6362 }
6363
6364 /// Sets or clears the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6365 ///
6366 /// # Example
6367 /// ```ignore,no_run
6368 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6369 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(Some(42));
6370 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(None::<i32>);
6371 /// ```
6372 pub fn set_or_clear_boot_disk_provisioned_iops<T>(mut self, v: std::option::Option<T>) -> Self
6373 where
6374 T: std::convert::Into<i64>,
6375 {
6376 self.boot_disk_provisioned_iops = v.map(|x| x.into());
6377 self
6378 }
6379
6380 /// Sets the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6381 ///
6382 /// # Example
6383 /// ```ignore,no_run
6384 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6385 /// let x = DiskConfig::new().set_boot_disk_provisioned_throughput(42);
6386 /// ```
6387 pub fn set_boot_disk_provisioned_throughput<T>(mut self, v: T) -> Self
6388 where
6389 T: std::convert::Into<i64>,
6390 {
6391 self.boot_disk_provisioned_throughput = std::option::Option::Some(v.into());
6392 self
6393 }
6394
6395 /// Sets or clears the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6396 ///
6397 /// # Example
6398 /// ```ignore,no_run
6399 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6400 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(Some(42));
6401 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(None::<i32>);
6402 /// ```
6403 pub fn set_or_clear_boot_disk_provisioned_throughput<T>(
6404 mut self,
6405 v: std::option::Option<T>,
6406 ) -> Self
6407 where
6408 T: std::convert::Into<i64>,
6409 {
6410 self.boot_disk_provisioned_throughput = v.map(|x| x.into());
6411 self
6412 }
6413}
6414
6415impl wkt::message::Message for DiskConfig {
6416 fn typename() -> &'static str {
6417 "type.googleapis.com/google.cloud.dataproc.v1.DiskConfig"
6418 }
6419}
6420
6421/// Node group identification and configuration information.
6422#[derive(Clone, Default, PartialEq)]
6423#[non_exhaustive]
6424pub struct AuxiliaryNodeGroup {
6425 /// Required. Node group configuration.
6426 pub node_group: std::option::Option<crate::model::NodeGroup>,
6427
6428 /// Optional. A node group ID. Generated if not specified.
6429 ///
6430 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
6431 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
6432 /// or hyphen. Must consist of from 3 to 33 characters.
6433 pub node_group_id: std::string::String,
6434
6435 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6436}
6437
6438impl AuxiliaryNodeGroup {
6439 pub fn new() -> Self {
6440 std::default::Default::default()
6441 }
6442
6443 /// Sets the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6444 ///
6445 /// # Example
6446 /// ```ignore,no_run
6447 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6448 /// use google_cloud_dataproc_v1::model::NodeGroup;
6449 /// let x = AuxiliaryNodeGroup::new().set_node_group(NodeGroup::default()/* use setters */);
6450 /// ```
6451 pub fn set_node_group<T>(mut self, v: T) -> Self
6452 where
6453 T: std::convert::Into<crate::model::NodeGroup>,
6454 {
6455 self.node_group = std::option::Option::Some(v.into());
6456 self
6457 }
6458
6459 /// Sets or clears the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6460 ///
6461 /// # Example
6462 /// ```ignore,no_run
6463 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6464 /// use google_cloud_dataproc_v1::model::NodeGroup;
6465 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
6466 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(None::<NodeGroup>);
6467 /// ```
6468 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
6469 where
6470 T: std::convert::Into<crate::model::NodeGroup>,
6471 {
6472 self.node_group = v.map(|x| x.into());
6473 self
6474 }
6475
6476 /// Sets the value of [node_group_id][crate::model::AuxiliaryNodeGroup::node_group_id].
6477 ///
6478 /// # Example
6479 /// ```ignore,no_run
6480 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6481 /// let x = AuxiliaryNodeGroup::new().set_node_group_id("example");
6482 /// ```
6483 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6484 self.node_group_id = v.into();
6485 self
6486 }
6487}
6488
6489impl wkt::message::Message for AuxiliaryNodeGroup {
6490 fn typename() -> &'static str {
6491 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryNodeGroup"
6492 }
6493}
6494
6495/// Dataproc Node Group.
6496/// **The Dataproc `NodeGroup` resource is not related to the
6497/// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity]
6498/// resource.**
6499///
6500/// [google.cloud.dataproc.v1.NodeGroupAffinity]: crate::model::NodeGroupAffinity
6501#[derive(Clone, Default, PartialEq)]
6502#[non_exhaustive]
6503pub struct NodeGroup {
6504 /// The Node group [resource name](https://aip.dev/122).
6505 pub name: std::string::String,
6506
6507 /// Required. Node group roles.
6508 pub roles: std::vec::Vec<crate::model::node_group::Role>,
6509
6510 /// Optional. The node group instance group configuration.
6511 pub node_group_config: std::option::Option<crate::model::InstanceGroupConfig>,
6512
6513 /// Optional. Node group labels.
6514 ///
6515 /// * Label **keys** must consist of from 1 to 63 characters and conform to
6516 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
6517 /// * Label **values** can be empty. If specified, they must consist of from
6518 /// 1 to 63 characters and conform to [RFC 1035]
6519 /// (<https://www.ietf.org/rfc/rfc1035.txt>).
6520 /// * The node group must have no more than 32 labels.
6521 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6522
6523 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6524}
6525
6526impl NodeGroup {
6527 pub fn new() -> Self {
6528 std::default::Default::default()
6529 }
6530
6531 /// Sets the value of [name][crate::model::NodeGroup::name].
6532 ///
6533 /// # Example
6534 /// ```ignore,no_run
6535 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6536 /// let x = NodeGroup::new().set_name("example");
6537 /// ```
6538 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6539 self.name = v.into();
6540 self
6541 }
6542
6543 /// Sets the value of [roles][crate::model::NodeGroup::roles].
6544 ///
6545 /// # Example
6546 /// ```ignore,no_run
6547 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6548 /// use google_cloud_dataproc_v1::model::node_group::Role;
6549 /// let x = NodeGroup::new().set_roles([
6550 /// Role::Driver,
6551 /// ]);
6552 /// ```
6553 pub fn set_roles<T, V>(mut self, v: T) -> Self
6554 where
6555 T: std::iter::IntoIterator<Item = V>,
6556 V: std::convert::Into<crate::model::node_group::Role>,
6557 {
6558 use std::iter::Iterator;
6559 self.roles = v.into_iter().map(|i| i.into()).collect();
6560 self
6561 }
6562
6563 /// Sets the value of [node_group_config][crate::model::NodeGroup::node_group_config].
6564 ///
6565 /// # Example
6566 /// ```ignore,no_run
6567 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6568 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6569 /// let x = NodeGroup::new().set_node_group_config(InstanceGroupConfig::default()/* use setters */);
6570 /// ```
6571 pub fn set_node_group_config<T>(mut self, v: T) -> Self
6572 where
6573 T: std::convert::Into<crate::model::InstanceGroupConfig>,
6574 {
6575 self.node_group_config = std::option::Option::Some(v.into());
6576 self
6577 }
6578
6579 /// Sets or clears the value of [node_group_config][crate::model::NodeGroup::node_group_config].
6580 ///
6581 /// # Example
6582 /// ```ignore,no_run
6583 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6584 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6585 /// let x = NodeGroup::new().set_or_clear_node_group_config(Some(InstanceGroupConfig::default()/* use setters */));
6586 /// let x = NodeGroup::new().set_or_clear_node_group_config(None::<InstanceGroupConfig>);
6587 /// ```
6588 pub fn set_or_clear_node_group_config<T>(mut self, v: std::option::Option<T>) -> Self
6589 where
6590 T: std::convert::Into<crate::model::InstanceGroupConfig>,
6591 {
6592 self.node_group_config = v.map(|x| x.into());
6593 self
6594 }
6595
6596 /// Sets the value of [labels][crate::model::NodeGroup::labels].
6597 ///
6598 /// # Example
6599 /// ```ignore,no_run
6600 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6601 /// let x = NodeGroup::new().set_labels([
6602 /// ("key0", "abc"),
6603 /// ("key1", "xyz"),
6604 /// ]);
6605 /// ```
6606 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6607 where
6608 T: std::iter::IntoIterator<Item = (K, V)>,
6609 K: std::convert::Into<std::string::String>,
6610 V: std::convert::Into<std::string::String>,
6611 {
6612 use std::iter::Iterator;
6613 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6614 self
6615 }
6616}
6617
6618impl wkt::message::Message for NodeGroup {
6619 fn typename() -> &'static str {
6620 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroup"
6621 }
6622}
6623
6624/// Defines additional types related to [NodeGroup].
6625pub mod node_group {
6626 #[allow(unused_imports)]
6627 use super::*;
6628
6629 /// Node pool roles.
6630 ///
6631 /// # Working with unknown values
6632 ///
6633 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6634 /// additional enum variants at any time. Adding new variants is not considered
6635 /// a breaking change. Applications should write their code in anticipation of:
6636 ///
6637 /// - New values appearing in future releases of the client library, **and**
6638 /// - New values received dynamically, without application changes.
6639 ///
6640 /// Please consult the [Working with enums] section in the user guide for some
6641 /// guidelines.
6642 ///
6643 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6644 #[derive(Clone, Debug, PartialEq)]
6645 #[non_exhaustive]
6646 pub enum Role {
6647 /// Required unspecified role.
6648 Unspecified,
6649 /// Job drivers run on the node pool.
6650 Driver,
6651 /// If set, the enum was initialized with an unknown value.
6652 ///
6653 /// Applications can examine the value using [Role::value] or
6654 /// [Role::name].
6655 UnknownValue(role::UnknownValue),
6656 }
6657
6658 #[doc(hidden)]
6659 pub mod role {
6660 #[allow(unused_imports)]
6661 use super::*;
6662 #[derive(Clone, Debug, PartialEq)]
6663 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6664 }
6665
6666 impl Role {
6667 /// Gets the enum value.
6668 ///
6669 /// Returns `None` if the enum contains an unknown value deserialized from
6670 /// the string representation of enums.
6671 pub fn value(&self) -> std::option::Option<i32> {
6672 match self {
6673 Self::Unspecified => std::option::Option::Some(0),
6674 Self::Driver => std::option::Option::Some(1),
6675 Self::UnknownValue(u) => u.0.value(),
6676 }
6677 }
6678
6679 /// Gets the enum value as a string.
6680 ///
6681 /// Returns `None` if the enum contains an unknown value deserialized from
6682 /// the integer representation of enums.
6683 pub fn name(&self) -> std::option::Option<&str> {
6684 match self {
6685 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
6686 Self::Driver => std::option::Option::Some("DRIVER"),
6687 Self::UnknownValue(u) => u.0.name(),
6688 }
6689 }
6690 }
6691
6692 impl std::default::Default for Role {
6693 fn default() -> Self {
6694 use std::convert::From;
6695 Self::from(0)
6696 }
6697 }
6698
6699 impl std::fmt::Display for Role {
6700 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6701 wkt::internal::display_enum(f, self.name(), self.value())
6702 }
6703 }
6704
6705 impl std::convert::From<i32> for Role {
6706 fn from(value: i32) -> Self {
6707 match value {
6708 0 => Self::Unspecified,
6709 1 => Self::Driver,
6710 _ => Self::UnknownValue(role::UnknownValue(
6711 wkt::internal::UnknownEnumValue::Integer(value),
6712 )),
6713 }
6714 }
6715 }
6716
6717 impl std::convert::From<&str> for Role {
6718 fn from(value: &str) -> Self {
6719 use std::string::ToString;
6720 match value {
6721 "ROLE_UNSPECIFIED" => Self::Unspecified,
6722 "DRIVER" => Self::Driver,
6723 _ => Self::UnknownValue(role::UnknownValue(
6724 wkt::internal::UnknownEnumValue::String(value.to_string()),
6725 )),
6726 }
6727 }
6728 }
6729
6730 impl serde::ser::Serialize for Role {
6731 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6732 where
6733 S: serde::Serializer,
6734 {
6735 match self {
6736 Self::Unspecified => serializer.serialize_i32(0),
6737 Self::Driver => serializer.serialize_i32(1),
6738 Self::UnknownValue(u) => u.0.serialize(serializer),
6739 }
6740 }
6741 }
6742
6743 impl<'de> serde::de::Deserialize<'de> for Role {
6744 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6745 where
6746 D: serde::Deserializer<'de>,
6747 {
6748 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
6749 ".google.cloud.dataproc.v1.NodeGroup.Role",
6750 ))
6751 }
6752 }
6753}
6754
6755/// Specifies an executable to run on a fully configured node and a
6756/// timeout period for executable completion.
6757#[derive(Clone, Default, PartialEq)]
6758#[non_exhaustive]
6759pub struct NodeInitializationAction {
6760 /// Required. Cloud Storage URI of executable file.
6761 pub executable_file: std::string::String,
6762
6763 /// Optional. Amount of time executable has to complete. Default is
6764 /// 10 minutes (see JSON representation of
6765 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
6766 ///
6767 /// Cluster creation fails with an explanatory error message (the
6768 /// name of the executable that caused the error and the exceeded timeout
6769 /// period) if the executable is not completed at end of the timeout period.
6770 pub execution_timeout: std::option::Option<wkt::Duration>,
6771
6772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6773}
6774
6775impl NodeInitializationAction {
6776 pub fn new() -> Self {
6777 std::default::Default::default()
6778 }
6779
6780 /// Sets the value of [executable_file][crate::model::NodeInitializationAction::executable_file].
6781 ///
6782 /// # Example
6783 /// ```ignore,no_run
6784 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
6785 /// let x = NodeInitializationAction::new().set_executable_file("example");
6786 /// ```
6787 pub fn set_executable_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6788 self.executable_file = v.into();
6789 self
6790 }
6791
6792 /// Sets the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
6793 ///
6794 /// # Example
6795 /// ```ignore,no_run
6796 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
6797 /// use wkt::Duration;
6798 /// let x = NodeInitializationAction::new().set_execution_timeout(Duration::default()/* use setters */);
6799 /// ```
6800 pub fn set_execution_timeout<T>(mut self, v: T) -> Self
6801 where
6802 T: std::convert::Into<wkt::Duration>,
6803 {
6804 self.execution_timeout = std::option::Option::Some(v.into());
6805 self
6806 }
6807
6808 /// Sets or clears the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
6809 ///
6810 /// # Example
6811 /// ```ignore,no_run
6812 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
6813 /// use wkt::Duration;
6814 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(Some(Duration::default()/* use setters */));
6815 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(None::<Duration>);
6816 /// ```
6817 pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6818 where
6819 T: std::convert::Into<wkt::Duration>,
6820 {
6821 self.execution_timeout = v.map(|x| x.into());
6822 self
6823 }
6824}
6825
6826impl wkt::message::Message for NodeInitializationAction {
6827 fn typename() -> &'static str {
6828 "type.googleapis.com/google.cloud.dataproc.v1.NodeInitializationAction"
6829 }
6830}
6831
6832/// The status of a cluster and its instances.
6833#[derive(Clone, Default, PartialEq)]
6834#[non_exhaustive]
6835pub struct ClusterStatus {
6836 /// Output only. The cluster's state.
6837 pub state: crate::model::cluster_status::State,
6838
6839 /// Optional. Output only. Details of cluster's state.
6840 pub detail: std::string::String,
6841
6842 /// Output only. Time when this state was entered (see JSON representation of
6843 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
6844 pub state_start_time: std::option::Option<wkt::Timestamp>,
6845
6846 /// Output only. Additional state information that includes
6847 /// status reported by the agent.
6848 pub substate: crate::model::cluster_status::Substate,
6849
6850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6851}
6852
6853impl ClusterStatus {
6854 pub fn new() -> Self {
6855 std::default::Default::default()
6856 }
6857
6858 /// Sets the value of [state][crate::model::ClusterStatus::state].
6859 ///
6860 /// # Example
6861 /// ```ignore,no_run
6862 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6863 /// use google_cloud_dataproc_v1::model::cluster_status::State;
6864 /// let x0 = ClusterStatus::new().set_state(State::Creating);
6865 /// let x1 = ClusterStatus::new().set_state(State::Running);
6866 /// let x2 = ClusterStatus::new().set_state(State::Error);
6867 /// ```
6868 pub fn set_state<T: std::convert::Into<crate::model::cluster_status::State>>(
6869 mut self,
6870 v: T,
6871 ) -> Self {
6872 self.state = v.into();
6873 self
6874 }
6875
6876 /// Sets the value of [detail][crate::model::ClusterStatus::detail].
6877 ///
6878 /// # Example
6879 /// ```ignore,no_run
6880 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6881 /// let x = ClusterStatus::new().set_detail("example");
6882 /// ```
6883 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6884 self.detail = v.into();
6885 self
6886 }
6887
6888 /// Sets the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
6889 ///
6890 /// # Example
6891 /// ```ignore,no_run
6892 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6893 /// use wkt::Timestamp;
6894 /// let x = ClusterStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
6895 /// ```
6896 pub fn set_state_start_time<T>(mut self, v: T) -> Self
6897 where
6898 T: std::convert::Into<wkt::Timestamp>,
6899 {
6900 self.state_start_time = std::option::Option::Some(v.into());
6901 self
6902 }
6903
6904 /// Sets or clears the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
6905 ///
6906 /// # Example
6907 /// ```ignore,no_run
6908 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6909 /// use wkt::Timestamp;
6910 /// let x = ClusterStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
6911 /// let x = ClusterStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
6912 /// ```
6913 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6914 where
6915 T: std::convert::Into<wkt::Timestamp>,
6916 {
6917 self.state_start_time = v.map(|x| x.into());
6918 self
6919 }
6920
6921 /// Sets the value of [substate][crate::model::ClusterStatus::substate].
6922 ///
6923 /// # Example
6924 /// ```ignore,no_run
6925 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6926 /// use google_cloud_dataproc_v1::model::cluster_status::Substate;
6927 /// let x0 = ClusterStatus::new().set_substate(Substate::Unhealthy);
6928 /// let x1 = ClusterStatus::new().set_substate(Substate::StaleStatus);
6929 /// ```
6930 pub fn set_substate<T: std::convert::Into<crate::model::cluster_status::Substate>>(
6931 mut self,
6932 v: T,
6933 ) -> Self {
6934 self.substate = v.into();
6935 self
6936 }
6937}
6938
6939impl wkt::message::Message for ClusterStatus {
6940 fn typename() -> &'static str {
6941 "type.googleapis.com/google.cloud.dataproc.v1.ClusterStatus"
6942 }
6943}
6944
6945/// Defines additional types related to [ClusterStatus].
6946pub mod cluster_status {
6947 #[allow(unused_imports)]
6948 use super::*;
6949
6950 /// The cluster state.
6951 ///
6952 /// # Working with unknown values
6953 ///
6954 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6955 /// additional enum variants at any time. Adding new variants is not considered
6956 /// a breaking change. Applications should write their code in anticipation of:
6957 ///
6958 /// - New values appearing in future releases of the client library, **and**
6959 /// - New values received dynamically, without application changes.
6960 ///
6961 /// Please consult the [Working with enums] section in the user guide for some
6962 /// guidelines.
6963 ///
6964 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6965 #[derive(Clone, Debug, PartialEq)]
6966 #[non_exhaustive]
6967 pub enum State {
6968 /// The cluster state is unknown.
6969 Unknown,
6970 /// The cluster is being created and set up. It is not ready for use.
6971 Creating,
6972 /// The cluster is currently running and healthy. It is ready for use.
6973 ///
6974 /// **Note:** The cluster state changes from "creating" to "running" status
6975 /// after the master node(s), first two primary worker nodes (and the last
6976 /// primary worker node if primary workers > 2) are running.
6977 Running,
6978 /// The cluster encountered an error. It is not ready for use.
6979 Error,
6980 /// The cluster has encountered an error while being updated. Jobs can
6981 /// be submitted to the cluster, but the cluster cannot be updated.
6982 ErrorDueToUpdate,
6983 /// The cluster is being deleted. It cannot be used.
6984 Deleting,
6985 /// The cluster is being updated. It continues to accept and process jobs.
6986 Updating,
6987 /// The cluster is being stopped. It cannot be used.
6988 Stopping,
6989 /// The cluster is currently stopped. It is not ready for use.
6990 Stopped,
6991 /// The cluster is being started. It is not ready for use.
6992 Starting,
6993 /// The cluster is being repaired. It is not ready for use.
6994 Repairing,
6995 /// If set, the enum was initialized with an unknown value.
6996 ///
6997 /// Applications can examine the value using [State::value] or
6998 /// [State::name].
6999 UnknownValue(state::UnknownValue),
7000 }
7001
7002 #[doc(hidden)]
7003 pub mod state {
7004 #[allow(unused_imports)]
7005 use super::*;
7006 #[derive(Clone, Debug, PartialEq)]
7007 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7008 }
7009
7010 impl State {
7011 /// Gets the enum value.
7012 ///
7013 /// Returns `None` if the enum contains an unknown value deserialized from
7014 /// the string representation of enums.
7015 pub fn value(&self) -> std::option::Option<i32> {
7016 match self {
7017 Self::Unknown => std::option::Option::Some(0),
7018 Self::Creating => std::option::Option::Some(1),
7019 Self::Running => std::option::Option::Some(2),
7020 Self::Error => std::option::Option::Some(3),
7021 Self::ErrorDueToUpdate => std::option::Option::Some(9),
7022 Self::Deleting => std::option::Option::Some(4),
7023 Self::Updating => std::option::Option::Some(5),
7024 Self::Stopping => std::option::Option::Some(6),
7025 Self::Stopped => std::option::Option::Some(7),
7026 Self::Starting => std::option::Option::Some(8),
7027 Self::Repairing => std::option::Option::Some(10),
7028 Self::UnknownValue(u) => u.0.value(),
7029 }
7030 }
7031
7032 /// Gets the enum value as a string.
7033 ///
7034 /// Returns `None` if the enum contains an unknown value deserialized from
7035 /// the integer representation of enums.
7036 pub fn name(&self) -> std::option::Option<&str> {
7037 match self {
7038 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7039 Self::Creating => std::option::Option::Some("CREATING"),
7040 Self::Running => std::option::Option::Some("RUNNING"),
7041 Self::Error => std::option::Option::Some("ERROR"),
7042 Self::ErrorDueToUpdate => std::option::Option::Some("ERROR_DUE_TO_UPDATE"),
7043 Self::Deleting => std::option::Option::Some("DELETING"),
7044 Self::Updating => std::option::Option::Some("UPDATING"),
7045 Self::Stopping => std::option::Option::Some("STOPPING"),
7046 Self::Stopped => std::option::Option::Some("STOPPED"),
7047 Self::Starting => std::option::Option::Some("STARTING"),
7048 Self::Repairing => std::option::Option::Some("REPAIRING"),
7049 Self::UnknownValue(u) => u.0.name(),
7050 }
7051 }
7052 }
7053
7054 impl std::default::Default for State {
7055 fn default() -> Self {
7056 use std::convert::From;
7057 Self::from(0)
7058 }
7059 }
7060
7061 impl std::fmt::Display for State {
7062 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7063 wkt::internal::display_enum(f, self.name(), self.value())
7064 }
7065 }
7066
7067 impl std::convert::From<i32> for State {
7068 fn from(value: i32) -> Self {
7069 match value {
7070 0 => Self::Unknown,
7071 1 => Self::Creating,
7072 2 => Self::Running,
7073 3 => Self::Error,
7074 4 => Self::Deleting,
7075 5 => Self::Updating,
7076 6 => Self::Stopping,
7077 7 => Self::Stopped,
7078 8 => Self::Starting,
7079 9 => Self::ErrorDueToUpdate,
7080 10 => Self::Repairing,
7081 _ => Self::UnknownValue(state::UnknownValue(
7082 wkt::internal::UnknownEnumValue::Integer(value),
7083 )),
7084 }
7085 }
7086 }
7087
7088 impl std::convert::From<&str> for State {
7089 fn from(value: &str) -> Self {
7090 use std::string::ToString;
7091 match value {
7092 "UNKNOWN" => Self::Unknown,
7093 "CREATING" => Self::Creating,
7094 "RUNNING" => Self::Running,
7095 "ERROR" => Self::Error,
7096 "ERROR_DUE_TO_UPDATE" => Self::ErrorDueToUpdate,
7097 "DELETING" => Self::Deleting,
7098 "UPDATING" => Self::Updating,
7099 "STOPPING" => Self::Stopping,
7100 "STOPPED" => Self::Stopped,
7101 "STARTING" => Self::Starting,
7102 "REPAIRING" => Self::Repairing,
7103 _ => Self::UnknownValue(state::UnknownValue(
7104 wkt::internal::UnknownEnumValue::String(value.to_string()),
7105 )),
7106 }
7107 }
7108 }
7109
7110 impl serde::ser::Serialize for State {
7111 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7112 where
7113 S: serde::Serializer,
7114 {
7115 match self {
7116 Self::Unknown => serializer.serialize_i32(0),
7117 Self::Creating => serializer.serialize_i32(1),
7118 Self::Running => serializer.serialize_i32(2),
7119 Self::Error => serializer.serialize_i32(3),
7120 Self::ErrorDueToUpdate => serializer.serialize_i32(9),
7121 Self::Deleting => serializer.serialize_i32(4),
7122 Self::Updating => serializer.serialize_i32(5),
7123 Self::Stopping => serializer.serialize_i32(6),
7124 Self::Stopped => serializer.serialize_i32(7),
7125 Self::Starting => serializer.serialize_i32(8),
7126 Self::Repairing => serializer.serialize_i32(10),
7127 Self::UnknownValue(u) => u.0.serialize(serializer),
7128 }
7129 }
7130 }
7131
7132 impl<'de> serde::de::Deserialize<'de> for State {
7133 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7134 where
7135 D: serde::Deserializer<'de>,
7136 {
7137 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7138 ".google.cloud.dataproc.v1.ClusterStatus.State",
7139 ))
7140 }
7141 }
7142
7143 /// The cluster substate.
7144 ///
7145 /// # Working with unknown values
7146 ///
7147 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7148 /// additional enum variants at any time. Adding new variants is not considered
7149 /// a breaking change. Applications should write their code in anticipation of:
7150 ///
7151 /// - New values appearing in future releases of the client library, **and**
7152 /// - New values received dynamically, without application changes.
7153 ///
7154 /// Please consult the [Working with enums] section in the user guide for some
7155 /// guidelines.
7156 ///
7157 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7158 #[derive(Clone, Debug, PartialEq)]
7159 #[non_exhaustive]
7160 pub enum Substate {
7161 /// The cluster substate is unknown.
7162 Unspecified,
7163 /// The cluster is known to be in an unhealthy state
7164 /// (for example, critical daemons are not running or HDFS capacity is
7165 /// exhausted).
7166 ///
7167 /// Applies to RUNNING state.
7168 Unhealthy,
7169 /// The agent-reported status is out of date (may occur if
7170 /// Dataproc loses communication with Agent).
7171 ///
7172 /// Applies to RUNNING state.
7173 StaleStatus,
7174 /// If set, the enum was initialized with an unknown value.
7175 ///
7176 /// Applications can examine the value using [Substate::value] or
7177 /// [Substate::name].
7178 UnknownValue(substate::UnknownValue),
7179 }
7180
7181 #[doc(hidden)]
7182 pub mod substate {
7183 #[allow(unused_imports)]
7184 use super::*;
7185 #[derive(Clone, Debug, PartialEq)]
7186 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7187 }
7188
7189 impl Substate {
7190 /// Gets the enum value.
7191 ///
7192 /// Returns `None` if the enum contains an unknown value deserialized from
7193 /// the string representation of enums.
7194 pub fn value(&self) -> std::option::Option<i32> {
7195 match self {
7196 Self::Unspecified => std::option::Option::Some(0),
7197 Self::Unhealthy => std::option::Option::Some(1),
7198 Self::StaleStatus => std::option::Option::Some(2),
7199 Self::UnknownValue(u) => u.0.value(),
7200 }
7201 }
7202
7203 /// Gets the enum value as a string.
7204 ///
7205 /// Returns `None` if the enum contains an unknown value deserialized from
7206 /// the integer representation of enums.
7207 pub fn name(&self) -> std::option::Option<&str> {
7208 match self {
7209 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
7210 Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
7211 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
7212 Self::UnknownValue(u) => u.0.name(),
7213 }
7214 }
7215 }
7216
7217 impl std::default::Default for Substate {
7218 fn default() -> Self {
7219 use std::convert::From;
7220 Self::from(0)
7221 }
7222 }
7223
7224 impl std::fmt::Display for Substate {
7225 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7226 wkt::internal::display_enum(f, self.name(), self.value())
7227 }
7228 }
7229
7230 impl std::convert::From<i32> for Substate {
7231 fn from(value: i32) -> Self {
7232 match value {
7233 0 => Self::Unspecified,
7234 1 => Self::Unhealthy,
7235 2 => Self::StaleStatus,
7236 _ => Self::UnknownValue(substate::UnknownValue(
7237 wkt::internal::UnknownEnumValue::Integer(value),
7238 )),
7239 }
7240 }
7241 }
7242
7243 impl std::convert::From<&str> for Substate {
7244 fn from(value: &str) -> Self {
7245 use std::string::ToString;
7246 match value {
7247 "UNSPECIFIED" => Self::Unspecified,
7248 "UNHEALTHY" => Self::Unhealthy,
7249 "STALE_STATUS" => Self::StaleStatus,
7250 _ => Self::UnknownValue(substate::UnknownValue(
7251 wkt::internal::UnknownEnumValue::String(value.to_string()),
7252 )),
7253 }
7254 }
7255 }
7256
7257 impl serde::ser::Serialize for Substate {
7258 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7259 where
7260 S: serde::Serializer,
7261 {
7262 match self {
7263 Self::Unspecified => serializer.serialize_i32(0),
7264 Self::Unhealthy => serializer.serialize_i32(1),
7265 Self::StaleStatus => serializer.serialize_i32(2),
7266 Self::UnknownValue(u) => u.0.serialize(serializer),
7267 }
7268 }
7269 }
7270
7271 impl<'de> serde::de::Deserialize<'de> for Substate {
7272 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7273 where
7274 D: serde::Deserializer<'de>,
7275 {
7276 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
7277 ".google.cloud.dataproc.v1.ClusterStatus.Substate",
7278 ))
7279 }
7280 }
7281}
7282
7283/// Security related configuration, including encryption, Kerberos, etc.
7284#[derive(Clone, Default, PartialEq)]
7285#[non_exhaustive]
7286pub struct SecurityConfig {
7287 /// Optional. Kerberos related configuration.
7288 pub kerberos_config: std::option::Option<crate::model::KerberosConfig>,
7289
7290 /// Optional. Identity related configuration, including service account based
7291 /// secure multi-tenancy user mappings.
7292 pub identity_config: std::option::Option<crate::model::IdentityConfig>,
7293
7294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7295}
7296
7297impl SecurityConfig {
7298 pub fn new() -> Self {
7299 std::default::Default::default()
7300 }
7301
7302 /// Sets the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7303 ///
7304 /// # Example
7305 /// ```ignore,no_run
7306 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7307 /// use google_cloud_dataproc_v1::model::KerberosConfig;
7308 /// let x = SecurityConfig::new().set_kerberos_config(KerberosConfig::default()/* use setters */);
7309 /// ```
7310 pub fn set_kerberos_config<T>(mut self, v: T) -> Self
7311 where
7312 T: std::convert::Into<crate::model::KerberosConfig>,
7313 {
7314 self.kerberos_config = std::option::Option::Some(v.into());
7315 self
7316 }
7317
7318 /// Sets or clears the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7319 ///
7320 /// # Example
7321 /// ```ignore,no_run
7322 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7323 /// use google_cloud_dataproc_v1::model::KerberosConfig;
7324 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(Some(KerberosConfig::default()/* use setters */));
7325 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(None::<KerberosConfig>);
7326 /// ```
7327 pub fn set_or_clear_kerberos_config<T>(mut self, v: std::option::Option<T>) -> Self
7328 where
7329 T: std::convert::Into<crate::model::KerberosConfig>,
7330 {
7331 self.kerberos_config = v.map(|x| x.into());
7332 self
7333 }
7334
7335 /// Sets the value of [identity_config][crate::model::SecurityConfig::identity_config].
7336 ///
7337 /// # Example
7338 /// ```ignore,no_run
7339 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7340 /// use google_cloud_dataproc_v1::model::IdentityConfig;
7341 /// let x = SecurityConfig::new().set_identity_config(IdentityConfig::default()/* use setters */);
7342 /// ```
7343 pub fn set_identity_config<T>(mut self, v: T) -> Self
7344 where
7345 T: std::convert::Into<crate::model::IdentityConfig>,
7346 {
7347 self.identity_config = std::option::Option::Some(v.into());
7348 self
7349 }
7350
7351 /// Sets or clears the value of [identity_config][crate::model::SecurityConfig::identity_config].
7352 ///
7353 /// # Example
7354 /// ```ignore,no_run
7355 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7356 /// use google_cloud_dataproc_v1::model::IdentityConfig;
7357 /// let x = SecurityConfig::new().set_or_clear_identity_config(Some(IdentityConfig::default()/* use setters */));
7358 /// let x = SecurityConfig::new().set_or_clear_identity_config(None::<IdentityConfig>);
7359 /// ```
7360 pub fn set_or_clear_identity_config<T>(mut self, v: std::option::Option<T>) -> Self
7361 where
7362 T: std::convert::Into<crate::model::IdentityConfig>,
7363 {
7364 self.identity_config = v.map(|x| x.into());
7365 self
7366 }
7367}
7368
7369impl wkt::message::Message for SecurityConfig {
7370 fn typename() -> &'static str {
7371 "type.googleapis.com/google.cloud.dataproc.v1.SecurityConfig"
7372 }
7373}
7374
7375/// Specifies Kerberos related configuration.
7376#[derive(Clone, Default, PartialEq)]
7377#[non_exhaustive]
7378pub struct KerberosConfig {
7379 /// Optional. Flag to indicate whether to Kerberize the cluster (default:
7380 /// false). Set this field to true to enable Kerberos on a cluster.
7381 pub enable_kerberos: bool,
7382
7383 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the root
7384 /// principal password.
7385 pub root_principal_password_uri: std::string::String,
7386
7387 /// Optional. The URI of the KMS key used to encrypt sensitive
7388 /// files.
7389 pub kms_key_uri: std::string::String,
7390
7391 /// Optional. The Cloud Storage URI of the keystore file used for SSL
7392 /// encryption. If not provided, Dataproc will provide a self-signed
7393 /// certificate.
7394 pub keystore_uri: std::string::String,
7395
7396 /// Optional. The Cloud Storage URI of the truststore file used for SSL
7397 /// encryption. If not provided, Dataproc will provide a self-signed
7398 /// certificate.
7399 pub truststore_uri: std::string::String,
7400
7401 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7402 /// password to the user provided keystore. For the self-signed certificate,
7403 /// this password is generated by Dataproc.
7404 pub keystore_password_uri: std::string::String,
7405
7406 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7407 /// password to the user provided key. For the self-signed certificate, this
7408 /// password is generated by Dataproc.
7409 pub key_password_uri: std::string::String,
7410
7411 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7412 /// password to the user provided truststore. For the self-signed certificate,
7413 /// this password is generated by Dataproc.
7414 pub truststore_password_uri: std::string::String,
7415
7416 /// Optional. The remote realm the Dataproc on-cluster KDC will trust, should
7417 /// the user enable cross realm trust.
7418 pub cross_realm_trust_realm: std::string::String,
7419
7420 /// Optional. The KDC (IP or hostname) for the remote trusted realm in a cross
7421 /// realm trust relationship.
7422 pub cross_realm_trust_kdc: std::string::String,
7423
7424 /// Optional. The admin server (IP or hostname) for the remote trusted realm in
7425 /// a cross realm trust relationship.
7426 pub cross_realm_trust_admin_server: std::string::String,
7427
7428 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7429 /// shared password between the on-cluster Kerberos realm and the remote
7430 /// trusted realm, in a cross realm trust relationship.
7431 pub cross_realm_trust_shared_password_uri: std::string::String,
7432
7433 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7434 /// master key of the KDC database.
7435 pub kdc_db_key_uri: std::string::String,
7436
7437 /// Optional. The lifetime of the ticket granting ticket, in hours.
7438 /// If not specified, or user specifies 0, then default value 10
7439 /// will be used.
7440 pub tgt_lifetime_hours: i32,
7441
7442 /// Optional. The name of the on-cluster Kerberos realm.
7443 /// If not specified, the uppercased domain of hostnames will be the realm.
7444 pub realm: std::string::String,
7445
7446 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7447}
7448
7449impl KerberosConfig {
7450 pub fn new() -> Self {
7451 std::default::Default::default()
7452 }
7453
7454 /// Sets the value of [enable_kerberos][crate::model::KerberosConfig::enable_kerberos].
7455 ///
7456 /// # Example
7457 /// ```ignore,no_run
7458 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7459 /// let x = KerberosConfig::new().set_enable_kerberos(true);
7460 /// ```
7461 pub fn set_enable_kerberos<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7462 self.enable_kerberos = v.into();
7463 self
7464 }
7465
7466 /// Sets the value of [root_principal_password_uri][crate::model::KerberosConfig::root_principal_password_uri].
7467 ///
7468 /// # Example
7469 /// ```ignore,no_run
7470 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7471 /// let x = KerberosConfig::new().set_root_principal_password_uri("example");
7472 /// ```
7473 pub fn set_root_principal_password_uri<T: std::convert::Into<std::string::String>>(
7474 mut self,
7475 v: T,
7476 ) -> Self {
7477 self.root_principal_password_uri = v.into();
7478 self
7479 }
7480
7481 /// Sets the value of [kms_key_uri][crate::model::KerberosConfig::kms_key_uri].
7482 ///
7483 /// # Example
7484 /// ```ignore,no_run
7485 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7486 /// let x = KerberosConfig::new().set_kms_key_uri("example");
7487 /// ```
7488 pub fn set_kms_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7489 self.kms_key_uri = v.into();
7490 self
7491 }
7492
7493 /// Sets the value of [keystore_uri][crate::model::KerberosConfig::keystore_uri].
7494 ///
7495 /// # Example
7496 /// ```ignore,no_run
7497 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7498 /// let x = KerberosConfig::new().set_keystore_uri("example");
7499 /// ```
7500 pub fn set_keystore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7501 self.keystore_uri = v.into();
7502 self
7503 }
7504
7505 /// Sets the value of [truststore_uri][crate::model::KerberosConfig::truststore_uri].
7506 ///
7507 /// # Example
7508 /// ```ignore,no_run
7509 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7510 /// let x = KerberosConfig::new().set_truststore_uri("example");
7511 /// ```
7512 pub fn set_truststore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7513 self.truststore_uri = v.into();
7514 self
7515 }
7516
7517 /// Sets the value of [keystore_password_uri][crate::model::KerberosConfig::keystore_password_uri].
7518 ///
7519 /// # Example
7520 /// ```ignore,no_run
7521 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7522 /// let x = KerberosConfig::new().set_keystore_password_uri("example");
7523 /// ```
7524 pub fn set_keystore_password_uri<T: std::convert::Into<std::string::String>>(
7525 mut self,
7526 v: T,
7527 ) -> Self {
7528 self.keystore_password_uri = v.into();
7529 self
7530 }
7531
7532 /// Sets the value of [key_password_uri][crate::model::KerberosConfig::key_password_uri].
7533 ///
7534 /// # Example
7535 /// ```ignore,no_run
7536 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7537 /// let x = KerberosConfig::new().set_key_password_uri("example");
7538 /// ```
7539 pub fn set_key_password_uri<T: std::convert::Into<std::string::String>>(
7540 mut self,
7541 v: T,
7542 ) -> Self {
7543 self.key_password_uri = v.into();
7544 self
7545 }
7546
7547 /// Sets the value of [truststore_password_uri][crate::model::KerberosConfig::truststore_password_uri].
7548 ///
7549 /// # Example
7550 /// ```ignore,no_run
7551 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7552 /// let x = KerberosConfig::new().set_truststore_password_uri("example");
7553 /// ```
7554 pub fn set_truststore_password_uri<T: std::convert::Into<std::string::String>>(
7555 mut self,
7556 v: T,
7557 ) -> Self {
7558 self.truststore_password_uri = v.into();
7559 self
7560 }
7561
7562 /// Sets the value of [cross_realm_trust_realm][crate::model::KerberosConfig::cross_realm_trust_realm].
7563 ///
7564 /// # Example
7565 /// ```ignore,no_run
7566 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7567 /// let x = KerberosConfig::new().set_cross_realm_trust_realm("example");
7568 /// ```
7569 pub fn set_cross_realm_trust_realm<T: std::convert::Into<std::string::String>>(
7570 mut self,
7571 v: T,
7572 ) -> Self {
7573 self.cross_realm_trust_realm = v.into();
7574 self
7575 }
7576
7577 /// Sets the value of [cross_realm_trust_kdc][crate::model::KerberosConfig::cross_realm_trust_kdc].
7578 ///
7579 /// # Example
7580 /// ```ignore,no_run
7581 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7582 /// let x = KerberosConfig::new().set_cross_realm_trust_kdc("example");
7583 /// ```
7584 pub fn set_cross_realm_trust_kdc<T: std::convert::Into<std::string::String>>(
7585 mut self,
7586 v: T,
7587 ) -> Self {
7588 self.cross_realm_trust_kdc = v.into();
7589 self
7590 }
7591
7592 /// Sets the value of [cross_realm_trust_admin_server][crate::model::KerberosConfig::cross_realm_trust_admin_server].
7593 ///
7594 /// # Example
7595 /// ```ignore,no_run
7596 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7597 /// let x = KerberosConfig::new().set_cross_realm_trust_admin_server("example");
7598 /// ```
7599 pub fn set_cross_realm_trust_admin_server<T: std::convert::Into<std::string::String>>(
7600 mut self,
7601 v: T,
7602 ) -> Self {
7603 self.cross_realm_trust_admin_server = v.into();
7604 self
7605 }
7606
7607 /// Sets the value of [cross_realm_trust_shared_password_uri][crate::model::KerberosConfig::cross_realm_trust_shared_password_uri].
7608 ///
7609 /// # Example
7610 /// ```ignore,no_run
7611 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7612 /// let x = KerberosConfig::new().set_cross_realm_trust_shared_password_uri("example");
7613 /// ```
7614 pub fn set_cross_realm_trust_shared_password_uri<T: std::convert::Into<std::string::String>>(
7615 mut self,
7616 v: T,
7617 ) -> Self {
7618 self.cross_realm_trust_shared_password_uri = v.into();
7619 self
7620 }
7621
7622 /// Sets the value of [kdc_db_key_uri][crate::model::KerberosConfig::kdc_db_key_uri].
7623 ///
7624 /// # Example
7625 /// ```ignore,no_run
7626 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7627 /// let x = KerberosConfig::new().set_kdc_db_key_uri("example");
7628 /// ```
7629 pub fn set_kdc_db_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7630 self.kdc_db_key_uri = v.into();
7631 self
7632 }
7633
7634 /// Sets the value of [tgt_lifetime_hours][crate::model::KerberosConfig::tgt_lifetime_hours].
7635 ///
7636 /// # Example
7637 /// ```ignore,no_run
7638 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7639 /// let x = KerberosConfig::new().set_tgt_lifetime_hours(42);
7640 /// ```
7641 pub fn set_tgt_lifetime_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7642 self.tgt_lifetime_hours = v.into();
7643 self
7644 }
7645
7646 /// Sets the value of [realm][crate::model::KerberosConfig::realm].
7647 ///
7648 /// # Example
7649 /// ```ignore,no_run
7650 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7651 /// let x = KerberosConfig::new().set_realm("example");
7652 /// ```
7653 pub fn set_realm<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7654 self.realm = v.into();
7655 self
7656 }
7657}
7658
7659impl wkt::message::Message for KerberosConfig {
7660 fn typename() -> &'static str {
7661 "type.googleapis.com/google.cloud.dataproc.v1.KerberosConfig"
7662 }
7663}
7664
7665/// Identity related configuration, including service account based
7666/// secure multi-tenancy user mappings.
7667#[derive(Clone, Default, PartialEq)]
7668#[non_exhaustive]
7669pub struct IdentityConfig {
7670 /// Required. Map of user to service account.
7671 pub user_service_account_mapping:
7672 std::collections::HashMap<std::string::String, std::string::String>,
7673
7674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7675}
7676
7677impl IdentityConfig {
7678 pub fn new() -> Self {
7679 std::default::Default::default()
7680 }
7681
7682 /// Sets the value of [user_service_account_mapping][crate::model::IdentityConfig::user_service_account_mapping].
7683 ///
7684 /// # Example
7685 /// ```ignore,no_run
7686 /// # use google_cloud_dataproc_v1::model::IdentityConfig;
7687 /// let x = IdentityConfig::new().set_user_service_account_mapping([
7688 /// ("key0", "abc"),
7689 /// ("key1", "xyz"),
7690 /// ]);
7691 /// ```
7692 pub fn set_user_service_account_mapping<T, K, V>(mut self, v: T) -> Self
7693 where
7694 T: std::iter::IntoIterator<Item = (K, V)>,
7695 K: std::convert::Into<std::string::String>,
7696 V: std::convert::Into<std::string::String>,
7697 {
7698 use std::iter::Iterator;
7699 self.user_service_account_mapping =
7700 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7701 self
7702 }
7703}
7704
7705impl wkt::message::Message for IdentityConfig {
7706 fn typename() -> &'static str {
7707 "type.googleapis.com/google.cloud.dataproc.v1.IdentityConfig"
7708 }
7709}
7710
7711/// Specifies the selection and config of software inside the cluster.
7712#[derive(Clone, Default, PartialEq)]
7713#[non_exhaustive]
7714pub struct SoftwareConfig {
7715 /// Optional. The version of software inside the cluster. It must be one of the
7716 /// supported [Dataproc
7717 /// Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported-dataproc-image-versions),
7718 /// such as "1.2" (including a subminor version, such as "1.2.29"), or the
7719 /// ["preview"
7720 /// version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
7721 /// If unspecified, it defaults to the latest Debian version.
7722 pub image_version: std::string::String,
7723
7724 /// Optional. The properties to set on daemon config files.
7725 ///
7726 /// Property keys are specified in `prefix:property` format, for example
7727 /// `core:hadoop.tmp.dir`. The following are supported prefixes
7728 /// and their mappings:
7729 ///
7730 /// * capacity-scheduler: `capacity-scheduler.xml`
7731 /// * core: `core-site.xml`
7732 /// * distcp: `distcp-default.xml`
7733 /// * hdfs: `hdfs-site.xml`
7734 /// * hive: `hive-site.xml`
7735 /// * mapred: `mapred-site.xml`
7736 /// * pig: `pig.properties`
7737 /// * spark: `spark-defaults.conf`
7738 /// * yarn: `yarn-site.xml`
7739 ///
7740 /// For more information, see [Cluster
7741 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
7742 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
7743
7744 /// Optional. The set of components to activate on the cluster.
7745 pub optional_components: std::vec::Vec<crate::model::Component>,
7746
7747 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7748}
7749
7750impl SoftwareConfig {
7751 pub fn new() -> Self {
7752 std::default::Default::default()
7753 }
7754
7755 /// Sets the value of [image_version][crate::model::SoftwareConfig::image_version].
7756 ///
7757 /// # Example
7758 /// ```ignore,no_run
7759 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
7760 /// let x = SoftwareConfig::new().set_image_version("example");
7761 /// ```
7762 pub fn set_image_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7763 self.image_version = v.into();
7764 self
7765 }
7766
7767 /// Sets the value of [properties][crate::model::SoftwareConfig::properties].
7768 ///
7769 /// # Example
7770 /// ```ignore,no_run
7771 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
7772 /// let x = SoftwareConfig::new().set_properties([
7773 /// ("key0", "abc"),
7774 /// ("key1", "xyz"),
7775 /// ]);
7776 /// ```
7777 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
7778 where
7779 T: std::iter::IntoIterator<Item = (K, V)>,
7780 K: std::convert::Into<std::string::String>,
7781 V: std::convert::Into<std::string::String>,
7782 {
7783 use std::iter::Iterator;
7784 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7785 self
7786 }
7787
7788 /// Sets the value of [optional_components][crate::model::SoftwareConfig::optional_components].
7789 ///
7790 /// # Example
7791 /// ```ignore,no_run
7792 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
7793 /// use google_cloud_dataproc_v1::model::Component;
7794 /// let x = SoftwareConfig::new().set_optional_components([
7795 /// Component::Anaconda,
7796 /// Component::Delta,
7797 /// Component::Docker,
7798 /// ]);
7799 /// ```
7800 pub fn set_optional_components<T, V>(mut self, v: T) -> Self
7801 where
7802 T: std::iter::IntoIterator<Item = V>,
7803 V: std::convert::Into<crate::model::Component>,
7804 {
7805 use std::iter::Iterator;
7806 self.optional_components = v.into_iter().map(|i| i.into()).collect();
7807 self
7808 }
7809}
7810
7811impl wkt::message::Message for SoftwareConfig {
7812 fn typename() -> &'static str {
7813 "type.googleapis.com/google.cloud.dataproc.v1.SoftwareConfig"
7814 }
7815}
7816
7817/// Specifies the cluster auto-delete schedule configuration.
7818#[derive(Clone, Default, PartialEq)]
7819#[non_exhaustive]
7820pub struct LifecycleConfig {
7821 /// Optional. The duration to keep the cluster alive while idling (when no jobs
7822 /// are running). Passing this threshold will cause the cluster to be
7823 /// deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON
7824 /// representation of
7825 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7826 pub idle_delete_ttl: std::option::Option<wkt::Duration>,
7827
7828 /// Output only. The time when cluster became idle (most recent job finished)
7829 /// and became eligible for deletion due to idleness (see JSON representation
7830 /// of
7831 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7832 pub idle_start_time: std::option::Option<wkt::Timestamp>,
7833
7834 /// Either the exact time the cluster should be deleted at or
7835 /// the cluster maximum age.
7836 pub ttl: std::option::Option<crate::model::lifecycle_config::Ttl>,
7837
7838 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7839}
7840
7841impl LifecycleConfig {
7842 pub fn new() -> Self {
7843 std::default::Default::default()
7844 }
7845
7846 /// Sets the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
7847 ///
7848 /// # Example
7849 /// ```ignore,no_run
7850 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7851 /// use wkt::Duration;
7852 /// let x = LifecycleConfig::new().set_idle_delete_ttl(Duration::default()/* use setters */);
7853 /// ```
7854 pub fn set_idle_delete_ttl<T>(mut self, v: T) -> Self
7855 where
7856 T: std::convert::Into<wkt::Duration>,
7857 {
7858 self.idle_delete_ttl = std::option::Option::Some(v.into());
7859 self
7860 }
7861
7862 /// Sets or clears the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
7863 ///
7864 /// # Example
7865 /// ```ignore,no_run
7866 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7867 /// use wkt::Duration;
7868 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(Some(Duration::default()/* use setters */));
7869 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(None::<Duration>);
7870 /// ```
7871 pub fn set_or_clear_idle_delete_ttl<T>(mut self, v: std::option::Option<T>) -> Self
7872 where
7873 T: std::convert::Into<wkt::Duration>,
7874 {
7875 self.idle_delete_ttl = v.map(|x| x.into());
7876 self
7877 }
7878
7879 /// Sets the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
7880 ///
7881 /// # Example
7882 /// ```ignore,no_run
7883 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7884 /// use wkt::Timestamp;
7885 /// let x = LifecycleConfig::new().set_idle_start_time(Timestamp::default()/* use setters */);
7886 /// ```
7887 pub fn set_idle_start_time<T>(mut self, v: T) -> Self
7888 where
7889 T: std::convert::Into<wkt::Timestamp>,
7890 {
7891 self.idle_start_time = std::option::Option::Some(v.into());
7892 self
7893 }
7894
7895 /// Sets or clears the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
7896 ///
7897 /// # Example
7898 /// ```ignore,no_run
7899 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7900 /// use wkt::Timestamp;
7901 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(Some(Timestamp::default()/* use setters */));
7902 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(None::<Timestamp>);
7903 /// ```
7904 pub fn set_or_clear_idle_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7905 where
7906 T: std::convert::Into<wkt::Timestamp>,
7907 {
7908 self.idle_start_time = v.map(|x| x.into());
7909 self
7910 }
7911
7912 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl].
7913 ///
7914 /// Note that all the setters affecting `ttl` are mutually
7915 /// exclusive.
7916 ///
7917 /// # Example
7918 /// ```ignore,no_run
7919 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7920 /// use wkt::Timestamp;
7921 /// let x = LifecycleConfig::new().set_ttl(Some(
7922 /// google_cloud_dataproc_v1::model::lifecycle_config::Ttl::AutoDeleteTime(Timestamp::default().into())));
7923 /// ```
7924 pub fn set_ttl<
7925 T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::Ttl>>,
7926 >(
7927 mut self,
7928 v: T,
7929 ) -> Self {
7930 self.ttl = v.into();
7931 self
7932 }
7933
7934 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
7935 /// if it holds a `AutoDeleteTime`, `None` if the field is not set or
7936 /// holds a different branch.
7937 pub fn auto_delete_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
7938 #[allow(unreachable_patterns)]
7939 self.ttl.as_ref().and_then(|v| match v {
7940 crate::model::lifecycle_config::Ttl::AutoDeleteTime(v) => std::option::Option::Some(v),
7941 _ => std::option::Option::None,
7942 })
7943 }
7944
7945 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
7946 /// to hold a `AutoDeleteTime`.
7947 ///
7948 /// Note that all the setters affecting `ttl` are
7949 /// mutually exclusive.
7950 ///
7951 /// # Example
7952 /// ```ignore,no_run
7953 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7954 /// use wkt::Timestamp;
7955 /// let x = LifecycleConfig::new().set_auto_delete_time(Timestamp::default()/* use setters */);
7956 /// assert!(x.auto_delete_time().is_some());
7957 /// assert!(x.auto_delete_ttl().is_none());
7958 /// ```
7959 pub fn set_auto_delete_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
7960 mut self,
7961 v: T,
7962 ) -> Self {
7963 self.ttl = std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTime(
7964 v.into(),
7965 ));
7966 self
7967 }
7968
7969 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
7970 /// if it holds a `AutoDeleteTtl`, `None` if the field is not set or
7971 /// holds a different branch.
7972 pub fn auto_delete_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
7973 #[allow(unreachable_patterns)]
7974 self.ttl.as_ref().and_then(|v| match v {
7975 crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v) => std::option::Option::Some(v),
7976 _ => std::option::Option::None,
7977 })
7978 }
7979
7980 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
7981 /// to hold a `AutoDeleteTtl`.
7982 ///
7983 /// Note that all the setters affecting `ttl` are
7984 /// mutually exclusive.
7985 ///
7986 /// # Example
7987 /// ```ignore,no_run
7988 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7989 /// use wkt::Duration;
7990 /// let x = LifecycleConfig::new().set_auto_delete_ttl(Duration::default()/* use setters */);
7991 /// assert!(x.auto_delete_ttl().is_some());
7992 /// assert!(x.auto_delete_time().is_none());
7993 /// ```
7994 pub fn set_auto_delete_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
7995 mut self,
7996 v: T,
7997 ) -> Self {
7998 self.ttl =
7999 std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v.into()));
8000 self
8001 }
8002}
8003
8004impl wkt::message::Message for LifecycleConfig {
8005 fn typename() -> &'static str {
8006 "type.googleapis.com/google.cloud.dataproc.v1.LifecycleConfig"
8007 }
8008}
8009
8010/// Defines additional types related to [LifecycleConfig].
8011pub mod lifecycle_config {
8012 #[allow(unused_imports)]
8013 use super::*;
8014
8015 /// Either the exact time the cluster should be deleted at or
8016 /// the cluster maximum age.
8017 #[derive(Clone, Debug, PartialEq)]
8018 #[non_exhaustive]
8019 pub enum Ttl {
8020 /// Optional. The time when cluster will be auto-deleted (see JSON
8021 /// representation of
8022 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8023 AutoDeleteTime(std::boxed::Box<wkt::Timestamp>),
8024 /// Optional. The lifetime duration of cluster. The cluster will be
8025 /// auto-deleted at the end of this period. Minimum value is 10 minutes;
8026 /// maximum value is 14 days (see JSON representation of
8027 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8028 AutoDeleteTtl(std::boxed::Box<wkt::Duration>),
8029 }
8030}
8031
8032/// Specifies a Metastore configuration.
8033#[derive(Clone, Default, PartialEq)]
8034#[non_exhaustive]
8035pub struct MetastoreConfig {
8036 /// Required. Resource name of an existing Dataproc Metastore service.
8037 ///
8038 /// Example:
8039 ///
8040 /// * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]`
8041 pub dataproc_metastore_service: std::string::String,
8042
8043 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8044}
8045
8046impl MetastoreConfig {
8047 pub fn new() -> Self {
8048 std::default::Default::default()
8049 }
8050
8051 /// Sets the value of [dataproc_metastore_service][crate::model::MetastoreConfig::dataproc_metastore_service].
8052 ///
8053 /// # Example
8054 /// ```ignore,no_run
8055 /// # use google_cloud_dataproc_v1::model::MetastoreConfig;
8056 /// let x = MetastoreConfig::new().set_dataproc_metastore_service("example");
8057 /// ```
8058 pub fn set_dataproc_metastore_service<T: std::convert::Into<std::string::String>>(
8059 mut self,
8060 v: T,
8061 ) -> Self {
8062 self.dataproc_metastore_service = v.into();
8063 self
8064 }
8065}
8066
8067impl wkt::message::Message for MetastoreConfig {
8068 fn typename() -> &'static str {
8069 "type.googleapis.com/google.cloud.dataproc.v1.MetastoreConfig"
8070 }
8071}
8072
8073/// Contains cluster daemon metrics, such as HDFS and YARN stats.
8074///
8075/// **Beta Feature**: This report is available for testing purposes only. It may
8076/// be changed before final release.
8077#[derive(Clone, Default, PartialEq)]
8078#[non_exhaustive]
8079pub struct ClusterMetrics {
8080 /// The HDFS metrics.
8081 pub hdfs_metrics: std::collections::HashMap<std::string::String, i64>,
8082
8083 /// YARN metrics.
8084 pub yarn_metrics: std::collections::HashMap<std::string::String, i64>,
8085
8086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8087}
8088
8089impl ClusterMetrics {
8090 pub fn new() -> Self {
8091 std::default::Default::default()
8092 }
8093
8094 /// Sets the value of [hdfs_metrics][crate::model::ClusterMetrics::hdfs_metrics].
8095 ///
8096 /// # Example
8097 /// ```ignore,no_run
8098 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8099 /// let x = ClusterMetrics::new().set_hdfs_metrics([
8100 /// ("key0", 123),
8101 /// ("key1", 456),
8102 /// ]);
8103 /// ```
8104 pub fn set_hdfs_metrics<T, K, V>(mut self, v: T) -> Self
8105 where
8106 T: std::iter::IntoIterator<Item = (K, V)>,
8107 K: std::convert::Into<std::string::String>,
8108 V: std::convert::Into<i64>,
8109 {
8110 use std::iter::Iterator;
8111 self.hdfs_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8112 self
8113 }
8114
8115 /// Sets the value of [yarn_metrics][crate::model::ClusterMetrics::yarn_metrics].
8116 ///
8117 /// # Example
8118 /// ```ignore,no_run
8119 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8120 /// let x = ClusterMetrics::new().set_yarn_metrics([
8121 /// ("key0", 123),
8122 /// ("key1", 456),
8123 /// ]);
8124 /// ```
8125 pub fn set_yarn_metrics<T, K, V>(mut self, v: T) -> Self
8126 where
8127 T: std::iter::IntoIterator<Item = (K, V)>,
8128 K: std::convert::Into<std::string::String>,
8129 V: std::convert::Into<i64>,
8130 {
8131 use std::iter::Iterator;
8132 self.yarn_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8133 self
8134 }
8135}
8136
8137impl wkt::message::Message for ClusterMetrics {
8138 fn typename() -> &'static str {
8139 "type.googleapis.com/google.cloud.dataproc.v1.ClusterMetrics"
8140 }
8141}
8142
8143/// Dataproc metric config.
8144#[derive(Clone, Default, PartialEq)]
8145#[non_exhaustive]
8146pub struct DataprocMetricConfig {
8147 /// Required. Metrics sources to enable.
8148 pub metrics: std::vec::Vec<crate::model::dataproc_metric_config::Metric>,
8149
8150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8151}
8152
8153impl DataprocMetricConfig {
8154 pub fn new() -> Self {
8155 std::default::Default::default()
8156 }
8157
8158 /// Sets the value of [metrics][crate::model::DataprocMetricConfig::metrics].
8159 ///
8160 /// # Example
8161 /// ```ignore,no_run
8162 /// # use google_cloud_dataproc_v1::model::DataprocMetricConfig;
8163 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8164 /// let x = DataprocMetricConfig::new()
8165 /// .set_metrics([
8166 /// Metric::default()/* use setters */,
8167 /// Metric::default()/* use (different) setters */,
8168 /// ]);
8169 /// ```
8170 pub fn set_metrics<T, V>(mut self, v: T) -> Self
8171 where
8172 T: std::iter::IntoIterator<Item = V>,
8173 V: std::convert::Into<crate::model::dataproc_metric_config::Metric>,
8174 {
8175 use std::iter::Iterator;
8176 self.metrics = v.into_iter().map(|i| i.into()).collect();
8177 self
8178 }
8179}
8180
8181impl wkt::message::Message for DataprocMetricConfig {
8182 fn typename() -> &'static str {
8183 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig"
8184 }
8185}
8186
8187/// Defines additional types related to [DataprocMetricConfig].
8188pub mod dataproc_metric_config {
8189 #[allow(unused_imports)]
8190 use super::*;
8191
8192 /// A Dataproc custom metric.
8193 #[derive(Clone, Default, PartialEq)]
8194 #[non_exhaustive]
8195 pub struct Metric {
8196 /// Required. A standard set of metrics is collected unless `metricOverrides`
8197 /// are specified for the metric source (see [Custom metrics]
8198 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8199 /// for more information).
8200 pub metric_source: crate::model::dataproc_metric_config::MetricSource,
8201
8202 /// Optional. Specify one or more [Custom metrics]
8203 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8204 /// to collect for the metric course (for the `SPARK` metric source (any
8205 /// [Spark metric]
8206 /// (<https://spark.apache.org/docs/latest/monitoring.html#metrics>) can be
8207 /// specified).
8208 ///
8209 /// Provide metrics in the following format:
8210 /// \<code\>\<var\>METRIC_SOURCE\</var\>:\<var\>INSTANCE\</var\>:\<var\>GROUP\</var\>:\<var\>METRIC\</var\>\</code\>
8211 /// Use camelcase as appropriate.
8212 ///
8213 /// Examples:
8214 ///
8215 /// ```norust
8216 /// yarn:ResourceManager:QueueMetrics:AppsCompleted
8217 /// spark:driver:DAGScheduler:job.allJobs
8218 /// sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed
8219 /// hiveserver2:JVM:Memory:NonHeapMemoryUsage.used
8220 /// ```
8221 ///
8222 /// Notes:
8223 ///
8224 /// * Only the specified overridden metrics are collected for the
8225 /// metric source. For example, if one or more `spark:executive` metrics
8226 /// are listed as metric overrides, other `SPARK` metrics are not
8227 /// collected. The collection of the metrics for other enabled custom
8228 /// metric sources is unaffected. For example, if both `SPARK` andd `YARN`
8229 /// metric sources are enabled, and overrides are provided for Spark
8230 /// metrics only, all YARN metrics are collected.
8231 pub metric_overrides: std::vec::Vec<std::string::String>,
8232
8233 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8234 }
8235
8236 impl Metric {
8237 pub fn new() -> Self {
8238 std::default::Default::default()
8239 }
8240
8241 /// Sets the value of [metric_source][crate::model::dataproc_metric_config::Metric::metric_source].
8242 ///
8243 /// # Example
8244 /// ```ignore,no_run
8245 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8246 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::MetricSource;
8247 /// let x0 = Metric::new().set_metric_source(MetricSource::MonitoringAgentDefaults);
8248 /// let x1 = Metric::new().set_metric_source(MetricSource::Hdfs);
8249 /// let x2 = Metric::new().set_metric_source(MetricSource::Spark);
8250 /// ```
8251 pub fn set_metric_source<
8252 T: std::convert::Into<crate::model::dataproc_metric_config::MetricSource>,
8253 >(
8254 mut self,
8255 v: T,
8256 ) -> Self {
8257 self.metric_source = v.into();
8258 self
8259 }
8260
8261 /// Sets the value of [metric_overrides][crate::model::dataproc_metric_config::Metric::metric_overrides].
8262 ///
8263 /// # Example
8264 /// ```ignore,no_run
8265 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8266 /// let x = Metric::new().set_metric_overrides(["a", "b", "c"]);
8267 /// ```
8268 pub fn set_metric_overrides<T, V>(mut self, v: T) -> Self
8269 where
8270 T: std::iter::IntoIterator<Item = V>,
8271 V: std::convert::Into<std::string::String>,
8272 {
8273 use std::iter::Iterator;
8274 self.metric_overrides = v.into_iter().map(|i| i.into()).collect();
8275 self
8276 }
8277 }
8278
8279 impl wkt::message::Message for Metric {
8280 fn typename() -> &'static str {
8281 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig.Metric"
8282 }
8283 }
8284
8285 /// A source for the collection of Dataproc custom metrics (see [Custom
8286 /// metrics]
8287 /// (<https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics>)).
8288 ///
8289 /// # Working with unknown values
8290 ///
8291 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8292 /// additional enum variants at any time. Adding new variants is not considered
8293 /// a breaking change. Applications should write their code in anticipation of:
8294 ///
8295 /// - New values appearing in future releases of the client library, **and**
8296 /// - New values received dynamically, without application changes.
8297 ///
8298 /// Please consult the [Working with enums] section in the user guide for some
8299 /// guidelines.
8300 ///
8301 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8302 #[derive(Clone, Debug, PartialEq)]
8303 #[non_exhaustive]
8304 pub enum MetricSource {
8305 /// Required unspecified metric source.
8306 Unspecified,
8307 /// Monitoring agent metrics. If this source is enabled,
8308 /// Dataproc enables the monitoring agent in Compute Engine,
8309 /// and collects monitoring agent metrics, which are published
8310 /// with an `agent.googleapis.com` prefix.
8311 MonitoringAgentDefaults,
8312 /// HDFS metric source.
8313 Hdfs,
8314 /// Spark metric source.
8315 Spark,
8316 /// YARN metric source.
8317 Yarn,
8318 /// Spark History Server metric source.
8319 SparkHistoryServer,
8320 /// Hiveserver2 metric source.
8321 Hiveserver2,
8322 /// hivemetastore metric source
8323 Hivemetastore,
8324 /// flink metric source
8325 Flink,
8326 /// If set, the enum was initialized with an unknown value.
8327 ///
8328 /// Applications can examine the value using [MetricSource::value] or
8329 /// [MetricSource::name].
8330 UnknownValue(metric_source::UnknownValue),
8331 }
8332
8333 #[doc(hidden)]
8334 pub mod metric_source {
8335 #[allow(unused_imports)]
8336 use super::*;
8337 #[derive(Clone, Debug, PartialEq)]
8338 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8339 }
8340
8341 impl MetricSource {
8342 /// Gets the enum value.
8343 ///
8344 /// Returns `None` if the enum contains an unknown value deserialized from
8345 /// the string representation of enums.
8346 pub fn value(&self) -> std::option::Option<i32> {
8347 match self {
8348 Self::Unspecified => std::option::Option::Some(0),
8349 Self::MonitoringAgentDefaults => std::option::Option::Some(1),
8350 Self::Hdfs => std::option::Option::Some(2),
8351 Self::Spark => std::option::Option::Some(3),
8352 Self::Yarn => std::option::Option::Some(4),
8353 Self::SparkHistoryServer => std::option::Option::Some(5),
8354 Self::Hiveserver2 => std::option::Option::Some(6),
8355 Self::Hivemetastore => std::option::Option::Some(7),
8356 Self::Flink => std::option::Option::Some(8),
8357 Self::UnknownValue(u) => u.0.value(),
8358 }
8359 }
8360
8361 /// Gets the enum value as a string.
8362 ///
8363 /// Returns `None` if the enum contains an unknown value deserialized from
8364 /// the integer representation of enums.
8365 pub fn name(&self) -> std::option::Option<&str> {
8366 match self {
8367 Self::Unspecified => std::option::Option::Some("METRIC_SOURCE_UNSPECIFIED"),
8368 Self::MonitoringAgentDefaults => {
8369 std::option::Option::Some("MONITORING_AGENT_DEFAULTS")
8370 }
8371 Self::Hdfs => std::option::Option::Some("HDFS"),
8372 Self::Spark => std::option::Option::Some("SPARK"),
8373 Self::Yarn => std::option::Option::Some("YARN"),
8374 Self::SparkHistoryServer => std::option::Option::Some("SPARK_HISTORY_SERVER"),
8375 Self::Hiveserver2 => std::option::Option::Some("HIVESERVER2"),
8376 Self::Hivemetastore => std::option::Option::Some("HIVEMETASTORE"),
8377 Self::Flink => std::option::Option::Some("FLINK"),
8378 Self::UnknownValue(u) => u.0.name(),
8379 }
8380 }
8381 }
8382
8383 impl std::default::Default for MetricSource {
8384 fn default() -> Self {
8385 use std::convert::From;
8386 Self::from(0)
8387 }
8388 }
8389
8390 impl std::fmt::Display for MetricSource {
8391 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8392 wkt::internal::display_enum(f, self.name(), self.value())
8393 }
8394 }
8395
8396 impl std::convert::From<i32> for MetricSource {
8397 fn from(value: i32) -> Self {
8398 match value {
8399 0 => Self::Unspecified,
8400 1 => Self::MonitoringAgentDefaults,
8401 2 => Self::Hdfs,
8402 3 => Self::Spark,
8403 4 => Self::Yarn,
8404 5 => Self::SparkHistoryServer,
8405 6 => Self::Hiveserver2,
8406 7 => Self::Hivemetastore,
8407 8 => Self::Flink,
8408 _ => Self::UnknownValue(metric_source::UnknownValue(
8409 wkt::internal::UnknownEnumValue::Integer(value),
8410 )),
8411 }
8412 }
8413 }
8414
8415 impl std::convert::From<&str> for MetricSource {
8416 fn from(value: &str) -> Self {
8417 use std::string::ToString;
8418 match value {
8419 "METRIC_SOURCE_UNSPECIFIED" => Self::Unspecified,
8420 "MONITORING_AGENT_DEFAULTS" => Self::MonitoringAgentDefaults,
8421 "HDFS" => Self::Hdfs,
8422 "SPARK" => Self::Spark,
8423 "YARN" => Self::Yarn,
8424 "SPARK_HISTORY_SERVER" => Self::SparkHistoryServer,
8425 "HIVESERVER2" => Self::Hiveserver2,
8426 "HIVEMETASTORE" => Self::Hivemetastore,
8427 "FLINK" => Self::Flink,
8428 _ => Self::UnknownValue(metric_source::UnknownValue(
8429 wkt::internal::UnknownEnumValue::String(value.to_string()),
8430 )),
8431 }
8432 }
8433 }
8434
8435 impl serde::ser::Serialize for MetricSource {
8436 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8437 where
8438 S: serde::Serializer,
8439 {
8440 match self {
8441 Self::Unspecified => serializer.serialize_i32(0),
8442 Self::MonitoringAgentDefaults => serializer.serialize_i32(1),
8443 Self::Hdfs => serializer.serialize_i32(2),
8444 Self::Spark => serializer.serialize_i32(3),
8445 Self::Yarn => serializer.serialize_i32(4),
8446 Self::SparkHistoryServer => serializer.serialize_i32(5),
8447 Self::Hiveserver2 => serializer.serialize_i32(6),
8448 Self::Hivemetastore => serializer.serialize_i32(7),
8449 Self::Flink => serializer.serialize_i32(8),
8450 Self::UnknownValue(u) => u.0.serialize(serializer),
8451 }
8452 }
8453 }
8454
8455 impl<'de> serde::de::Deserialize<'de> for MetricSource {
8456 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8457 where
8458 D: serde::Deserializer<'de>,
8459 {
8460 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricSource>::new(
8461 ".google.cloud.dataproc.v1.DataprocMetricConfig.MetricSource",
8462 ))
8463 }
8464 }
8465}
8466
8467/// A request to create a cluster.
8468#[derive(Clone, Default, PartialEq)]
8469#[non_exhaustive]
8470pub struct CreateClusterRequest {
8471 /// Required. The ID of the Google Cloud Platform project that the cluster
8472 /// belongs to.
8473 pub project_id: std::string::String,
8474
8475 /// Required. The Dataproc region in which to handle the request.
8476 pub region: std::string::String,
8477
8478 /// Required. The cluster to create.
8479 pub cluster: std::option::Option<crate::model::Cluster>,
8480
8481 /// Optional. A unique ID used to identify the request. If the server receives
8482 /// two
8483 /// [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
8484 /// with the same id, then the second request will be ignored and the
8485 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8486 /// and stored in the backend is returned.
8487 ///
8488 /// It is recommended to always set this value to a
8489 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8490 ///
8491 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8492 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8493 ///
8494 /// [google.longrunning.Operation]: longrunning::model::Operation
8495 pub request_id: std::string::String,
8496
8497 /// Optional. Failure action when primary worker creation fails.
8498 pub action_on_failed_primary_workers: crate::model::FailureAction,
8499
8500 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8501}
8502
8503impl CreateClusterRequest {
8504 pub fn new() -> Self {
8505 std::default::Default::default()
8506 }
8507
8508 /// Sets the value of [project_id][crate::model::CreateClusterRequest::project_id].
8509 ///
8510 /// # Example
8511 /// ```ignore,no_run
8512 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8513 /// let x = CreateClusterRequest::new().set_project_id("example");
8514 /// ```
8515 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8516 self.project_id = v.into();
8517 self
8518 }
8519
8520 /// Sets the value of [region][crate::model::CreateClusterRequest::region].
8521 ///
8522 /// # Example
8523 /// ```ignore,no_run
8524 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8525 /// let x = CreateClusterRequest::new().set_region("example");
8526 /// ```
8527 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8528 self.region = v.into();
8529 self
8530 }
8531
8532 /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
8533 ///
8534 /// # Example
8535 /// ```ignore,no_run
8536 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8537 /// use google_cloud_dataproc_v1::model::Cluster;
8538 /// let x = CreateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
8539 /// ```
8540 pub fn set_cluster<T>(mut self, v: T) -> Self
8541 where
8542 T: std::convert::Into<crate::model::Cluster>,
8543 {
8544 self.cluster = std::option::Option::Some(v.into());
8545 self
8546 }
8547
8548 /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
8549 ///
8550 /// # Example
8551 /// ```ignore,no_run
8552 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8553 /// use google_cloud_dataproc_v1::model::Cluster;
8554 /// let x = CreateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
8555 /// let x = CreateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
8556 /// ```
8557 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
8558 where
8559 T: std::convert::Into<crate::model::Cluster>,
8560 {
8561 self.cluster = v.map(|x| x.into());
8562 self
8563 }
8564
8565 /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
8566 ///
8567 /// # Example
8568 /// ```ignore,no_run
8569 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8570 /// let x = CreateClusterRequest::new().set_request_id("example");
8571 /// ```
8572 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8573 self.request_id = v.into();
8574 self
8575 }
8576
8577 /// Sets the value of [action_on_failed_primary_workers][crate::model::CreateClusterRequest::action_on_failed_primary_workers].
8578 ///
8579 /// # Example
8580 /// ```ignore,no_run
8581 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8582 /// use google_cloud_dataproc_v1::model::FailureAction;
8583 /// let x0 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::NoAction);
8584 /// let x1 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::Delete);
8585 /// ```
8586 pub fn set_action_on_failed_primary_workers<
8587 T: std::convert::Into<crate::model::FailureAction>,
8588 >(
8589 mut self,
8590 v: T,
8591 ) -> Self {
8592 self.action_on_failed_primary_workers = v.into();
8593 self
8594 }
8595}
8596
8597impl wkt::message::Message for CreateClusterRequest {
8598 fn typename() -> &'static str {
8599 "type.googleapis.com/google.cloud.dataproc.v1.CreateClusterRequest"
8600 }
8601}
8602
8603/// A request to update a cluster.
8604#[derive(Clone, Default, PartialEq)]
8605#[non_exhaustive]
8606pub struct UpdateClusterRequest {
8607 /// Required. The ID of the Google Cloud Platform project the
8608 /// cluster belongs to.
8609 pub project_id: std::string::String,
8610
8611 /// Required. The Dataproc region in which to handle the request.
8612 pub region: std::string::String,
8613
8614 /// Required. The cluster name.
8615 pub cluster_name: std::string::String,
8616
8617 /// Required. The changes to the cluster.
8618 pub cluster: std::option::Option<crate::model::Cluster>,
8619
8620 /// Optional. Timeout for graceful YARN decommissioning. Graceful
8621 /// decommissioning allows removing nodes from the cluster without
8622 /// interrupting jobs in progress. Timeout specifies how long to wait for jobs
8623 /// in progress to finish before forcefully removing nodes (and potentially
8624 /// interrupting jobs). Default timeout is 0 (for forceful decommission), and
8625 /// the maximum allowed timeout is 1 day. (see JSON representation of
8626 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8627 ///
8628 /// Only supported on Dataproc image versions 1.2 and higher.
8629 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
8630
8631 /// Required. Specifies the path, relative to `Cluster`, of
8632 /// the field to update. For example, to change the number of workers
8633 /// in a cluster to 5, the `update_mask` parameter would be
8634 /// specified as `config.worker_config.num_instances`,
8635 /// and the `PATCH` request body would specify the new value, as follows:
8636 ///
8637 /// ```norust
8638 /// {
8639 /// "config":{
8640 /// "workerConfig":{
8641 /// "numInstances":"5"
8642 /// }
8643 /// }
8644 /// }
8645 /// ```
8646 ///
8647 /// Similarly, to change the number of preemptible workers in a cluster to 5,
8648 /// the `update_mask` parameter would be
8649 /// `config.secondary_worker_config.num_instances`, and the `PATCH` request
8650 /// body would be set as follows:
8651 ///
8652 /// ```norust
8653 /// {
8654 /// "config":{
8655 /// "secondaryWorkerConfig":{
8656 /// "numInstances":"5"
8657 /// }
8658 /// }
8659 /// }
8660 /// ```
8661 ///
8662 /// \<strong\>Note:\</strong\> Currently, only the following fields can be updated:
8663 pub update_mask: std::option::Option<wkt::FieldMask>,
8664
8665 /// Optional. A unique ID used to identify the request. If the server
8666 /// receives two
8667 /// [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
8668 /// with the same id, then the second request will be ignored and the
8669 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8670 /// and stored in the backend is returned.
8671 ///
8672 /// It is recommended to always set this value to a
8673 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8674 ///
8675 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8676 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8677 ///
8678 /// [google.longrunning.Operation]: longrunning::model::Operation
8679 pub request_id: std::string::String,
8680
8681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8682}
8683
8684impl UpdateClusterRequest {
8685 pub fn new() -> Self {
8686 std::default::Default::default()
8687 }
8688
8689 /// Sets the value of [project_id][crate::model::UpdateClusterRequest::project_id].
8690 ///
8691 /// # Example
8692 /// ```ignore,no_run
8693 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8694 /// let x = UpdateClusterRequest::new().set_project_id("example");
8695 /// ```
8696 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8697 self.project_id = v.into();
8698 self
8699 }
8700
8701 /// Sets the value of [region][crate::model::UpdateClusterRequest::region].
8702 ///
8703 /// # Example
8704 /// ```ignore,no_run
8705 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8706 /// let x = UpdateClusterRequest::new().set_region("example");
8707 /// ```
8708 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8709 self.region = v.into();
8710 self
8711 }
8712
8713 /// Sets the value of [cluster_name][crate::model::UpdateClusterRequest::cluster_name].
8714 ///
8715 /// # Example
8716 /// ```ignore,no_run
8717 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8718 /// let x = UpdateClusterRequest::new().set_cluster_name("example");
8719 /// ```
8720 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8721 self.cluster_name = v.into();
8722 self
8723 }
8724
8725 /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
8726 ///
8727 /// # Example
8728 /// ```ignore,no_run
8729 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8730 /// use google_cloud_dataproc_v1::model::Cluster;
8731 /// let x = UpdateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
8732 /// ```
8733 pub fn set_cluster<T>(mut self, v: T) -> Self
8734 where
8735 T: std::convert::Into<crate::model::Cluster>,
8736 {
8737 self.cluster = std::option::Option::Some(v.into());
8738 self
8739 }
8740
8741 /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
8742 ///
8743 /// # Example
8744 /// ```ignore,no_run
8745 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8746 /// use google_cloud_dataproc_v1::model::Cluster;
8747 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
8748 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
8749 /// ```
8750 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
8751 where
8752 T: std::convert::Into<crate::model::Cluster>,
8753 {
8754 self.cluster = v.map(|x| x.into());
8755 self
8756 }
8757
8758 /// Sets the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
8759 ///
8760 /// # Example
8761 /// ```ignore,no_run
8762 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8763 /// use wkt::Duration;
8764 /// let x = UpdateClusterRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
8765 /// ```
8766 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
8767 where
8768 T: std::convert::Into<wkt::Duration>,
8769 {
8770 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
8771 self
8772 }
8773
8774 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
8775 ///
8776 /// # Example
8777 /// ```ignore,no_run
8778 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8779 /// use wkt::Duration;
8780 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
8781 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
8782 /// ```
8783 pub fn set_or_clear_graceful_decommission_timeout<T>(
8784 mut self,
8785 v: std::option::Option<T>,
8786 ) -> Self
8787 where
8788 T: std::convert::Into<wkt::Duration>,
8789 {
8790 self.graceful_decommission_timeout = v.map(|x| x.into());
8791 self
8792 }
8793
8794 /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
8795 ///
8796 /// # Example
8797 /// ```ignore,no_run
8798 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8799 /// use wkt::FieldMask;
8800 /// let x = UpdateClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8801 /// ```
8802 pub fn set_update_mask<T>(mut self, v: T) -> Self
8803 where
8804 T: std::convert::Into<wkt::FieldMask>,
8805 {
8806 self.update_mask = std::option::Option::Some(v.into());
8807 self
8808 }
8809
8810 /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
8811 ///
8812 /// # Example
8813 /// ```ignore,no_run
8814 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8815 /// use wkt::FieldMask;
8816 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8817 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8818 /// ```
8819 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8820 where
8821 T: std::convert::Into<wkt::FieldMask>,
8822 {
8823 self.update_mask = v.map(|x| x.into());
8824 self
8825 }
8826
8827 /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
8828 ///
8829 /// # Example
8830 /// ```ignore,no_run
8831 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8832 /// let x = UpdateClusterRequest::new().set_request_id("example");
8833 /// ```
8834 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8835 self.request_id = v.into();
8836 self
8837 }
8838}
8839
8840impl wkt::message::Message for UpdateClusterRequest {
8841 fn typename() -> &'static str {
8842 "type.googleapis.com/google.cloud.dataproc.v1.UpdateClusterRequest"
8843 }
8844}
8845
8846/// A request to stop a cluster.
8847#[derive(Clone, Default, PartialEq)]
8848#[non_exhaustive]
8849pub struct StopClusterRequest {
8850 /// Required. The ID of the Google Cloud Platform project the
8851 /// cluster belongs to.
8852 pub project_id: std::string::String,
8853
8854 /// Required. The Dataproc region in which to handle the request.
8855 pub region: std::string::String,
8856
8857 /// Required. The cluster name.
8858 pub cluster_name: std::string::String,
8859
8860 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
8861 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
8862 pub cluster_uuid: std::string::String,
8863
8864 /// Optional. A unique ID used to identify the request. If the server
8865 /// receives two
8866 /// [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
8867 /// with the same id, then the second request will be ignored and the
8868 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8869 /// and stored in the backend is returned.
8870 ///
8871 /// Recommendation: Set this value to a
8872 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8873 ///
8874 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8875 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8876 ///
8877 /// [google.longrunning.Operation]: longrunning::model::Operation
8878 pub request_id: std::string::String,
8879
8880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8881}
8882
8883impl StopClusterRequest {
8884 pub fn new() -> Self {
8885 std::default::Default::default()
8886 }
8887
8888 /// Sets the value of [project_id][crate::model::StopClusterRequest::project_id].
8889 ///
8890 /// # Example
8891 /// ```ignore,no_run
8892 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8893 /// let x = StopClusterRequest::new().set_project_id("example");
8894 /// ```
8895 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8896 self.project_id = v.into();
8897 self
8898 }
8899
8900 /// Sets the value of [region][crate::model::StopClusterRequest::region].
8901 ///
8902 /// # Example
8903 /// ```ignore,no_run
8904 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8905 /// let x = StopClusterRequest::new().set_region("example");
8906 /// ```
8907 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8908 self.region = v.into();
8909 self
8910 }
8911
8912 /// Sets the value of [cluster_name][crate::model::StopClusterRequest::cluster_name].
8913 ///
8914 /// # Example
8915 /// ```ignore,no_run
8916 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8917 /// let x = StopClusterRequest::new().set_cluster_name("example");
8918 /// ```
8919 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8920 self.cluster_name = v.into();
8921 self
8922 }
8923
8924 /// Sets the value of [cluster_uuid][crate::model::StopClusterRequest::cluster_uuid].
8925 ///
8926 /// # Example
8927 /// ```ignore,no_run
8928 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8929 /// let x = StopClusterRequest::new().set_cluster_uuid("example");
8930 /// ```
8931 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8932 self.cluster_uuid = v.into();
8933 self
8934 }
8935
8936 /// Sets the value of [request_id][crate::model::StopClusterRequest::request_id].
8937 ///
8938 /// # Example
8939 /// ```ignore,no_run
8940 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8941 /// let x = StopClusterRequest::new().set_request_id("example");
8942 /// ```
8943 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8944 self.request_id = v.into();
8945 self
8946 }
8947}
8948
8949impl wkt::message::Message for StopClusterRequest {
8950 fn typename() -> &'static str {
8951 "type.googleapis.com/google.cloud.dataproc.v1.StopClusterRequest"
8952 }
8953}
8954
8955/// A request to start a cluster.
8956#[derive(Clone, Default, PartialEq)]
8957#[non_exhaustive]
8958pub struct StartClusterRequest {
8959 /// Required. The ID of the Google Cloud Platform project the
8960 /// cluster belongs to.
8961 pub project_id: std::string::String,
8962
8963 /// Required. The Dataproc region in which to handle the request.
8964 pub region: std::string::String,
8965
8966 /// Required. The cluster name.
8967 pub cluster_name: std::string::String,
8968
8969 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
8970 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
8971 pub cluster_uuid: std::string::String,
8972
8973 /// Optional. A unique ID used to identify the request. If the server
8974 /// receives two
8975 /// [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
8976 /// with the same id, then the second request will be ignored and the
8977 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8978 /// and stored in the backend is returned.
8979 ///
8980 /// Recommendation: Set this value to a
8981 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8982 ///
8983 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8984 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8985 ///
8986 /// [google.longrunning.Operation]: longrunning::model::Operation
8987 pub request_id: std::string::String,
8988
8989 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8990}
8991
8992impl StartClusterRequest {
8993 pub fn new() -> Self {
8994 std::default::Default::default()
8995 }
8996
8997 /// Sets the value of [project_id][crate::model::StartClusterRequest::project_id].
8998 ///
8999 /// # Example
9000 /// ```ignore,no_run
9001 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9002 /// let x = StartClusterRequest::new().set_project_id("example");
9003 /// ```
9004 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9005 self.project_id = v.into();
9006 self
9007 }
9008
9009 /// Sets the value of [region][crate::model::StartClusterRequest::region].
9010 ///
9011 /// # Example
9012 /// ```ignore,no_run
9013 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9014 /// let x = StartClusterRequest::new().set_region("example");
9015 /// ```
9016 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9017 self.region = v.into();
9018 self
9019 }
9020
9021 /// Sets the value of [cluster_name][crate::model::StartClusterRequest::cluster_name].
9022 ///
9023 /// # Example
9024 /// ```ignore,no_run
9025 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9026 /// let x = StartClusterRequest::new().set_cluster_name("example");
9027 /// ```
9028 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9029 self.cluster_name = v.into();
9030 self
9031 }
9032
9033 /// Sets the value of [cluster_uuid][crate::model::StartClusterRequest::cluster_uuid].
9034 ///
9035 /// # Example
9036 /// ```ignore,no_run
9037 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9038 /// let x = StartClusterRequest::new().set_cluster_uuid("example");
9039 /// ```
9040 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9041 self.cluster_uuid = v.into();
9042 self
9043 }
9044
9045 /// Sets the value of [request_id][crate::model::StartClusterRequest::request_id].
9046 ///
9047 /// # Example
9048 /// ```ignore,no_run
9049 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9050 /// let x = StartClusterRequest::new().set_request_id("example");
9051 /// ```
9052 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9053 self.request_id = v.into();
9054 self
9055 }
9056}
9057
9058impl wkt::message::Message for StartClusterRequest {
9059 fn typename() -> &'static str {
9060 "type.googleapis.com/google.cloud.dataproc.v1.StartClusterRequest"
9061 }
9062}
9063
9064/// A request to delete a cluster.
9065#[derive(Clone, Default, PartialEq)]
9066#[non_exhaustive]
9067pub struct DeleteClusterRequest {
9068 /// Required. The ID of the Google Cloud Platform project that the cluster
9069 /// belongs to.
9070 pub project_id: std::string::String,
9071
9072 /// Required. The Dataproc region in which to handle the request.
9073 pub region: std::string::String,
9074
9075 /// Required. The cluster name.
9076 pub cluster_name: std::string::String,
9077
9078 /// Optional. Specifying the `cluster_uuid` means the RPC should fail
9079 /// (with error NOT_FOUND) if cluster with specified UUID does not exist.
9080 pub cluster_uuid: std::string::String,
9081
9082 /// Optional. A unique ID used to identify the request. If the server
9083 /// receives two
9084 /// [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
9085 /// with the same id, then the second request will be ignored and the
9086 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9087 /// and stored in the backend is returned.
9088 ///
9089 /// It is recommended to always set this value to a
9090 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9091 ///
9092 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9093 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9094 ///
9095 /// [google.longrunning.Operation]: longrunning::model::Operation
9096 pub request_id: std::string::String,
9097
9098 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9099}
9100
9101impl DeleteClusterRequest {
9102 pub fn new() -> Self {
9103 std::default::Default::default()
9104 }
9105
9106 /// Sets the value of [project_id][crate::model::DeleteClusterRequest::project_id].
9107 ///
9108 /// # Example
9109 /// ```ignore,no_run
9110 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9111 /// let x = DeleteClusterRequest::new().set_project_id("example");
9112 /// ```
9113 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9114 self.project_id = v.into();
9115 self
9116 }
9117
9118 /// Sets the value of [region][crate::model::DeleteClusterRequest::region].
9119 ///
9120 /// # Example
9121 /// ```ignore,no_run
9122 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9123 /// let x = DeleteClusterRequest::new().set_region("example");
9124 /// ```
9125 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9126 self.region = v.into();
9127 self
9128 }
9129
9130 /// Sets the value of [cluster_name][crate::model::DeleteClusterRequest::cluster_name].
9131 ///
9132 /// # Example
9133 /// ```ignore,no_run
9134 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9135 /// let x = DeleteClusterRequest::new().set_cluster_name("example");
9136 /// ```
9137 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9138 self.cluster_name = v.into();
9139 self
9140 }
9141
9142 /// Sets the value of [cluster_uuid][crate::model::DeleteClusterRequest::cluster_uuid].
9143 ///
9144 /// # Example
9145 /// ```ignore,no_run
9146 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9147 /// let x = DeleteClusterRequest::new().set_cluster_uuid("example");
9148 /// ```
9149 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9150 self.cluster_uuid = v.into();
9151 self
9152 }
9153
9154 /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
9155 ///
9156 /// # Example
9157 /// ```ignore,no_run
9158 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9159 /// let x = DeleteClusterRequest::new().set_request_id("example");
9160 /// ```
9161 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9162 self.request_id = v.into();
9163 self
9164 }
9165}
9166
9167impl wkt::message::Message for DeleteClusterRequest {
9168 fn typename() -> &'static str {
9169 "type.googleapis.com/google.cloud.dataproc.v1.DeleteClusterRequest"
9170 }
9171}
9172
9173/// Request to get the resource representation for a cluster in a project.
9174#[derive(Clone, Default, PartialEq)]
9175#[non_exhaustive]
9176pub struct GetClusterRequest {
9177 /// Required. The ID of the Google Cloud Platform project that the cluster
9178 /// belongs to.
9179 pub project_id: std::string::String,
9180
9181 /// Required. The Dataproc region in which to handle the request.
9182 pub region: std::string::String,
9183
9184 /// Required. The cluster name.
9185 pub cluster_name: std::string::String,
9186
9187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9188}
9189
9190impl GetClusterRequest {
9191 pub fn new() -> Self {
9192 std::default::Default::default()
9193 }
9194
9195 /// Sets the value of [project_id][crate::model::GetClusterRequest::project_id].
9196 ///
9197 /// # Example
9198 /// ```ignore,no_run
9199 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9200 /// let x = GetClusterRequest::new().set_project_id("example");
9201 /// ```
9202 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9203 self.project_id = v.into();
9204 self
9205 }
9206
9207 /// Sets the value of [region][crate::model::GetClusterRequest::region].
9208 ///
9209 /// # Example
9210 /// ```ignore,no_run
9211 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9212 /// let x = GetClusterRequest::new().set_region("example");
9213 /// ```
9214 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9215 self.region = v.into();
9216 self
9217 }
9218
9219 /// Sets the value of [cluster_name][crate::model::GetClusterRequest::cluster_name].
9220 ///
9221 /// # Example
9222 /// ```ignore,no_run
9223 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9224 /// let x = GetClusterRequest::new().set_cluster_name("example");
9225 /// ```
9226 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9227 self.cluster_name = v.into();
9228 self
9229 }
9230}
9231
9232impl wkt::message::Message for GetClusterRequest {
9233 fn typename() -> &'static str {
9234 "type.googleapis.com/google.cloud.dataproc.v1.GetClusterRequest"
9235 }
9236}
9237
9238/// A request to list the clusters in a project.
9239#[derive(Clone, Default, PartialEq)]
9240#[non_exhaustive]
9241pub struct ListClustersRequest {
9242 /// Required. The ID of the Google Cloud Platform project that the cluster
9243 /// belongs to.
9244 pub project_id: std::string::String,
9245
9246 /// Required. The Dataproc region in which to handle the request.
9247 pub region: std::string::String,
9248
9249 /// Optional. A filter constraining the clusters to list. Filters are
9250 /// case-sensitive and have the following syntax:
9251 ///
9252 /// field = value [AND [field = value]] ...
9253 ///
9254 /// where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
9255 /// and `[KEY]` is a label key. **value** can be `*` to match all values.
9256 /// `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
9257 /// `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or
9258 /// `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING`
9259 /// states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and
9260 /// `STOPPED` states. `clusterName` is the name of the cluster provided at
9261 /// creation time. Only the logical `AND` operator is supported;
9262 /// space-separated items are treated as having an implicit `AND` operator.
9263 ///
9264 /// Example filter:
9265 ///
9266 /// status.state = ACTIVE AND clusterName = mycluster
9267 /// AND labels.env = staging AND labels.starred = *
9268 pub filter: std::string::String,
9269
9270 /// Optional. The standard List page size.
9271 pub page_size: i32,
9272
9273 /// Optional. The standard List page token.
9274 pub page_token: std::string::String,
9275
9276 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9277}
9278
9279impl ListClustersRequest {
9280 pub fn new() -> Self {
9281 std::default::Default::default()
9282 }
9283
9284 /// Sets the value of [project_id][crate::model::ListClustersRequest::project_id].
9285 ///
9286 /// # Example
9287 /// ```ignore,no_run
9288 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9289 /// let x = ListClustersRequest::new().set_project_id("example");
9290 /// ```
9291 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9292 self.project_id = v.into();
9293 self
9294 }
9295
9296 /// Sets the value of [region][crate::model::ListClustersRequest::region].
9297 ///
9298 /// # Example
9299 /// ```ignore,no_run
9300 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9301 /// let x = ListClustersRequest::new().set_region("example");
9302 /// ```
9303 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9304 self.region = v.into();
9305 self
9306 }
9307
9308 /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
9309 ///
9310 /// # Example
9311 /// ```ignore,no_run
9312 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9313 /// let x = ListClustersRequest::new().set_filter("example");
9314 /// ```
9315 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9316 self.filter = v.into();
9317 self
9318 }
9319
9320 /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
9321 ///
9322 /// # Example
9323 /// ```ignore,no_run
9324 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9325 /// let x = ListClustersRequest::new().set_page_size(42);
9326 /// ```
9327 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9328 self.page_size = v.into();
9329 self
9330 }
9331
9332 /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
9333 ///
9334 /// # Example
9335 /// ```ignore,no_run
9336 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9337 /// let x = ListClustersRequest::new().set_page_token("example");
9338 /// ```
9339 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9340 self.page_token = v.into();
9341 self
9342 }
9343}
9344
9345impl wkt::message::Message for ListClustersRequest {
9346 fn typename() -> &'static str {
9347 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersRequest"
9348 }
9349}
9350
9351/// The list of all clusters in a project.
9352#[derive(Clone, Default, PartialEq)]
9353#[non_exhaustive]
9354pub struct ListClustersResponse {
9355 /// Output only. The clusters in the project.
9356 pub clusters: std::vec::Vec<crate::model::Cluster>,
9357
9358 /// Output only. This token is included in the response if there are more
9359 /// results to fetch. To fetch additional results, provide this value as the
9360 /// `page_token` in a subsequent `ListClustersRequest`.
9361 pub next_page_token: std::string::String,
9362
9363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9364}
9365
9366impl ListClustersResponse {
9367 pub fn new() -> Self {
9368 std::default::Default::default()
9369 }
9370
9371 /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
9372 ///
9373 /// # Example
9374 /// ```ignore,no_run
9375 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
9376 /// use google_cloud_dataproc_v1::model::Cluster;
9377 /// let x = ListClustersResponse::new()
9378 /// .set_clusters([
9379 /// Cluster::default()/* use setters */,
9380 /// Cluster::default()/* use (different) setters */,
9381 /// ]);
9382 /// ```
9383 pub fn set_clusters<T, V>(mut self, v: T) -> Self
9384 where
9385 T: std::iter::IntoIterator<Item = V>,
9386 V: std::convert::Into<crate::model::Cluster>,
9387 {
9388 use std::iter::Iterator;
9389 self.clusters = v.into_iter().map(|i| i.into()).collect();
9390 self
9391 }
9392
9393 /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
9394 ///
9395 /// # Example
9396 /// ```ignore,no_run
9397 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
9398 /// let x = ListClustersResponse::new().set_next_page_token("example");
9399 /// ```
9400 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9401 self.next_page_token = v.into();
9402 self
9403 }
9404}
9405
9406impl wkt::message::Message for ListClustersResponse {
9407 fn typename() -> &'static str {
9408 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersResponse"
9409 }
9410}
9411
9412#[doc(hidden)]
9413impl gax::paginator::internal::PageableResponse for ListClustersResponse {
9414 type PageItem = crate::model::Cluster;
9415
9416 fn items(self) -> std::vec::Vec<Self::PageItem> {
9417 self.clusters
9418 }
9419
9420 fn next_page_token(&self) -> std::string::String {
9421 use std::clone::Clone;
9422 self.next_page_token.clone()
9423 }
9424}
9425
9426/// A request to collect cluster diagnostic information.
9427#[derive(Clone, Default, PartialEq)]
9428#[non_exhaustive]
9429pub struct DiagnoseClusterRequest {
9430 /// Required. The ID of the Google Cloud Platform project that the cluster
9431 /// belongs to.
9432 pub project_id: std::string::String,
9433
9434 /// Required. The Dataproc region in which to handle the request.
9435 pub region: std::string::String,
9436
9437 /// Required. The cluster name.
9438 pub cluster_name: std::string::String,
9439
9440 /// Optional. (Optional) The output Cloud Storage directory for the diagnostic
9441 /// tarball. If not specified, a task-specific directory in the cluster's
9442 /// staging bucket will be used.
9443 pub tarball_gcs_dir: std::string::String,
9444
9445 /// Optional. (Optional) The access type to the diagnostic tarball. If not
9446 /// specified, falls back to default access of the bucket
9447 pub tarball_access: crate::model::diagnose_cluster_request::TarballAccess,
9448
9449 /// Optional. Time interval in which diagnosis should be carried out on the
9450 /// cluster.
9451 pub diagnosis_interval: std::option::Option<gtype::model::Interval>,
9452
9453 /// Optional. Specifies a list of jobs on which diagnosis is to be performed.
9454 /// Format: projects/{project}/regions/{region}/jobs/{job}
9455 pub jobs: std::vec::Vec<std::string::String>,
9456
9457 /// Optional. Specifies a list of yarn applications on which diagnosis is to be
9458 /// performed.
9459 pub yarn_application_ids: std::vec::Vec<std::string::String>,
9460
9461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9462}
9463
9464impl DiagnoseClusterRequest {
9465 pub fn new() -> Self {
9466 std::default::Default::default()
9467 }
9468
9469 /// Sets the value of [project_id][crate::model::DiagnoseClusterRequest::project_id].
9470 ///
9471 /// # Example
9472 /// ```ignore,no_run
9473 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9474 /// let x = DiagnoseClusterRequest::new().set_project_id("example");
9475 /// ```
9476 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9477 self.project_id = v.into();
9478 self
9479 }
9480
9481 /// Sets the value of [region][crate::model::DiagnoseClusterRequest::region].
9482 ///
9483 /// # Example
9484 /// ```ignore,no_run
9485 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9486 /// let x = DiagnoseClusterRequest::new().set_region("example");
9487 /// ```
9488 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9489 self.region = v.into();
9490 self
9491 }
9492
9493 /// Sets the value of [cluster_name][crate::model::DiagnoseClusterRequest::cluster_name].
9494 ///
9495 /// # Example
9496 /// ```ignore,no_run
9497 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9498 /// let x = DiagnoseClusterRequest::new().set_cluster_name("example");
9499 /// ```
9500 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9501 self.cluster_name = v.into();
9502 self
9503 }
9504
9505 /// Sets the value of [tarball_gcs_dir][crate::model::DiagnoseClusterRequest::tarball_gcs_dir].
9506 ///
9507 /// # Example
9508 /// ```ignore,no_run
9509 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9510 /// let x = DiagnoseClusterRequest::new().set_tarball_gcs_dir("example");
9511 /// ```
9512 pub fn set_tarball_gcs_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9513 self.tarball_gcs_dir = v.into();
9514 self
9515 }
9516
9517 /// Sets the value of [tarball_access][crate::model::DiagnoseClusterRequest::tarball_access].
9518 ///
9519 /// # Example
9520 /// ```ignore,no_run
9521 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9522 /// use google_cloud_dataproc_v1::model::diagnose_cluster_request::TarballAccess;
9523 /// let x0 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleCloudSupport);
9524 /// let x1 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleDataprocDiagnose);
9525 /// ```
9526 pub fn set_tarball_access<
9527 T: std::convert::Into<crate::model::diagnose_cluster_request::TarballAccess>,
9528 >(
9529 mut self,
9530 v: T,
9531 ) -> Self {
9532 self.tarball_access = v.into();
9533 self
9534 }
9535
9536 /// Sets the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
9537 ///
9538 /// # Example
9539 /// ```ignore,no_run
9540 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9541 /// use gtype::model::Interval;
9542 /// let x = DiagnoseClusterRequest::new().set_diagnosis_interval(Interval::default()/* use setters */);
9543 /// ```
9544 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
9545 where
9546 T: std::convert::Into<gtype::model::Interval>,
9547 {
9548 self.diagnosis_interval = std::option::Option::Some(v.into());
9549 self
9550 }
9551
9552 /// Sets or clears the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
9553 ///
9554 /// # Example
9555 /// ```ignore,no_run
9556 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9557 /// use gtype::model::Interval;
9558 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(Some(Interval::default()/* use setters */));
9559 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(None::<Interval>);
9560 /// ```
9561 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
9562 where
9563 T: std::convert::Into<gtype::model::Interval>,
9564 {
9565 self.diagnosis_interval = v.map(|x| x.into());
9566 self
9567 }
9568
9569 /// Sets the value of [jobs][crate::model::DiagnoseClusterRequest::jobs].
9570 ///
9571 /// # Example
9572 /// ```ignore,no_run
9573 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9574 /// let x = DiagnoseClusterRequest::new().set_jobs(["a", "b", "c"]);
9575 /// ```
9576 pub fn set_jobs<T, V>(mut self, v: T) -> Self
9577 where
9578 T: std::iter::IntoIterator<Item = V>,
9579 V: std::convert::Into<std::string::String>,
9580 {
9581 use std::iter::Iterator;
9582 self.jobs = v.into_iter().map(|i| i.into()).collect();
9583 self
9584 }
9585
9586 /// Sets the value of [yarn_application_ids][crate::model::DiagnoseClusterRequest::yarn_application_ids].
9587 ///
9588 /// # Example
9589 /// ```ignore,no_run
9590 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9591 /// let x = DiagnoseClusterRequest::new().set_yarn_application_ids(["a", "b", "c"]);
9592 /// ```
9593 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
9594 where
9595 T: std::iter::IntoIterator<Item = V>,
9596 V: std::convert::Into<std::string::String>,
9597 {
9598 use std::iter::Iterator;
9599 self.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
9600 self
9601 }
9602}
9603
9604impl wkt::message::Message for DiagnoseClusterRequest {
9605 fn typename() -> &'static str {
9606 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterRequest"
9607 }
9608}
9609
9610/// Defines additional types related to [DiagnoseClusterRequest].
9611pub mod diagnose_cluster_request {
9612 #[allow(unused_imports)]
9613 use super::*;
9614
9615 /// Defines who has access to the diagnostic tarball
9616 ///
9617 /// # Working with unknown values
9618 ///
9619 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9620 /// additional enum variants at any time. Adding new variants is not considered
9621 /// a breaking change. Applications should write their code in anticipation of:
9622 ///
9623 /// - New values appearing in future releases of the client library, **and**
9624 /// - New values received dynamically, without application changes.
9625 ///
9626 /// Please consult the [Working with enums] section in the user guide for some
9627 /// guidelines.
9628 ///
9629 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9630 #[derive(Clone, Debug, PartialEq)]
9631 #[non_exhaustive]
9632 pub enum TarballAccess {
9633 /// Tarball Access unspecified. Falls back to default access of the bucket
9634 Unspecified,
9635 /// Google Cloud Support group has read access to the
9636 /// diagnostic tarball
9637 GoogleCloudSupport,
9638 /// Google Cloud Dataproc Diagnose service account has read access to the
9639 /// diagnostic tarball
9640 GoogleDataprocDiagnose,
9641 /// If set, the enum was initialized with an unknown value.
9642 ///
9643 /// Applications can examine the value using [TarballAccess::value] or
9644 /// [TarballAccess::name].
9645 UnknownValue(tarball_access::UnknownValue),
9646 }
9647
9648 #[doc(hidden)]
9649 pub mod tarball_access {
9650 #[allow(unused_imports)]
9651 use super::*;
9652 #[derive(Clone, Debug, PartialEq)]
9653 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9654 }
9655
9656 impl TarballAccess {
9657 /// Gets the enum value.
9658 ///
9659 /// Returns `None` if the enum contains an unknown value deserialized from
9660 /// the string representation of enums.
9661 pub fn value(&self) -> std::option::Option<i32> {
9662 match self {
9663 Self::Unspecified => std::option::Option::Some(0),
9664 Self::GoogleCloudSupport => std::option::Option::Some(1),
9665 Self::GoogleDataprocDiagnose => std::option::Option::Some(2),
9666 Self::UnknownValue(u) => u.0.value(),
9667 }
9668 }
9669
9670 /// Gets the enum value as a string.
9671 ///
9672 /// Returns `None` if the enum contains an unknown value deserialized from
9673 /// the integer representation of enums.
9674 pub fn name(&self) -> std::option::Option<&str> {
9675 match self {
9676 Self::Unspecified => std::option::Option::Some("TARBALL_ACCESS_UNSPECIFIED"),
9677 Self::GoogleCloudSupport => std::option::Option::Some("GOOGLE_CLOUD_SUPPORT"),
9678 Self::GoogleDataprocDiagnose => {
9679 std::option::Option::Some("GOOGLE_DATAPROC_DIAGNOSE")
9680 }
9681 Self::UnknownValue(u) => u.0.name(),
9682 }
9683 }
9684 }
9685
9686 impl std::default::Default for TarballAccess {
9687 fn default() -> Self {
9688 use std::convert::From;
9689 Self::from(0)
9690 }
9691 }
9692
9693 impl std::fmt::Display for TarballAccess {
9694 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9695 wkt::internal::display_enum(f, self.name(), self.value())
9696 }
9697 }
9698
9699 impl std::convert::From<i32> for TarballAccess {
9700 fn from(value: i32) -> Self {
9701 match value {
9702 0 => Self::Unspecified,
9703 1 => Self::GoogleCloudSupport,
9704 2 => Self::GoogleDataprocDiagnose,
9705 _ => Self::UnknownValue(tarball_access::UnknownValue(
9706 wkt::internal::UnknownEnumValue::Integer(value),
9707 )),
9708 }
9709 }
9710 }
9711
9712 impl std::convert::From<&str> for TarballAccess {
9713 fn from(value: &str) -> Self {
9714 use std::string::ToString;
9715 match value {
9716 "TARBALL_ACCESS_UNSPECIFIED" => Self::Unspecified,
9717 "GOOGLE_CLOUD_SUPPORT" => Self::GoogleCloudSupport,
9718 "GOOGLE_DATAPROC_DIAGNOSE" => Self::GoogleDataprocDiagnose,
9719 _ => Self::UnknownValue(tarball_access::UnknownValue(
9720 wkt::internal::UnknownEnumValue::String(value.to_string()),
9721 )),
9722 }
9723 }
9724 }
9725
9726 impl serde::ser::Serialize for TarballAccess {
9727 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9728 where
9729 S: serde::Serializer,
9730 {
9731 match self {
9732 Self::Unspecified => serializer.serialize_i32(0),
9733 Self::GoogleCloudSupport => serializer.serialize_i32(1),
9734 Self::GoogleDataprocDiagnose => serializer.serialize_i32(2),
9735 Self::UnknownValue(u) => u.0.serialize(serializer),
9736 }
9737 }
9738 }
9739
9740 impl<'de> serde::de::Deserialize<'de> for TarballAccess {
9741 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9742 where
9743 D: serde::Deserializer<'de>,
9744 {
9745 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TarballAccess>::new(
9746 ".google.cloud.dataproc.v1.DiagnoseClusterRequest.TarballAccess",
9747 ))
9748 }
9749 }
9750}
9751
9752/// The location of diagnostic output.
9753#[derive(Clone, Default, PartialEq)]
9754#[non_exhaustive]
9755pub struct DiagnoseClusterResults {
9756 /// Output only. The Cloud Storage URI of the diagnostic output.
9757 /// The output report is a plain text file with a summary of collected
9758 /// diagnostics.
9759 pub output_uri: std::string::String,
9760
9761 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9762}
9763
9764impl DiagnoseClusterResults {
9765 pub fn new() -> Self {
9766 std::default::Default::default()
9767 }
9768
9769 /// Sets the value of [output_uri][crate::model::DiagnoseClusterResults::output_uri].
9770 ///
9771 /// # Example
9772 /// ```ignore,no_run
9773 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterResults;
9774 /// let x = DiagnoseClusterResults::new().set_output_uri("example");
9775 /// ```
9776 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9777 self.output_uri = v.into();
9778 self
9779 }
9780}
9781
9782impl wkt::message::Message for DiagnoseClusterResults {
9783 fn typename() -> &'static str {
9784 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterResults"
9785 }
9786}
9787
9788/// Reservation Affinity for consuming Zonal reservation.
9789#[derive(Clone, Default, PartialEq)]
9790#[non_exhaustive]
9791pub struct ReservationAffinity {
9792 /// Optional. Type of reservation to consume
9793 pub consume_reservation_type: crate::model::reservation_affinity::Type,
9794
9795 /// Optional. Corresponds to the label key of reservation resource.
9796 pub key: std::string::String,
9797
9798 /// Optional. Corresponds to the label values of reservation resource.
9799 pub values: std::vec::Vec<std::string::String>,
9800
9801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9802}
9803
9804impl ReservationAffinity {
9805 pub fn new() -> Self {
9806 std::default::Default::default()
9807 }
9808
9809 /// Sets the value of [consume_reservation_type][crate::model::ReservationAffinity::consume_reservation_type].
9810 ///
9811 /// # Example
9812 /// ```ignore,no_run
9813 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
9814 /// use google_cloud_dataproc_v1::model::reservation_affinity::Type;
9815 /// let x0 = ReservationAffinity::new().set_consume_reservation_type(Type::NoReservation);
9816 /// let x1 = ReservationAffinity::new().set_consume_reservation_type(Type::AnyReservation);
9817 /// let x2 = ReservationAffinity::new().set_consume_reservation_type(Type::SpecificReservation);
9818 /// ```
9819 pub fn set_consume_reservation_type<
9820 T: std::convert::Into<crate::model::reservation_affinity::Type>,
9821 >(
9822 mut self,
9823 v: T,
9824 ) -> Self {
9825 self.consume_reservation_type = v.into();
9826 self
9827 }
9828
9829 /// Sets the value of [key][crate::model::ReservationAffinity::key].
9830 ///
9831 /// # Example
9832 /// ```ignore,no_run
9833 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
9834 /// let x = ReservationAffinity::new().set_key("example");
9835 /// ```
9836 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9837 self.key = v.into();
9838 self
9839 }
9840
9841 /// Sets the value of [values][crate::model::ReservationAffinity::values].
9842 ///
9843 /// # Example
9844 /// ```ignore,no_run
9845 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
9846 /// let x = ReservationAffinity::new().set_values(["a", "b", "c"]);
9847 /// ```
9848 pub fn set_values<T, V>(mut self, v: T) -> Self
9849 where
9850 T: std::iter::IntoIterator<Item = V>,
9851 V: std::convert::Into<std::string::String>,
9852 {
9853 use std::iter::Iterator;
9854 self.values = v.into_iter().map(|i| i.into()).collect();
9855 self
9856 }
9857}
9858
9859impl wkt::message::Message for ReservationAffinity {
9860 fn typename() -> &'static str {
9861 "type.googleapis.com/google.cloud.dataproc.v1.ReservationAffinity"
9862 }
9863}
9864
9865/// Defines additional types related to [ReservationAffinity].
9866pub mod reservation_affinity {
9867 #[allow(unused_imports)]
9868 use super::*;
9869
9870 /// Indicates whether to consume capacity from an reservation or not.
9871 ///
9872 /// # Working with unknown values
9873 ///
9874 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9875 /// additional enum variants at any time. Adding new variants is not considered
9876 /// a breaking change. Applications should write their code in anticipation of:
9877 ///
9878 /// - New values appearing in future releases of the client library, **and**
9879 /// - New values received dynamically, without application changes.
9880 ///
9881 /// Please consult the [Working with enums] section in the user guide for some
9882 /// guidelines.
9883 ///
9884 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9885 #[derive(Clone, Debug, PartialEq)]
9886 #[non_exhaustive]
9887 pub enum Type {
9888 Unspecified,
9889 /// Do not consume from any allocated capacity.
9890 NoReservation,
9891 /// Consume any reservation available.
9892 AnyReservation,
9893 /// Must consume from a specific reservation. Must specify key value fields
9894 /// for specifying the reservations.
9895 SpecificReservation,
9896 /// If set, the enum was initialized with an unknown value.
9897 ///
9898 /// Applications can examine the value using [Type::value] or
9899 /// [Type::name].
9900 UnknownValue(r#type::UnknownValue),
9901 }
9902
9903 #[doc(hidden)]
9904 pub mod r#type {
9905 #[allow(unused_imports)]
9906 use super::*;
9907 #[derive(Clone, Debug, PartialEq)]
9908 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9909 }
9910
9911 impl Type {
9912 /// Gets the enum value.
9913 ///
9914 /// Returns `None` if the enum contains an unknown value deserialized from
9915 /// the string representation of enums.
9916 pub fn value(&self) -> std::option::Option<i32> {
9917 match self {
9918 Self::Unspecified => std::option::Option::Some(0),
9919 Self::NoReservation => std::option::Option::Some(1),
9920 Self::AnyReservation => std::option::Option::Some(2),
9921 Self::SpecificReservation => std::option::Option::Some(3),
9922 Self::UnknownValue(u) => u.0.value(),
9923 }
9924 }
9925
9926 /// Gets the enum value as a string.
9927 ///
9928 /// Returns `None` if the enum contains an unknown value deserialized from
9929 /// the integer representation of enums.
9930 pub fn name(&self) -> std::option::Option<&str> {
9931 match self {
9932 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
9933 Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
9934 Self::AnyReservation => std::option::Option::Some("ANY_RESERVATION"),
9935 Self::SpecificReservation => std::option::Option::Some("SPECIFIC_RESERVATION"),
9936 Self::UnknownValue(u) => u.0.name(),
9937 }
9938 }
9939 }
9940
9941 impl std::default::Default for Type {
9942 fn default() -> Self {
9943 use std::convert::From;
9944 Self::from(0)
9945 }
9946 }
9947
9948 impl std::fmt::Display for Type {
9949 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9950 wkt::internal::display_enum(f, self.name(), self.value())
9951 }
9952 }
9953
9954 impl std::convert::From<i32> for Type {
9955 fn from(value: i32) -> Self {
9956 match value {
9957 0 => Self::Unspecified,
9958 1 => Self::NoReservation,
9959 2 => Self::AnyReservation,
9960 3 => Self::SpecificReservation,
9961 _ => Self::UnknownValue(r#type::UnknownValue(
9962 wkt::internal::UnknownEnumValue::Integer(value),
9963 )),
9964 }
9965 }
9966 }
9967
9968 impl std::convert::From<&str> for Type {
9969 fn from(value: &str) -> Self {
9970 use std::string::ToString;
9971 match value {
9972 "TYPE_UNSPECIFIED" => Self::Unspecified,
9973 "NO_RESERVATION" => Self::NoReservation,
9974 "ANY_RESERVATION" => Self::AnyReservation,
9975 "SPECIFIC_RESERVATION" => Self::SpecificReservation,
9976 _ => Self::UnknownValue(r#type::UnknownValue(
9977 wkt::internal::UnknownEnumValue::String(value.to_string()),
9978 )),
9979 }
9980 }
9981 }
9982
9983 impl serde::ser::Serialize for Type {
9984 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9985 where
9986 S: serde::Serializer,
9987 {
9988 match self {
9989 Self::Unspecified => serializer.serialize_i32(0),
9990 Self::NoReservation => serializer.serialize_i32(1),
9991 Self::AnyReservation => serializer.serialize_i32(2),
9992 Self::SpecificReservation => serializer.serialize_i32(3),
9993 Self::UnknownValue(u) => u.0.serialize(serializer),
9994 }
9995 }
9996 }
9997
9998 impl<'de> serde::de::Deserialize<'de> for Type {
9999 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10000 where
10001 D: serde::Deserializer<'de>,
10002 {
10003 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
10004 ".google.cloud.dataproc.v1.ReservationAffinity.Type",
10005 ))
10006 }
10007 }
10008}
10009
10010/// The runtime logging config of the job.
10011#[derive(Clone, Default, PartialEq)]
10012#[non_exhaustive]
10013pub struct LoggingConfig {
10014 /// The per-package log levels for the driver. This can include
10015 /// "root" package name to configure rootLogger.
10016 /// Examples:
10017 ///
10018 /// - 'com.google = FATAL'
10019 /// - 'root = INFO'
10020 /// - 'org.apache = DEBUG'
10021 pub driver_log_levels:
10022 std::collections::HashMap<std::string::String, crate::model::logging_config::Level>,
10023
10024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10025}
10026
10027impl LoggingConfig {
10028 pub fn new() -> Self {
10029 std::default::Default::default()
10030 }
10031
10032 /// Sets the value of [driver_log_levels][crate::model::LoggingConfig::driver_log_levels].
10033 ///
10034 /// # Example
10035 /// ```ignore,no_run
10036 /// # use google_cloud_dataproc_v1::model::LoggingConfig;
10037 /// use google_cloud_dataproc_v1::model::logging_config::Level;
10038 /// let x = LoggingConfig::new().set_driver_log_levels([
10039 /// ("key0", Level::All),
10040 /// ("key1", Level::Trace),
10041 /// ("key2", Level::Debug),
10042 /// ]);
10043 /// ```
10044 pub fn set_driver_log_levels<T, K, V>(mut self, v: T) -> Self
10045 where
10046 T: std::iter::IntoIterator<Item = (K, V)>,
10047 K: std::convert::Into<std::string::String>,
10048 V: std::convert::Into<crate::model::logging_config::Level>,
10049 {
10050 use std::iter::Iterator;
10051 self.driver_log_levels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10052 self
10053 }
10054}
10055
10056impl wkt::message::Message for LoggingConfig {
10057 fn typename() -> &'static str {
10058 "type.googleapis.com/google.cloud.dataproc.v1.LoggingConfig"
10059 }
10060}
10061
10062/// Defines additional types related to [LoggingConfig].
10063pub mod logging_config {
10064 #[allow(unused_imports)]
10065 use super::*;
10066
10067 /// The Log4j level for job execution. When running an
10068 /// [Apache Hive](https://hive.apache.org/) job, Cloud
10069 /// Dataproc configures the Hive client to an equivalent verbosity level.
10070 ///
10071 /// # Working with unknown values
10072 ///
10073 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10074 /// additional enum variants at any time. Adding new variants is not considered
10075 /// a breaking change. Applications should write their code in anticipation of:
10076 ///
10077 /// - New values appearing in future releases of the client library, **and**
10078 /// - New values received dynamically, without application changes.
10079 ///
10080 /// Please consult the [Working with enums] section in the user guide for some
10081 /// guidelines.
10082 ///
10083 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10084 #[derive(Clone, Debug, PartialEq)]
10085 #[non_exhaustive]
10086 pub enum Level {
10087 /// Level is unspecified. Use default level for log4j.
10088 Unspecified,
10089 /// Use ALL level for log4j.
10090 All,
10091 /// Use TRACE level for log4j.
10092 Trace,
10093 /// Use DEBUG level for log4j.
10094 Debug,
10095 /// Use INFO level for log4j.
10096 Info,
10097 /// Use WARN level for log4j.
10098 Warn,
10099 /// Use ERROR level for log4j.
10100 Error,
10101 /// Use FATAL level for log4j.
10102 Fatal,
10103 /// Turn off log4j.
10104 Off,
10105 /// If set, the enum was initialized with an unknown value.
10106 ///
10107 /// Applications can examine the value using [Level::value] or
10108 /// [Level::name].
10109 UnknownValue(level::UnknownValue),
10110 }
10111
10112 #[doc(hidden)]
10113 pub mod level {
10114 #[allow(unused_imports)]
10115 use super::*;
10116 #[derive(Clone, Debug, PartialEq)]
10117 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10118 }
10119
10120 impl Level {
10121 /// Gets the enum value.
10122 ///
10123 /// Returns `None` if the enum contains an unknown value deserialized from
10124 /// the string representation of enums.
10125 pub fn value(&self) -> std::option::Option<i32> {
10126 match self {
10127 Self::Unspecified => std::option::Option::Some(0),
10128 Self::All => std::option::Option::Some(1),
10129 Self::Trace => std::option::Option::Some(2),
10130 Self::Debug => std::option::Option::Some(3),
10131 Self::Info => std::option::Option::Some(4),
10132 Self::Warn => std::option::Option::Some(5),
10133 Self::Error => std::option::Option::Some(6),
10134 Self::Fatal => std::option::Option::Some(7),
10135 Self::Off => std::option::Option::Some(8),
10136 Self::UnknownValue(u) => u.0.value(),
10137 }
10138 }
10139
10140 /// Gets the enum value as a string.
10141 ///
10142 /// Returns `None` if the enum contains an unknown value deserialized from
10143 /// the integer representation of enums.
10144 pub fn name(&self) -> std::option::Option<&str> {
10145 match self {
10146 Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
10147 Self::All => std::option::Option::Some("ALL"),
10148 Self::Trace => std::option::Option::Some("TRACE"),
10149 Self::Debug => std::option::Option::Some("DEBUG"),
10150 Self::Info => std::option::Option::Some("INFO"),
10151 Self::Warn => std::option::Option::Some("WARN"),
10152 Self::Error => std::option::Option::Some("ERROR"),
10153 Self::Fatal => std::option::Option::Some("FATAL"),
10154 Self::Off => std::option::Option::Some("OFF"),
10155 Self::UnknownValue(u) => u.0.name(),
10156 }
10157 }
10158 }
10159
10160 impl std::default::Default for Level {
10161 fn default() -> Self {
10162 use std::convert::From;
10163 Self::from(0)
10164 }
10165 }
10166
10167 impl std::fmt::Display for Level {
10168 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10169 wkt::internal::display_enum(f, self.name(), self.value())
10170 }
10171 }
10172
10173 impl std::convert::From<i32> for Level {
10174 fn from(value: i32) -> Self {
10175 match value {
10176 0 => Self::Unspecified,
10177 1 => Self::All,
10178 2 => Self::Trace,
10179 3 => Self::Debug,
10180 4 => Self::Info,
10181 5 => Self::Warn,
10182 6 => Self::Error,
10183 7 => Self::Fatal,
10184 8 => Self::Off,
10185 _ => Self::UnknownValue(level::UnknownValue(
10186 wkt::internal::UnknownEnumValue::Integer(value),
10187 )),
10188 }
10189 }
10190 }
10191
10192 impl std::convert::From<&str> for Level {
10193 fn from(value: &str) -> Self {
10194 use std::string::ToString;
10195 match value {
10196 "LEVEL_UNSPECIFIED" => Self::Unspecified,
10197 "ALL" => Self::All,
10198 "TRACE" => Self::Trace,
10199 "DEBUG" => Self::Debug,
10200 "INFO" => Self::Info,
10201 "WARN" => Self::Warn,
10202 "ERROR" => Self::Error,
10203 "FATAL" => Self::Fatal,
10204 "OFF" => Self::Off,
10205 _ => Self::UnknownValue(level::UnknownValue(
10206 wkt::internal::UnknownEnumValue::String(value.to_string()),
10207 )),
10208 }
10209 }
10210 }
10211
10212 impl serde::ser::Serialize for Level {
10213 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10214 where
10215 S: serde::Serializer,
10216 {
10217 match self {
10218 Self::Unspecified => serializer.serialize_i32(0),
10219 Self::All => serializer.serialize_i32(1),
10220 Self::Trace => serializer.serialize_i32(2),
10221 Self::Debug => serializer.serialize_i32(3),
10222 Self::Info => serializer.serialize_i32(4),
10223 Self::Warn => serializer.serialize_i32(5),
10224 Self::Error => serializer.serialize_i32(6),
10225 Self::Fatal => serializer.serialize_i32(7),
10226 Self::Off => serializer.serialize_i32(8),
10227 Self::UnknownValue(u) => u.0.serialize(serializer),
10228 }
10229 }
10230 }
10231
10232 impl<'de> serde::de::Deserialize<'de> for Level {
10233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10234 where
10235 D: serde::Deserializer<'de>,
10236 {
10237 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
10238 ".google.cloud.dataproc.v1.LoggingConfig.Level",
10239 ))
10240 }
10241 }
10242}
10243
10244/// A Dataproc job for running
10245/// [Apache Hadoop
10246/// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html)
10247/// jobs on [Apache Hadoop
10248/// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).
10249#[derive(Clone, Default, PartialEq)]
10250#[non_exhaustive]
10251pub struct HadoopJob {
10252 /// Optional. The arguments to pass to the driver. Do not
10253 /// include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as
10254 /// job properties, since a collision might occur that causes an incorrect job
10255 /// submission.
10256 pub args: std::vec::Vec<std::string::String>,
10257
10258 /// Optional. Jar file URIs to add to the CLASSPATHs of the
10259 /// Hadoop driver and tasks.
10260 pub jar_file_uris: std::vec::Vec<std::string::String>,
10261
10262 /// Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied
10263 /// to the working directory of Hadoop drivers and distributed tasks. Useful
10264 /// for naively parallel tasks.
10265 pub file_uris: std::vec::Vec<std::string::String>,
10266
10267 /// Optional. HCFS URIs of archives to be extracted in the working directory of
10268 /// Hadoop drivers and tasks. Supported file types:
10269 /// .jar, .tar, .tar.gz, .tgz, or .zip.
10270 pub archive_uris: std::vec::Vec<std::string::String>,
10271
10272 /// Optional. A mapping of property names to values, used to configure Hadoop.
10273 /// Properties that conflict with values set by the Dataproc API might be
10274 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and
10275 /// classes in user code.
10276 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10277
10278 /// Optional. The runtime log config for job execution.
10279 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10280
10281 /// Required. Indicates the location of the driver's main class. Specify
10282 /// either the jar file that contains the main class or the main class name.
10283 /// To specify both, add the jar file to `jar_file_uris`, and then specify
10284 /// the main class name in this property.
10285 pub driver: std::option::Option<crate::model::hadoop_job::Driver>,
10286
10287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10288}
10289
10290impl HadoopJob {
10291 pub fn new() -> Self {
10292 std::default::Default::default()
10293 }
10294
10295 /// Sets the value of [args][crate::model::HadoopJob::args].
10296 ///
10297 /// # Example
10298 /// ```ignore,no_run
10299 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10300 /// let x = HadoopJob::new().set_args(["a", "b", "c"]);
10301 /// ```
10302 pub fn set_args<T, V>(mut self, v: T) -> Self
10303 where
10304 T: std::iter::IntoIterator<Item = V>,
10305 V: std::convert::Into<std::string::String>,
10306 {
10307 use std::iter::Iterator;
10308 self.args = v.into_iter().map(|i| i.into()).collect();
10309 self
10310 }
10311
10312 /// Sets the value of [jar_file_uris][crate::model::HadoopJob::jar_file_uris].
10313 ///
10314 /// # Example
10315 /// ```ignore,no_run
10316 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10317 /// let x = HadoopJob::new().set_jar_file_uris(["a", "b", "c"]);
10318 /// ```
10319 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10320 where
10321 T: std::iter::IntoIterator<Item = V>,
10322 V: std::convert::Into<std::string::String>,
10323 {
10324 use std::iter::Iterator;
10325 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10326 self
10327 }
10328
10329 /// Sets the value of [file_uris][crate::model::HadoopJob::file_uris].
10330 ///
10331 /// # Example
10332 /// ```ignore,no_run
10333 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10334 /// let x = HadoopJob::new().set_file_uris(["a", "b", "c"]);
10335 /// ```
10336 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10337 where
10338 T: std::iter::IntoIterator<Item = V>,
10339 V: std::convert::Into<std::string::String>,
10340 {
10341 use std::iter::Iterator;
10342 self.file_uris = v.into_iter().map(|i| i.into()).collect();
10343 self
10344 }
10345
10346 /// Sets the value of [archive_uris][crate::model::HadoopJob::archive_uris].
10347 ///
10348 /// # Example
10349 /// ```ignore,no_run
10350 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10351 /// let x = HadoopJob::new().set_archive_uris(["a", "b", "c"]);
10352 /// ```
10353 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10354 where
10355 T: std::iter::IntoIterator<Item = V>,
10356 V: std::convert::Into<std::string::String>,
10357 {
10358 use std::iter::Iterator;
10359 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10360 self
10361 }
10362
10363 /// Sets the value of [properties][crate::model::HadoopJob::properties].
10364 ///
10365 /// # Example
10366 /// ```ignore,no_run
10367 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10368 /// let x = HadoopJob::new().set_properties([
10369 /// ("key0", "abc"),
10370 /// ("key1", "xyz"),
10371 /// ]);
10372 /// ```
10373 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10374 where
10375 T: std::iter::IntoIterator<Item = (K, V)>,
10376 K: std::convert::Into<std::string::String>,
10377 V: std::convert::Into<std::string::String>,
10378 {
10379 use std::iter::Iterator;
10380 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10381 self
10382 }
10383
10384 /// Sets the value of [logging_config][crate::model::HadoopJob::logging_config].
10385 ///
10386 /// # Example
10387 /// ```ignore,no_run
10388 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10389 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10390 /// let x = HadoopJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10391 /// ```
10392 pub fn set_logging_config<T>(mut self, v: T) -> Self
10393 where
10394 T: std::convert::Into<crate::model::LoggingConfig>,
10395 {
10396 self.logging_config = std::option::Option::Some(v.into());
10397 self
10398 }
10399
10400 /// Sets or clears the value of [logging_config][crate::model::HadoopJob::logging_config].
10401 ///
10402 /// # Example
10403 /// ```ignore,no_run
10404 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10405 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10406 /// let x = HadoopJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
10407 /// let x = HadoopJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
10408 /// ```
10409 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
10410 where
10411 T: std::convert::Into<crate::model::LoggingConfig>,
10412 {
10413 self.logging_config = v.map(|x| x.into());
10414 self
10415 }
10416
10417 /// Sets the value of [driver][crate::model::HadoopJob::driver].
10418 ///
10419 /// Note that all the setters affecting `driver` are mutually
10420 /// exclusive.
10421 ///
10422 /// # Example
10423 /// ```ignore,no_run
10424 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10425 /// use google_cloud_dataproc_v1::model::hadoop_job::Driver;
10426 /// let x = HadoopJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
10427 /// ```
10428 pub fn set_driver<
10429 T: std::convert::Into<std::option::Option<crate::model::hadoop_job::Driver>>,
10430 >(
10431 mut self,
10432 v: T,
10433 ) -> Self {
10434 self.driver = v.into();
10435 self
10436 }
10437
10438 /// The value of [driver][crate::model::HadoopJob::driver]
10439 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
10440 /// holds a different branch.
10441 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
10442 #[allow(unreachable_patterns)]
10443 self.driver.as_ref().and_then(|v| match v {
10444 crate::model::hadoop_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
10445 _ => std::option::Option::None,
10446 })
10447 }
10448
10449 /// Sets the value of [driver][crate::model::HadoopJob::driver]
10450 /// to hold a `MainJarFileUri`.
10451 ///
10452 /// Note that all the setters affecting `driver` are
10453 /// mutually exclusive.
10454 ///
10455 /// # Example
10456 /// ```ignore,no_run
10457 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10458 /// let x = HadoopJob::new().set_main_jar_file_uri("example");
10459 /// assert!(x.main_jar_file_uri().is_some());
10460 /// assert!(x.main_class().is_none());
10461 /// ```
10462 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
10463 mut self,
10464 v: T,
10465 ) -> Self {
10466 self.driver =
10467 std::option::Option::Some(crate::model::hadoop_job::Driver::MainJarFileUri(v.into()));
10468 self
10469 }
10470
10471 /// The value of [driver][crate::model::HadoopJob::driver]
10472 /// if it holds a `MainClass`, `None` if the field is not set or
10473 /// holds a different branch.
10474 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
10475 #[allow(unreachable_patterns)]
10476 self.driver.as_ref().and_then(|v| match v {
10477 crate::model::hadoop_job::Driver::MainClass(v) => std::option::Option::Some(v),
10478 _ => std::option::Option::None,
10479 })
10480 }
10481
10482 /// Sets the value of [driver][crate::model::HadoopJob::driver]
10483 /// to hold a `MainClass`.
10484 ///
10485 /// Note that all the setters affecting `driver` are
10486 /// mutually exclusive.
10487 ///
10488 /// # Example
10489 /// ```ignore,no_run
10490 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10491 /// let x = HadoopJob::new().set_main_class("example");
10492 /// assert!(x.main_class().is_some());
10493 /// assert!(x.main_jar_file_uri().is_none());
10494 /// ```
10495 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10496 self.driver =
10497 std::option::Option::Some(crate::model::hadoop_job::Driver::MainClass(v.into()));
10498 self
10499 }
10500}
10501
10502impl wkt::message::Message for HadoopJob {
10503 fn typename() -> &'static str {
10504 "type.googleapis.com/google.cloud.dataproc.v1.HadoopJob"
10505 }
10506}
10507
10508/// Defines additional types related to [HadoopJob].
10509pub mod hadoop_job {
10510 #[allow(unused_imports)]
10511 use super::*;
10512
10513 /// Required. Indicates the location of the driver's main class. Specify
10514 /// either the jar file that contains the main class or the main class name.
10515 /// To specify both, add the jar file to `jar_file_uris`, and then specify
10516 /// the main class name in this property.
10517 #[derive(Clone, Debug, PartialEq)]
10518 #[non_exhaustive]
10519 pub enum Driver {
10520 /// The HCFS URI of the jar file containing the main class.
10521 /// Examples:
10522 /// 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar'
10523 /// 'hdfs:/tmp/test-samples/custom-wordcount.jar'
10524 /// 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar'
10525 MainJarFileUri(std::string::String),
10526 /// The name of the driver's main class. The jar file containing the class
10527 /// must be in the default CLASSPATH or specified in `jar_file_uris`.
10528 MainClass(std::string::String),
10529 }
10530}
10531
10532/// A Dataproc job for running [Apache Spark](https://spark.apache.org/)
10533/// applications on YARN.
10534#[derive(Clone, Default, PartialEq)]
10535#[non_exhaustive]
10536pub struct SparkJob {
10537 /// Optional. The arguments to pass to the driver. Do not include arguments,
10538 /// such as `--conf`, that can be set as job properties, since a collision may
10539 /// occur that causes an incorrect job submission.
10540 pub args: std::vec::Vec<std::string::String>,
10541
10542 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
10543 /// Spark driver and tasks.
10544 pub jar_file_uris: std::vec::Vec<std::string::String>,
10545
10546 /// Optional. HCFS URIs of files to be placed in the working directory of
10547 /// each executor. Useful for naively parallel tasks.
10548 pub file_uris: std::vec::Vec<std::string::String>,
10549
10550 /// Optional. HCFS URIs of archives to be extracted into the working directory
10551 /// of each executor. Supported file types:
10552 /// .jar, .tar, .tar.gz, .tgz, and .zip.
10553 pub archive_uris: std::vec::Vec<std::string::String>,
10554
10555 /// Optional. A mapping of property names to values, used to configure Spark.
10556 /// Properties that conflict with values set by the Dataproc API might be
10557 /// overwritten. Can include properties set in
10558 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
10559 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10560
10561 /// Optional. The runtime log config for job execution.
10562 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10563
10564 /// Required. The specification of the main method to call to drive the job.
10565 /// Specify either the jar file that contains the main class or the main class
10566 /// name. To pass both a main jar and a main class in that jar, add the jar to
10567 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
10568 /// specify the main class name in
10569 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
10570 ///
10571 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
10572 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
10573 pub driver: std::option::Option<crate::model::spark_job::Driver>,
10574
10575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10576}
10577
10578impl SparkJob {
10579 pub fn new() -> Self {
10580 std::default::Default::default()
10581 }
10582
10583 /// Sets the value of [args][crate::model::SparkJob::args].
10584 ///
10585 /// # Example
10586 /// ```ignore,no_run
10587 /// # use google_cloud_dataproc_v1::model::SparkJob;
10588 /// let x = SparkJob::new().set_args(["a", "b", "c"]);
10589 /// ```
10590 pub fn set_args<T, V>(mut self, v: T) -> Self
10591 where
10592 T: std::iter::IntoIterator<Item = V>,
10593 V: std::convert::Into<std::string::String>,
10594 {
10595 use std::iter::Iterator;
10596 self.args = v.into_iter().map(|i| i.into()).collect();
10597 self
10598 }
10599
10600 /// Sets the value of [jar_file_uris][crate::model::SparkJob::jar_file_uris].
10601 ///
10602 /// # Example
10603 /// ```ignore,no_run
10604 /// # use google_cloud_dataproc_v1::model::SparkJob;
10605 /// let x = SparkJob::new().set_jar_file_uris(["a", "b", "c"]);
10606 /// ```
10607 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10608 where
10609 T: std::iter::IntoIterator<Item = V>,
10610 V: std::convert::Into<std::string::String>,
10611 {
10612 use std::iter::Iterator;
10613 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10614 self
10615 }
10616
10617 /// Sets the value of [file_uris][crate::model::SparkJob::file_uris].
10618 ///
10619 /// # Example
10620 /// ```ignore,no_run
10621 /// # use google_cloud_dataproc_v1::model::SparkJob;
10622 /// let x = SparkJob::new().set_file_uris(["a", "b", "c"]);
10623 /// ```
10624 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10625 where
10626 T: std::iter::IntoIterator<Item = V>,
10627 V: std::convert::Into<std::string::String>,
10628 {
10629 use std::iter::Iterator;
10630 self.file_uris = v.into_iter().map(|i| i.into()).collect();
10631 self
10632 }
10633
10634 /// Sets the value of [archive_uris][crate::model::SparkJob::archive_uris].
10635 ///
10636 /// # Example
10637 /// ```ignore,no_run
10638 /// # use google_cloud_dataproc_v1::model::SparkJob;
10639 /// let x = SparkJob::new().set_archive_uris(["a", "b", "c"]);
10640 /// ```
10641 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10642 where
10643 T: std::iter::IntoIterator<Item = V>,
10644 V: std::convert::Into<std::string::String>,
10645 {
10646 use std::iter::Iterator;
10647 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10648 self
10649 }
10650
10651 /// Sets the value of [properties][crate::model::SparkJob::properties].
10652 ///
10653 /// # Example
10654 /// ```ignore,no_run
10655 /// # use google_cloud_dataproc_v1::model::SparkJob;
10656 /// let x = SparkJob::new().set_properties([
10657 /// ("key0", "abc"),
10658 /// ("key1", "xyz"),
10659 /// ]);
10660 /// ```
10661 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10662 where
10663 T: std::iter::IntoIterator<Item = (K, V)>,
10664 K: std::convert::Into<std::string::String>,
10665 V: std::convert::Into<std::string::String>,
10666 {
10667 use std::iter::Iterator;
10668 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10669 self
10670 }
10671
10672 /// Sets the value of [logging_config][crate::model::SparkJob::logging_config].
10673 ///
10674 /// # Example
10675 /// ```ignore,no_run
10676 /// # use google_cloud_dataproc_v1::model::SparkJob;
10677 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10678 /// let x = SparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10679 /// ```
10680 pub fn set_logging_config<T>(mut self, v: T) -> Self
10681 where
10682 T: std::convert::Into<crate::model::LoggingConfig>,
10683 {
10684 self.logging_config = std::option::Option::Some(v.into());
10685 self
10686 }
10687
10688 /// Sets or clears the value of [logging_config][crate::model::SparkJob::logging_config].
10689 ///
10690 /// # Example
10691 /// ```ignore,no_run
10692 /// # use google_cloud_dataproc_v1::model::SparkJob;
10693 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10694 /// let x = SparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
10695 /// let x = SparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
10696 /// ```
10697 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
10698 where
10699 T: std::convert::Into<crate::model::LoggingConfig>,
10700 {
10701 self.logging_config = v.map(|x| x.into());
10702 self
10703 }
10704
10705 /// Sets the value of [driver][crate::model::SparkJob::driver].
10706 ///
10707 /// Note that all the setters affecting `driver` are mutually
10708 /// exclusive.
10709 ///
10710 /// # Example
10711 /// ```ignore,no_run
10712 /// # use google_cloud_dataproc_v1::model::SparkJob;
10713 /// use google_cloud_dataproc_v1::model::spark_job::Driver;
10714 /// let x = SparkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
10715 /// ```
10716 pub fn set_driver<
10717 T: std::convert::Into<std::option::Option<crate::model::spark_job::Driver>>,
10718 >(
10719 mut self,
10720 v: T,
10721 ) -> Self {
10722 self.driver = v.into();
10723 self
10724 }
10725
10726 /// The value of [driver][crate::model::SparkJob::driver]
10727 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
10728 /// holds a different branch.
10729 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
10730 #[allow(unreachable_patterns)]
10731 self.driver.as_ref().and_then(|v| match v {
10732 crate::model::spark_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
10733 _ => std::option::Option::None,
10734 })
10735 }
10736
10737 /// Sets the value of [driver][crate::model::SparkJob::driver]
10738 /// to hold a `MainJarFileUri`.
10739 ///
10740 /// Note that all the setters affecting `driver` are
10741 /// mutually exclusive.
10742 ///
10743 /// # Example
10744 /// ```ignore,no_run
10745 /// # use google_cloud_dataproc_v1::model::SparkJob;
10746 /// let x = SparkJob::new().set_main_jar_file_uri("example");
10747 /// assert!(x.main_jar_file_uri().is_some());
10748 /// assert!(x.main_class().is_none());
10749 /// ```
10750 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
10751 mut self,
10752 v: T,
10753 ) -> Self {
10754 self.driver =
10755 std::option::Option::Some(crate::model::spark_job::Driver::MainJarFileUri(v.into()));
10756 self
10757 }
10758
10759 /// The value of [driver][crate::model::SparkJob::driver]
10760 /// if it holds a `MainClass`, `None` if the field is not set or
10761 /// holds a different branch.
10762 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
10763 #[allow(unreachable_patterns)]
10764 self.driver.as_ref().and_then(|v| match v {
10765 crate::model::spark_job::Driver::MainClass(v) => std::option::Option::Some(v),
10766 _ => std::option::Option::None,
10767 })
10768 }
10769
10770 /// Sets the value of [driver][crate::model::SparkJob::driver]
10771 /// to hold a `MainClass`.
10772 ///
10773 /// Note that all the setters affecting `driver` are
10774 /// mutually exclusive.
10775 ///
10776 /// # Example
10777 /// ```ignore,no_run
10778 /// # use google_cloud_dataproc_v1::model::SparkJob;
10779 /// let x = SparkJob::new().set_main_class("example");
10780 /// assert!(x.main_class().is_some());
10781 /// assert!(x.main_jar_file_uri().is_none());
10782 /// ```
10783 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10784 self.driver =
10785 std::option::Option::Some(crate::model::spark_job::Driver::MainClass(v.into()));
10786 self
10787 }
10788}
10789
10790impl wkt::message::Message for SparkJob {
10791 fn typename() -> &'static str {
10792 "type.googleapis.com/google.cloud.dataproc.v1.SparkJob"
10793 }
10794}
10795
10796/// Defines additional types related to [SparkJob].
10797pub mod spark_job {
10798 #[allow(unused_imports)]
10799 use super::*;
10800
10801 /// Required. The specification of the main method to call to drive the job.
10802 /// Specify either the jar file that contains the main class or the main class
10803 /// name. To pass both a main jar and a main class in that jar, add the jar to
10804 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
10805 /// specify the main class name in
10806 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
10807 ///
10808 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
10809 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
10810 #[derive(Clone, Debug, PartialEq)]
10811 #[non_exhaustive]
10812 pub enum Driver {
10813 /// The HCFS URI of the jar file that contains the main class.
10814 MainJarFileUri(std::string::String),
10815 /// The name of the driver's main class. The jar file that contains the class
10816 /// must be in the default CLASSPATH or specified in
10817 /// SparkJob.jar_file_uris.
10818 MainClass(std::string::String),
10819 }
10820}
10821
10822/// A Dataproc job for running
10823/// [Apache
10824/// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html)
10825/// applications on YARN.
10826#[derive(Clone, Default, PartialEq)]
10827#[non_exhaustive]
10828pub struct PySparkJob {
10829 /// Required. The HCFS URI of the main Python file to use as the driver. Must
10830 /// be a .py file.
10831 pub main_python_file_uri: std::string::String,
10832
10833 /// Optional. The arguments to pass to the driver. Do not include arguments,
10834 /// such as `--conf`, that can be set as job properties, since a collision may
10835 /// occur that causes an incorrect job submission.
10836 pub args: std::vec::Vec<std::string::String>,
10837
10838 /// Optional. HCFS file URIs of Python files to pass to the PySpark
10839 /// framework. Supported file types: .py, .egg, and .zip.
10840 pub python_file_uris: std::vec::Vec<std::string::String>,
10841
10842 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
10843 /// Python driver and tasks.
10844 pub jar_file_uris: std::vec::Vec<std::string::String>,
10845
10846 /// Optional. HCFS URIs of files to be placed in the working directory of
10847 /// each executor. Useful for naively parallel tasks.
10848 pub file_uris: std::vec::Vec<std::string::String>,
10849
10850 /// Optional. HCFS URIs of archives to be extracted into the working directory
10851 /// of each executor. Supported file types:
10852 /// .jar, .tar, .tar.gz, .tgz, and .zip.
10853 pub archive_uris: std::vec::Vec<std::string::String>,
10854
10855 /// Optional. A mapping of property names to values, used to configure PySpark.
10856 /// Properties that conflict with values set by the Dataproc API might be
10857 /// overwritten. Can include properties set in
10858 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
10859 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10860
10861 /// Optional. The runtime log config for job execution.
10862 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10863
10864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10865}
10866
10867impl PySparkJob {
10868 pub fn new() -> Self {
10869 std::default::Default::default()
10870 }
10871
10872 /// Sets the value of [main_python_file_uri][crate::model::PySparkJob::main_python_file_uri].
10873 ///
10874 /// # Example
10875 /// ```ignore,no_run
10876 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10877 /// let x = PySparkJob::new().set_main_python_file_uri("example");
10878 /// ```
10879 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
10880 mut self,
10881 v: T,
10882 ) -> Self {
10883 self.main_python_file_uri = v.into();
10884 self
10885 }
10886
10887 /// Sets the value of [args][crate::model::PySparkJob::args].
10888 ///
10889 /// # Example
10890 /// ```ignore,no_run
10891 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10892 /// let x = PySparkJob::new().set_args(["a", "b", "c"]);
10893 /// ```
10894 pub fn set_args<T, V>(mut self, v: T) -> Self
10895 where
10896 T: std::iter::IntoIterator<Item = V>,
10897 V: std::convert::Into<std::string::String>,
10898 {
10899 use std::iter::Iterator;
10900 self.args = v.into_iter().map(|i| i.into()).collect();
10901 self
10902 }
10903
10904 /// Sets the value of [python_file_uris][crate::model::PySparkJob::python_file_uris].
10905 ///
10906 /// # Example
10907 /// ```ignore,no_run
10908 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10909 /// let x = PySparkJob::new().set_python_file_uris(["a", "b", "c"]);
10910 /// ```
10911 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
10912 where
10913 T: std::iter::IntoIterator<Item = V>,
10914 V: std::convert::Into<std::string::String>,
10915 {
10916 use std::iter::Iterator;
10917 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
10918 self
10919 }
10920
10921 /// Sets the value of [jar_file_uris][crate::model::PySparkJob::jar_file_uris].
10922 ///
10923 /// # Example
10924 /// ```ignore,no_run
10925 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10926 /// let x = PySparkJob::new().set_jar_file_uris(["a", "b", "c"]);
10927 /// ```
10928 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10929 where
10930 T: std::iter::IntoIterator<Item = V>,
10931 V: std::convert::Into<std::string::String>,
10932 {
10933 use std::iter::Iterator;
10934 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10935 self
10936 }
10937
10938 /// Sets the value of [file_uris][crate::model::PySparkJob::file_uris].
10939 ///
10940 /// # Example
10941 /// ```ignore,no_run
10942 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10943 /// let x = PySparkJob::new().set_file_uris(["a", "b", "c"]);
10944 /// ```
10945 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10946 where
10947 T: std::iter::IntoIterator<Item = V>,
10948 V: std::convert::Into<std::string::String>,
10949 {
10950 use std::iter::Iterator;
10951 self.file_uris = v.into_iter().map(|i| i.into()).collect();
10952 self
10953 }
10954
10955 /// Sets the value of [archive_uris][crate::model::PySparkJob::archive_uris].
10956 ///
10957 /// # Example
10958 /// ```ignore,no_run
10959 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10960 /// let x = PySparkJob::new().set_archive_uris(["a", "b", "c"]);
10961 /// ```
10962 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10963 where
10964 T: std::iter::IntoIterator<Item = V>,
10965 V: std::convert::Into<std::string::String>,
10966 {
10967 use std::iter::Iterator;
10968 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10969 self
10970 }
10971
10972 /// Sets the value of [properties][crate::model::PySparkJob::properties].
10973 ///
10974 /// # Example
10975 /// ```ignore,no_run
10976 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10977 /// let x = PySparkJob::new().set_properties([
10978 /// ("key0", "abc"),
10979 /// ("key1", "xyz"),
10980 /// ]);
10981 /// ```
10982 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10983 where
10984 T: std::iter::IntoIterator<Item = (K, V)>,
10985 K: std::convert::Into<std::string::String>,
10986 V: std::convert::Into<std::string::String>,
10987 {
10988 use std::iter::Iterator;
10989 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10990 self
10991 }
10992
10993 /// Sets the value of [logging_config][crate::model::PySparkJob::logging_config].
10994 ///
10995 /// # Example
10996 /// ```ignore,no_run
10997 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10998 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10999 /// let x = PySparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11000 /// ```
11001 pub fn set_logging_config<T>(mut self, v: T) -> Self
11002 where
11003 T: std::convert::Into<crate::model::LoggingConfig>,
11004 {
11005 self.logging_config = std::option::Option::Some(v.into());
11006 self
11007 }
11008
11009 /// Sets or clears the value of [logging_config][crate::model::PySparkJob::logging_config].
11010 ///
11011 /// # Example
11012 /// ```ignore,no_run
11013 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11014 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11015 /// let x = PySparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11016 /// let x = PySparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11017 /// ```
11018 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11019 where
11020 T: std::convert::Into<crate::model::LoggingConfig>,
11021 {
11022 self.logging_config = v.map(|x| x.into());
11023 self
11024 }
11025}
11026
11027impl wkt::message::Message for PySparkJob {
11028 fn typename() -> &'static str {
11029 "type.googleapis.com/google.cloud.dataproc.v1.PySparkJob"
11030 }
11031}
11032
11033/// A list of queries to run on a cluster.
11034#[derive(Clone, Default, PartialEq)]
11035#[non_exhaustive]
11036pub struct QueryList {
11037 /// Required. The queries to execute. You do not need to end a query expression
11038 /// with a semicolon. Multiple queries can be specified in one
11039 /// string by separating each with a semicolon. Here is an example of a
11040 /// Dataproc API snippet that uses a QueryList to specify a HiveJob:
11041 ///
11042 /// ```norust
11043 /// "hiveJob": {
11044 /// "queryList": {
11045 /// "queries": [
11046 /// "query1",
11047 /// "query2",
11048 /// "query3;query4",
11049 /// ]
11050 /// }
11051 /// }
11052 /// ```
11053 pub queries: std::vec::Vec<std::string::String>,
11054
11055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11056}
11057
11058impl QueryList {
11059 pub fn new() -> Self {
11060 std::default::Default::default()
11061 }
11062
11063 /// Sets the value of [queries][crate::model::QueryList::queries].
11064 ///
11065 /// # Example
11066 /// ```ignore,no_run
11067 /// # use google_cloud_dataproc_v1::model::QueryList;
11068 /// let x = QueryList::new().set_queries(["a", "b", "c"]);
11069 /// ```
11070 pub fn set_queries<T, V>(mut self, v: T) -> Self
11071 where
11072 T: std::iter::IntoIterator<Item = V>,
11073 V: std::convert::Into<std::string::String>,
11074 {
11075 use std::iter::Iterator;
11076 self.queries = v.into_iter().map(|i| i.into()).collect();
11077 self
11078 }
11079}
11080
11081impl wkt::message::Message for QueryList {
11082 fn typename() -> &'static str {
11083 "type.googleapis.com/google.cloud.dataproc.v1.QueryList"
11084 }
11085}
11086
11087/// A Dataproc job for running [Apache Hive](https://hive.apache.org/)
11088/// queries on YARN.
11089#[derive(Clone, Default, PartialEq)]
11090#[non_exhaustive]
11091pub struct HiveJob {
11092 /// Optional. Whether to continue executing queries if a query fails.
11093 /// The default value is `false`. Setting to `true` can be useful when
11094 /// executing independent parallel queries.
11095 pub continue_on_failure: bool,
11096
11097 /// Optional. Mapping of query variable names to values (equivalent to the
11098 /// Hive command: `SET name="value";`).
11099 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11100
11101 /// Optional. A mapping of property names and values, used to configure Hive.
11102 /// Properties that conflict with values set by the Dataproc API might be
11103 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11104 /// /etc/hive/conf/hive-site.xml, and classes in user code.
11105 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11106
11107 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the
11108 /// Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes
11109 /// and UDFs.
11110 pub jar_file_uris: std::vec::Vec<std::string::String>,
11111
11112 /// Required. The sequence of Hive queries to execute, specified as either
11113 /// an HCFS file URI or a list of queries.
11114 pub queries: std::option::Option<crate::model::hive_job::Queries>,
11115
11116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11117}
11118
11119impl HiveJob {
11120 pub fn new() -> Self {
11121 std::default::Default::default()
11122 }
11123
11124 /// Sets the value of [continue_on_failure][crate::model::HiveJob::continue_on_failure].
11125 ///
11126 /// # Example
11127 /// ```ignore,no_run
11128 /// # use google_cloud_dataproc_v1::model::HiveJob;
11129 /// let x = HiveJob::new().set_continue_on_failure(true);
11130 /// ```
11131 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11132 self.continue_on_failure = v.into();
11133 self
11134 }
11135
11136 /// Sets the value of [script_variables][crate::model::HiveJob::script_variables].
11137 ///
11138 /// # Example
11139 /// ```ignore,no_run
11140 /// # use google_cloud_dataproc_v1::model::HiveJob;
11141 /// let x = HiveJob::new().set_script_variables([
11142 /// ("key0", "abc"),
11143 /// ("key1", "xyz"),
11144 /// ]);
11145 /// ```
11146 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11147 where
11148 T: std::iter::IntoIterator<Item = (K, V)>,
11149 K: std::convert::Into<std::string::String>,
11150 V: std::convert::Into<std::string::String>,
11151 {
11152 use std::iter::Iterator;
11153 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11154 self
11155 }
11156
11157 /// Sets the value of [properties][crate::model::HiveJob::properties].
11158 ///
11159 /// # Example
11160 /// ```ignore,no_run
11161 /// # use google_cloud_dataproc_v1::model::HiveJob;
11162 /// let x = HiveJob::new().set_properties([
11163 /// ("key0", "abc"),
11164 /// ("key1", "xyz"),
11165 /// ]);
11166 /// ```
11167 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11168 where
11169 T: std::iter::IntoIterator<Item = (K, V)>,
11170 K: std::convert::Into<std::string::String>,
11171 V: std::convert::Into<std::string::String>,
11172 {
11173 use std::iter::Iterator;
11174 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11175 self
11176 }
11177
11178 /// Sets the value of [jar_file_uris][crate::model::HiveJob::jar_file_uris].
11179 ///
11180 /// # Example
11181 /// ```ignore,no_run
11182 /// # use google_cloud_dataproc_v1::model::HiveJob;
11183 /// let x = HiveJob::new().set_jar_file_uris(["a", "b", "c"]);
11184 /// ```
11185 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11186 where
11187 T: std::iter::IntoIterator<Item = V>,
11188 V: std::convert::Into<std::string::String>,
11189 {
11190 use std::iter::Iterator;
11191 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11192 self
11193 }
11194
11195 /// Sets the value of [queries][crate::model::HiveJob::queries].
11196 ///
11197 /// Note that all the setters affecting `queries` are mutually
11198 /// exclusive.
11199 ///
11200 /// # Example
11201 /// ```ignore,no_run
11202 /// # use google_cloud_dataproc_v1::model::HiveJob;
11203 /// use google_cloud_dataproc_v1::model::hive_job::Queries;
11204 /// let x = HiveJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11205 /// ```
11206 pub fn set_queries<
11207 T: std::convert::Into<std::option::Option<crate::model::hive_job::Queries>>,
11208 >(
11209 mut self,
11210 v: T,
11211 ) -> Self {
11212 self.queries = v.into();
11213 self
11214 }
11215
11216 /// The value of [queries][crate::model::HiveJob::queries]
11217 /// if it holds a `QueryFileUri`, `None` if the field is not set or
11218 /// holds a different branch.
11219 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11220 #[allow(unreachable_patterns)]
11221 self.queries.as_ref().and_then(|v| match v {
11222 crate::model::hive_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11223 _ => std::option::Option::None,
11224 })
11225 }
11226
11227 /// Sets the value of [queries][crate::model::HiveJob::queries]
11228 /// to hold a `QueryFileUri`.
11229 ///
11230 /// Note that all the setters affecting `queries` are
11231 /// mutually exclusive.
11232 ///
11233 /// # Example
11234 /// ```ignore,no_run
11235 /// # use google_cloud_dataproc_v1::model::HiveJob;
11236 /// let x = HiveJob::new().set_query_file_uri("example");
11237 /// assert!(x.query_file_uri().is_some());
11238 /// assert!(x.query_list().is_none());
11239 /// ```
11240 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11241 self.queries =
11242 std::option::Option::Some(crate::model::hive_job::Queries::QueryFileUri(v.into()));
11243 self
11244 }
11245
11246 /// The value of [queries][crate::model::HiveJob::queries]
11247 /// if it holds a `QueryList`, `None` if the field is not set or
11248 /// holds a different branch.
11249 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11250 #[allow(unreachable_patterns)]
11251 self.queries.as_ref().and_then(|v| match v {
11252 crate::model::hive_job::Queries::QueryList(v) => std::option::Option::Some(v),
11253 _ => std::option::Option::None,
11254 })
11255 }
11256
11257 /// Sets the value of [queries][crate::model::HiveJob::queries]
11258 /// to hold a `QueryList`.
11259 ///
11260 /// Note that all the setters affecting `queries` are
11261 /// mutually exclusive.
11262 ///
11263 /// # Example
11264 /// ```ignore,no_run
11265 /// # use google_cloud_dataproc_v1::model::HiveJob;
11266 /// use google_cloud_dataproc_v1::model::QueryList;
11267 /// let x = HiveJob::new().set_query_list(QueryList::default()/* use setters */);
11268 /// assert!(x.query_list().is_some());
11269 /// assert!(x.query_file_uri().is_none());
11270 /// ```
11271 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11272 mut self,
11273 v: T,
11274 ) -> Self {
11275 self.queries =
11276 std::option::Option::Some(crate::model::hive_job::Queries::QueryList(v.into()));
11277 self
11278 }
11279}
11280
11281impl wkt::message::Message for HiveJob {
11282 fn typename() -> &'static str {
11283 "type.googleapis.com/google.cloud.dataproc.v1.HiveJob"
11284 }
11285}
11286
11287/// Defines additional types related to [HiveJob].
11288pub mod hive_job {
11289 #[allow(unused_imports)]
11290 use super::*;
11291
11292 /// Required. The sequence of Hive queries to execute, specified as either
11293 /// an HCFS file URI or a list of queries.
11294 #[derive(Clone, Debug, PartialEq)]
11295 #[non_exhaustive]
11296 pub enum Queries {
11297 /// The HCFS URI of the script that contains Hive queries.
11298 QueryFileUri(std::string::String),
11299 /// A list of queries.
11300 QueryList(std::boxed::Box<crate::model::QueryList>),
11301 }
11302}
11303
11304/// A Dataproc job for running [Apache Spark
11305/// SQL](https://spark.apache.org/sql/) queries.
11306#[derive(Clone, Default, PartialEq)]
11307#[non_exhaustive]
11308pub struct SparkSqlJob {
11309 /// Optional. Mapping of query variable names to values (equivalent to the
11310 /// Spark SQL command: SET `name="value";`).
11311 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11312
11313 /// Optional. A mapping of property names to values, used to configure
11314 /// Spark SQL's SparkConf. Properties that conflict with values set by the
11315 /// Dataproc API might be overwritten.
11316 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11317
11318 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
11319 pub jar_file_uris: std::vec::Vec<std::string::String>,
11320
11321 /// Optional. The runtime log config for job execution.
11322 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11323
11324 /// Required. The sequence of Spark SQL queries to execute, specified as
11325 /// either an HCFS file URI or as a list of queries.
11326 pub queries: std::option::Option<crate::model::spark_sql_job::Queries>,
11327
11328 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11329}
11330
11331impl SparkSqlJob {
11332 pub fn new() -> Self {
11333 std::default::Default::default()
11334 }
11335
11336 /// Sets the value of [script_variables][crate::model::SparkSqlJob::script_variables].
11337 ///
11338 /// # Example
11339 /// ```ignore,no_run
11340 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11341 /// let x = SparkSqlJob::new().set_script_variables([
11342 /// ("key0", "abc"),
11343 /// ("key1", "xyz"),
11344 /// ]);
11345 /// ```
11346 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11347 where
11348 T: std::iter::IntoIterator<Item = (K, V)>,
11349 K: std::convert::Into<std::string::String>,
11350 V: std::convert::Into<std::string::String>,
11351 {
11352 use std::iter::Iterator;
11353 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11354 self
11355 }
11356
11357 /// Sets the value of [properties][crate::model::SparkSqlJob::properties].
11358 ///
11359 /// # Example
11360 /// ```ignore,no_run
11361 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11362 /// let x = SparkSqlJob::new().set_properties([
11363 /// ("key0", "abc"),
11364 /// ("key1", "xyz"),
11365 /// ]);
11366 /// ```
11367 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11368 where
11369 T: std::iter::IntoIterator<Item = (K, V)>,
11370 K: std::convert::Into<std::string::String>,
11371 V: std::convert::Into<std::string::String>,
11372 {
11373 use std::iter::Iterator;
11374 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11375 self
11376 }
11377
11378 /// Sets the value of [jar_file_uris][crate::model::SparkSqlJob::jar_file_uris].
11379 ///
11380 /// # Example
11381 /// ```ignore,no_run
11382 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11383 /// let x = SparkSqlJob::new().set_jar_file_uris(["a", "b", "c"]);
11384 /// ```
11385 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11386 where
11387 T: std::iter::IntoIterator<Item = V>,
11388 V: std::convert::Into<std::string::String>,
11389 {
11390 use std::iter::Iterator;
11391 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11392 self
11393 }
11394
11395 /// Sets the value of [logging_config][crate::model::SparkSqlJob::logging_config].
11396 ///
11397 /// # Example
11398 /// ```ignore,no_run
11399 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11400 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11401 /// let x = SparkSqlJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11402 /// ```
11403 pub fn set_logging_config<T>(mut self, v: T) -> Self
11404 where
11405 T: std::convert::Into<crate::model::LoggingConfig>,
11406 {
11407 self.logging_config = std::option::Option::Some(v.into());
11408 self
11409 }
11410
11411 /// Sets or clears the value of [logging_config][crate::model::SparkSqlJob::logging_config].
11412 ///
11413 /// # Example
11414 /// ```ignore,no_run
11415 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11416 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11417 /// let x = SparkSqlJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11418 /// let x = SparkSqlJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11419 /// ```
11420 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11421 where
11422 T: std::convert::Into<crate::model::LoggingConfig>,
11423 {
11424 self.logging_config = v.map(|x| x.into());
11425 self
11426 }
11427
11428 /// Sets the value of [queries][crate::model::SparkSqlJob::queries].
11429 ///
11430 /// Note that all the setters affecting `queries` are mutually
11431 /// exclusive.
11432 ///
11433 /// # Example
11434 /// ```ignore,no_run
11435 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11436 /// use google_cloud_dataproc_v1::model::spark_sql_job::Queries;
11437 /// let x = SparkSqlJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11438 /// ```
11439 pub fn set_queries<
11440 T: std::convert::Into<std::option::Option<crate::model::spark_sql_job::Queries>>,
11441 >(
11442 mut self,
11443 v: T,
11444 ) -> Self {
11445 self.queries = v.into();
11446 self
11447 }
11448
11449 /// The value of [queries][crate::model::SparkSqlJob::queries]
11450 /// if it holds a `QueryFileUri`, `None` if the field is not set or
11451 /// holds a different branch.
11452 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11453 #[allow(unreachable_patterns)]
11454 self.queries.as_ref().and_then(|v| match v {
11455 crate::model::spark_sql_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11456 _ => std::option::Option::None,
11457 })
11458 }
11459
11460 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
11461 /// to hold a `QueryFileUri`.
11462 ///
11463 /// Note that all the setters affecting `queries` are
11464 /// mutually exclusive.
11465 ///
11466 /// # Example
11467 /// ```ignore,no_run
11468 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11469 /// let x = SparkSqlJob::new().set_query_file_uri("example");
11470 /// assert!(x.query_file_uri().is_some());
11471 /// assert!(x.query_list().is_none());
11472 /// ```
11473 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11474 self.queries =
11475 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryFileUri(v.into()));
11476 self
11477 }
11478
11479 /// The value of [queries][crate::model::SparkSqlJob::queries]
11480 /// if it holds a `QueryList`, `None` if the field is not set or
11481 /// holds a different branch.
11482 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11483 #[allow(unreachable_patterns)]
11484 self.queries.as_ref().and_then(|v| match v {
11485 crate::model::spark_sql_job::Queries::QueryList(v) => std::option::Option::Some(v),
11486 _ => std::option::Option::None,
11487 })
11488 }
11489
11490 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
11491 /// to hold a `QueryList`.
11492 ///
11493 /// Note that all the setters affecting `queries` are
11494 /// mutually exclusive.
11495 ///
11496 /// # Example
11497 /// ```ignore,no_run
11498 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11499 /// use google_cloud_dataproc_v1::model::QueryList;
11500 /// let x = SparkSqlJob::new().set_query_list(QueryList::default()/* use setters */);
11501 /// assert!(x.query_list().is_some());
11502 /// assert!(x.query_file_uri().is_none());
11503 /// ```
11504 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11505 mut self,
11506 v: T,
11507 ) -> Self {
11508 self.queries =
11509 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryList(v.into()));
11510 self
11511 }
11512}
11513
11514impl wkt::message::Message for SparkSqlJob {
11515 fn typename() -> &'static str {
11516 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlJob"
11517 }
11518}
11519
11520/// Defines additional types related to [SparkSqlJob].
11521pub mod spark_sql_job {
11522 #[allow(unused_imports)]
11523 use super::*;
11524
11525 /// Required. The sequence of Spark SQL queries to execute, specified as
11526 /// either an HCFS file URI or as a list of queries.
11527 #[derive(Clone, Debug, PartialEq)]
11528 #[non_exhaustive]
11529 pub enum Queries {
11530 /// The HCFS URI of the script that contains SQL queries.
11531 QueryFileUri(std::string::String),
11532 /// A list of queries.
11533 QueryList(std::boxed::Box<crate::model::QueryList>),
11534 }
11535}
11536
11537/// A Dataproc job for running [Apache Pig](https://pig.apache.org/)
11538/// queries on YARN.
11539#[derive(Clone, Default, PartialEq)]
11540#[non_exhaustive]
11541pub struct PigJob {
11542 /// Optional. Whether to continue executing queries if a query fails.
11543 /// The default value is `false`. Setting to `true` can be useful when
11544 /// executing independent parallel queries.
11545 pub continue_on_failure: bool,
11546
11547 /// Optional. Mapping of query variable names to values (equivalent to the Pig
11548 /// command: `name=[value]`).
11549 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11550
11551 /// Optional. A mapping of property names to values, used to configure Pig.
11552 /// Properties that conflict with values set by the Dataproc API might be
11553 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11554 /// /etc/pig/conf/pig.properties, and classes in user code.
11555 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11556
11557 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of
11558 /// the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs.
11559 pub jar_file_uris: std::vec::Vec<std::string::String>,
11560
11561 /// Optional. The runtime log config for job execution.
11562 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11563
11564 /// Required. The sequence of Pig queries to execute, specified as an HCFS
11565 /// file URI or a list of queries.
11566 pub queries: std::option::Option<crate::model::pig_job::Queries>,
11567
11568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11569}
11570
11571impl PigJob {
11572 pub fn new() -> Self {
11573 std::default::Default::default()
11574 }
11575
11576 /// Sets the value of [continue_on_failure][crate::model::PigJob::continue_on_failure].
11577 ///
11578 /// # Example
11579 /// ```ignore,no_run
11580 /// # use google_cloud_dataproc_v1::model::PigJob;
11581 /// let x = PigJob::new().set_continue_on_failure(true);
11582 /// ```
11583 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11584 self.continue_on_failure = v.into();
11585 self
11586 }
11587
11588 /// Sets the value of [script_variables][crate::model::PigJob::script_variables].
11589 ///
11590 /// # Example
11591 /// ```ignore,no_run
11592 /// # use google_cloud_dataproc_v1::model::PigJob;
11593 /// let x = PigJob::new().set_script_variables([
11594 /// ("key0", "abc"),
11595 /// ("key1", "xyz"),
11596 /// ]);
11597 /// ```
11598 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11599 where
11600 T: std::iter::IntoIterator<Item = (K, V)>,
11601 K: std::convert::Into<std::string::String>,
11602 V: std::convert::Into<std::string::String>,
11603 {
11604 use std::iter::Iterator;
11605 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11606 self
11607 }
11608
11609 /// Sets the value of [properties][crate::model::PigJob::properties].
11610 ///
11611 /// # Example
11612 /// ```ignore,no_run
11613 /// # use google_cloud_dataproc_v1::model::PigJob;
11614 /// let x = PigJob::new().set_properties([
11615 /// ("key0", "abc"),
11616 /// ("key1", "xyz"),
11617 /// ]);
11618 /// ```
11619 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11620 where
11621 T: std::iter::IntoIterator<Item = (K, V)>,
11622 K: std::convert::Into<std::string::String>,
11623 V: std::convert::Into<std::string::String>,
11624 {
11625 use std::iter::Iterator;
11626 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11627 self
11628 }
11629
11630 /// Sets the value of [jar_file_uris][crate::model::PigJob::jar_file_uris].
11631 ///
11632 /// # Example
11633 /// ```ignore,no_run
11634 /// # use google_cloud_dataproc_v1::model::PigJob;
11635 /// let x = PigJob::new().set_jar_file_uris(["a", "b", "c"]);
11636 /// ```
11637 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11638 where
11639 T: std::iter::IntoIterator<Item = V>,
11640 V: std::convert::Into<std::string::String>,
11641 {
11642 use std::iter::Iterator;
11643 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11644 self
11645 }
11646
11647 /// Sets the value of [logging_config][crate::model::PigJob::logging_config].
11648 ///
11649 /// # Example
11650 /// ```ignore,no_run
11651 /// # use google_cloud_dataproc_v1::model::PigJob;
11652 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11653 /// let x = PigJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11654 /// ```
11655 pub fn set_logging_config<T>(mut self, v: T) -> Self
11656 where
11657 T: std::convert::Into<crate::model::LoggingConfig>,
11658 {
11659 self.logging_config = std::option::Option::Some(v.into());
11660 self
11661 }
11662
11663 /// Sets or clears the value of [logging_config][crate::model::PigJob::logging_config].
11664 ///
11665 /// # Example
11666 /// ```ignore,no_run
11667 /// # use google_cloud_dataproc_v1::model::PigJob;
11668 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11669 /// let x = PigJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11670 /// let x = PigJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11671 /// ```
11672 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11673 where
11674 T: std::convert::Into<crate::model::LoggingConfig>,
11675 {
11676 self.logging_config = v.map(|x| x.into());
11677 self
11678 }
11679
11680 /// Sets the value of [queries][crate::model::PigJob::queries].
11681 ///
11682 /// Note that all the setters affecting `queries` are mutually
11683 /// exclusive.
11684 ///
11685 /// # Example
11686 /// ```ignore,no_run
11687 /// # use google_cloud_dataproc_v1::model::PigJob;
11688 /// use google_cloud_dataproc_v1::model::pig_job::Queries;
11689 /// let x = PigJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11690 /// ```
11691 pub fn set_queries<
11692 T: std::convert::Into<std::option::Option<crate::model::pig_job::Queries>>,
11693 >(
11694 mut self,
11695 v: T,
11696 ) -> Self {
11697 self.queries = v.into();
11698 self
11699 }
11700
11701 /// The value of [queries][crate::model::PigJob::queries]
11702 /// if it holds a `QueryFileUri`, `None` if the field is not set or
11703 /// holds a different branch.
11704 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11705 #[allow(unreachable_patterns)]
11706 self.queries.as_ref().and_then(|v| match v {
11707 crate::model::pig_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11708 _ => std::option::Option::None,
11709 })
11710 }
11711
11712 /// Sets the value of [queries][crate::model::PigJob::queries]
11713 /// to hold a `QueryFileUri`.
11714 ///
11715 /// Note that all the setters affecting `queries` are
11716 /// mutually exclusive.
11717 ///
11718 /// # Example
11719 /// ```ignore,no_run
11720 /// # use google_cloud_dataproc_v1::model::PigJob;
11721 /// let x = PigJob::new().set_query_file_uri("example");
11722 /// assert!(x.query_file_uri().is_some());
11723 /// assert!(x.query_list().is_none());
11724 /// ```
11725 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11726 self.queries =
11727 std::option::Option::Some(crate::model::pig_job::Queries::QueryFileUri(v.into()));
11728 self
11729 }
11730
11731 /// The value of [queries][crate::model::PigJob::queries]
11732 /// if it holds a `QueryList`, `None` if the field is not set or
11733 /// holds a different branch.
11734 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11735 #[allow(unreachable_patterns)]
11736 self.queries.as_ref().and_then(|v| match v {
11737 crate::model::pig_job::Queries::QueryList(v) => std::option::Option::Some(v),
11738 _ => std::option::Option::None,
11739 })
11740 }
11741
11742 /// Sets the value of [queries][crate::model::PigJob::queries]
11743 /// to hold a `QueryList`.
11744 ///
11745 /// Note that all the setters affecting `queries` are
11746 /// mutually exclusive.
11747 ///
11748 /// # Example
11749 /// ```ignore,no_run
11750 /// # use google_cloud_dataproc_v1::model::PigJob;
11751 /// use google_cloud_dataproc_v1::model::QueryList;
11752 /// let x = PigJob::new().set_query_list(QueryList::default()/* use setters */);
11753 /// assert!(x.query_list().is_some());
11754 /// assert!(x.query_file_uri().is_none());
11755 /// ```
11756 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11757 mut self,
11758 v: T,
11759 ) -> Self {
11760 self.queries =
11761 std::option::Option::Some(crate::model::pig_job::Queries::QueryList(v.into()));
11762 self
11763 }
11764}
11765
11766impl wkt::message::Message for PigJob {
11767 fn typename() -> &'static str {
11768 "type.googleapis.com/google.cloud.dataproc.v1.PigJob"
11769 }
11770}
11771
11772/// Defines additional types related to [PigJob].
11773pub mod pig_job {
11774 #[allow(unused_imports)]
11775 use super::*;
11776
11777 /// Required. The sequence of Pig queries to execute, specified as an HCFS
11778 /// file URI or a list of queries.
11779 #[derive(Clone, Debug, PartialEq)]
11780 #[non_exhaustive]
11781 pub enum Queries {
11782 /// The HCFS URI of the script that contains the Pig queries.
11783 QueryFileUri(std::string::String),
11784 /// A list of queries.
11785 QueryList(std::boxed::Box<crate::model::QueryList>),
11786 }
11787}
11788
11789/// A Dataproc job for running
11790/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
11791/// applications on YARN.
11792#[derive(Clone, Default, PartialEq)]
11793#[non_exhaustive]
11794pub struct SparkRJob {
11795 /// Required. The HCFS URI of the main R file to use as the driver.
11796 /// Must be a .R file.
11797 pub main_r_file_uri: std::string::String,
11798
11799 /// Optional. The arguments to pass to the driver. Do not include arguments,
11800 /// such as `--conf`, that can be set as job properties, since a collision may
11801 /// occur that causes an incorrect job submission.
11802 pub args: std::vec::Vec<std::string::String>,
11803
11804 /// Optional. HCFS URIs of files to be placed in the working directory of
11805 /// each executor. Useful for naively parallel tasks.
11806 pub file_uris: std::vec::Vec<std::string::String>,
11807
11808 /// Optional. HCFS URIs of archives to be extracted into the working directory
11809 /// of each executor. Supported file types:
11810 /// .jar, .tar, .tar.gz, .tgz, and .zip.
11811 pub archive_uris: std::vec::Vec<std::string::String>,
11812
11813 /// Optional. A mapping of property names to values, used to configure SparkR.
11814 /// Properties that conflict with values set by the Dataproc API might be
11815 /// overwritten. Can include properties set in
11816 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
11817 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11818
11819 /// Optional. The runtime log config for job execution.
11820 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11821
11822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11823}
11824
11825impl SparkRJob {
11826 pub fn new() -> Self {
11827 std::default::Default::default()
11828 }
11829
11830 /// Sets the value of [main_r_file_uri][crate::model::SparkRJob::main_r_file_uri].
11831 ///
11832 /// # Example
11833 /// ```ignore,no_run
11834 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11835 /// let x = SparkRJob::new().set_main_r_file_uri("example");
11836 /// ```
11837 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11838 self.main_r_file_uri = v.into();
11839 self
11840 }
11841
11842 /// Sets the value of [args][crate::model::SparkRJob::args].
11843 ///
11844 /// # Example
11845 /// ```ignore,no_run
11846 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11847 /// let x = SparkRJob::new().set_args(["a", "b", "c"]);
11848 /// ```
11849 pub fn set_args<T, V>(mut self, v: T) -> Self
11850 where
11851 T: std::iter::IntoIterator<Item = V>,
11852 V: std::convert::Into<std::string::String>,
11853 {
11854 use std::iter::Iterator;
11855 self.args = v.into_iter().map(|i| i.into()).collect();
11856 self
11857 }
11858
11859 /// Sets the value of [file_uris][crate::model::SparkRJob::file_uris].
11860 ///
11861 /// # Example
11862 /// ```ignore,no_run
11863 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11864 /// let x = SparkRJob::new().set_file_uris(["a", "b", "c"]);
11865 /// ```
11866 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11867 where
11868 T: std::iter::IntoIterator<Item = V>,
11869 V: std::convert::Into<std::string::String>,
11870 {
11871 use std::iter::Iterator;
11872 self.file_uris = v.into_iter().map(|i| i.into()).collect();
11873 self
11874 }
11875
11876 /// Sets the value of [archive_uris][crate::model::SparkRJob::archive_uris].
11877 ///
11878 /// # Example
11879 /// ```ignore,no_run
11880 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11881 /// let x = SparkRJob::new().set_archive_uris(["a", "b", "c"]);
11882 /// ```
11883 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11884 where
11885 T: std::iter::IntoIterator<Item = V>,
11886 V: std::convert::Into<std::string::String>,
11887 {
11888 use std::iter::Iterator;
11889 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11890 self
11891 }
11892
11893 /// Sets the value of [properties][crate::model::SparkRJob::properties].
11894 ///
11895 /// # Example
11896 /// ```ignore,no_run
11897 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11898 /// let x = SparkRJob::new().set_properties([
11899 /// ("key0", "abc"),
11900 /// ("key1", "xyz"),
11901 /// ]);
11902 /// ```
11903 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11904 where
11905 T: std::iter::IntoIterator<Item = (K, V)>,
11906 K: std::convert::Into<std::string::String>,
11907 V: std::convert::Into<std::string::String>,
11908 {
11909 use std::iter::Iterator;
11910 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11911 self
11912 }
11913
11914 /// Sets the value of [logging_config][crate::model::SparkRJob::logging_config].
11915 ///
11916 /// # Example
11917 /// ```ignore,no_run
11918 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11919 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11920 /// let x = SparkRJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11921 /// ```
11922 pub fn set_logging_config<T>(mut self, v: T) -> Self
11923 where
11924 T: std::convert::Into<crate::model::LoggingConfig>,
11925 {
11926 self.logging_config = std::option::Option::Some(v.into());
11927 self
11928 }
11929
11930 /// Sets or clears the value of [logging_config][crate::model::SparkRJob::logging_config].
11931 ///
11932 /// # Example
11933 /// ```ignore,no_run
11934 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11935 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11936 /// let x = SparkRJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11937 /// let x = SparkRJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11938 /// ```
11939 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11940 where
11941 T: std::convert::Into<crate::model::LoggingConfig>,
11942 {
11943 self.logging_config = v.map(|x| x.into());
11944 self
11945 }
11946}
11947
11948impl wkt::message::Message for SparkRJob {
11949 fn typename() -> &'static str {
11950 "type.googleapis.com/google.cloud.dataproc.v1.SparkRJob"
11951 }
11952}
11953
11954/// A Dataproc job for running [Presto](https://prestosql.io/) queries.
11955/// **IMPORTANT**: The [Dataproc Presto Optional
11956/// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto)
11957/// must be enabled when the cluster is created to submit a Presto job to the
11958/// cluster.
11959#[derive(Clone, Default, PartialEq)]
11960#[non_exhaustive]
11961pub struct PrestoJob {
11962 /// Optional. Whether to continue executing queries if a query fails.
11963 /// The default value is `false`. Setting to `true` can be useful when
11964 /// executing independent parallel queries.
11965 pub continue_on_failure: bool,
11966
11967 /// Optional. The format in which query output will be displayed. See the
11968 /// Presto documentation for supported output formats
11969 pub output_format: std::string::String,
11970
11971 /// Optional. Presto client tags to attach to this query
11972 pub client_tags: std::vec::Vec<std::string::String>,
11973
11974 /// Optional. A mapping of property names to values. Used to set Presto
11975 /// [session properties](https://prestodb.io/docs/current/sql/set-session.html)
11976 /// Equivalent to using the --session flag in the Presto CLI
11977 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11978
11979 /// Optional. The runtime log config for job execution.
11980 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11981
11982 /// Required. The sequence of Presto queries to execute, specified as
11983 /// either an HCFS file URI or as a list of queries.
11984 pub queries: std::option::Option<crate::model::presto_job::Queries>,
11985
11986 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11987}
11988
11989impl PrestoJob {
11990 pub fn new() -> Self {
11991 std::default::Default::default()
11992 }
11993
11994 /// Sets the value of [continue_on_failure][crate::model::PrestoJob::continue_on_failure].
11995 ///
11996 /// # Example
11997 /// ```ignore,no_run
11998 /// # use google_cloud_dataproc_v1::model::PrestoJob;
11999 /// let x = PrestoJob::new().set_continue_on_failure(true);
12000 /// ```
12001 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12002 self.continue_on_failure = v.into();
12003 self
12004 }
12005
12006 /// Sets the value of [output_format][crate::model::PrestoJob::output_format].
12007 ///
12008 /// # Example
12009 /// ```ignore,no_run
12010 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12011 /// let x = PrestoJob::new().set_output_format("example");
12012 /// ```
12013 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12014 self.output_format = v.into();
12015 self
12016 }
12017
12018 /// Sets the value of [client_tags][crate::model::PrestoJob::client_tags].
12019 ///
12020 /// # Example
12021 /// ```ignore,no_run
12022 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12023 /// let x = PrestoJob::new().set_client_tags(["a", "b", "c"]);
12024 /// ```
12025 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12026 where
12027 T: std::iter::IntoIterator<Item = V>,
12028 V: std::convert::Into<std::string::String>,
12029 {
12030 use std::iter::Iterator;
12031 self.client_tags = v.into_iter().map(|i| i.into()).collect();
12032 self
12033 }
12034
12035 /// Sets the value of [properties][crate::model::PrestoJob::properties].
12036 ///
12037 /// # Example
12038 /// ```ignore,no_run
12039 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12040 /// let x = PrestoJob::new().set_properties([
12041 /// ("key0", "abc"),
12042 /// ("key1", "xyz"),
12043 /// ]);
12044 /// ```
12045 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12046 where
12047 T: std::iter::IntoIterator<Item = (K, V)>,
12048 K: std::convert::Into<std::string::String>,
12049 V: std::convert::Into<std::string::String>,
12050 {
12051 use std::iter::Iterator;
12052 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12053 self
12054 }
12055
12056 /// Sets the value of [logging_config][crate::model::PrestoJob::logging_config].
12057 ///
12058 /// # Example
12059 /// ```ignore,no_run
12060 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12061 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12062 /// let x = PrestoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12063 /// ```
12064 pub fn set_logging_config<T>(mut self, v: T) -> Self
12065 where
12066 T: std::convert::Into<crate::model::LoggingConfig>,
12067 {
12068 self.logging_config = std::option::Option::Some(v.into());
12069 self
12070 }
12071
12072 /// Sets or clears the value of [logging_config][crate::model::PrestoJob::logging_config].
12073 ///
12074 /// # Example
12075 /// ```ignore,no_run
12076 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12077 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12078 /// let x = PrestoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12079 /// let x = PrestoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12080 /// ```
12081 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12082 where
12083 T: std::convert::Into<crate::model::LoggingConfig>,
12084 {
12085 self.logging_config = v.map(|x| x.into());
12086 self
12087 }
12088
12089 /// Sets the value of [queries][crate::model::PrestoJob::queries].
12090 ///
12091 /// Note that all the setters affecting `queries` are mutually
12092 /// exclusive.
12093 ///
12094 /// # Example
12095 /// ```ignore,no_run
12096 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12097 /// use google_cloud_dataproc_v1::model::presto_job::Queries;
12098 /// let x = PrestoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12099 /// ```
12100 pub fn set_queries<
12101 T: std::convert::Into<std::option::Option<crate::model::presto_job::Queries>>,
12102 >(
12103 mut self,
12104 v: T,
12105 ) -> Self {
12106 self.queries = v.into();
12107 self
12108 }
12109
12110 /// The value of [queries][crate::model::PrestoJob::queries]
12111 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12112 /// holds a different branch.
12113 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12114 #[allow(unreachable_patterns)]
12115 self.queries.as_ref().and_then(|v| match v {
12116 crate::model::presto_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12117 _ => std::option::Option::None,
12118 })
12119 }
12120
12121 /// Sets the value of [queries][crate::model::PrestoJob::queries]
12122 /// to hold a `QueryFileUri`.
12123 ///
12124 /// Note that all the setters affecting `queries` are
12125 /// mutually exclusive.
12126 ///
12127 /// # Example
12128 /// ```ignore,no_run
12129 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12130 /// let x = PrestoJob::new().set_query_file_uri("example");
12131 /// assert!(x.query_file_uri().is_some());
12132 /// assert!(x.query_list().is_none());
12133 /// ```
12134 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12135 self.queries =
12136 std::option::Option::Some(crate::model::presto_job::Queries::QueryFileUri(v.into()));
12137 self
12138 }
12139
12140 /// The value of [queries][crate::model::PrestoJob::queries]
12141 /// if it holds a `QueryList`, `None` if the field is not set or
12142 /// holds a different branch.
12143 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12144 #[allow(unreachable_patterns)]
12145 self.queries.as_ref().and_then(|v| match v {
12146 crate::model::presto_job::Queries::QueryList(v) => std::option::Option::Some(v),
12147 _ => std::option::Option::None,
12148 })
12149 }
12150
12151 /// Sets the value of [queries][crate::model::PrestoJob::queries]
12152 /// to hold a `QueryList`.
12153 ///
12154 /// Note that all the setters affecting `queries` are
12155 /// mutually exclusive.
12156 ///
12157 /// # Example
12158 /// ```ignore,no_run
12159 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12160 /// use google_cloud_dataproc_v1::model::QueryList;
12161 /// let x = PrestoJob::new().set_query_list(QueryList::default()/* use setters */);
12162 /// assert!(x.query_list().is_some());
12163 /// assert!(x.query_file_uri().is_none());
12164 /// ```
12165 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12166 mut self,
12167 v: T,
12168 ) -> Self {
12169 self.queries =
12170 std::option::Option::Some(crate::model::presto_job::Queries::QueryList(v.into()));
12171 self
12172 }
12173}
12174
12175impl wkt::message::Message for PrestoJob {
12176 fn typename() -> &'static str {
12177 "type.googleapis.com/google.cloud.dataproc.v1.PrestoJob"
12178 }
12179}
12180
12181/// Defines additional types related to [PrestoJob].
12182pub mod presto_job {
12183 #[allow(unused_imports)]
12184 use super::*;
12185
12186 /// Required. The sequence of Presto queries to execute, specified as
12187 /// either an HCFS file URI or as a list of queries.
12188 #[derive(Clone, Debug, PartialEq)]
12189 #[non_exhaustive]
12190 pub enum Queries {
12191 /// The HCFS URI of the script that contains SQL queries.
12192 QueryFileUri(std::string::String),
12193 /// A list of queries.
12194 QueryList(std::boxed::Box<crate::model::QueryList>),
12195 }
12196}
12197
12198/// A Dataproc job for running [Trino](https://trino.io/) queries.
12199/// **IMPORTANT**: The [Dataproc Trino Optional
12200/// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino)
12201/// must be enabled when the cluster is created to submit a Trino job to the
12202/// cluster.
12203#[derive(Clone, Default, PartialEq)]
12204#[non_exhaustive]
12205pub struct TrinoJob {
12206 /// Optional. Whether to continue executing queries if a query fails.
12207 /// The default value is `false`. Setting to `true` can be useful when
12208 /// executing independent parallel queries.
12209 pub continue_on_failure: bool,
12210
12211 /// Optional. The format in which query output will be displayed. See the
12212 /// Trino documentation for supported output formats
12213 pub output_format: std::string::String,
12214
12215 /// Optional. Trino client tags to attach to this query
12216 pub client_tags: std::vec::Vec<std::string::String>,
12217
12218 /// Optional. A mapping of property names to values. Used to set Trino
12219 /// [session properties](https://trino.io/docs/current/sql/set-session.html)
12220 /// Equivalent to using the --session flag in the Trino CLI
12221 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12222
12223 /// Optional. The runtime log config for job execution.
12224 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12225
12226 /// Required. The sequence of Trino queries to execute, specified as
12227 /// either an HCFS file URI or as a list of queries.
12228 pub queries: std::option::Option<crate::model::trino_job::Queries>,
12229
12230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12231}
12232
12233impl TrinoJob {
12234 pub fn new() -> Self {
12235 std::default::Default::default()
12236 }
12237
12238 /// Sets the value of [continue_on_failure][crate::model::TrinoJob::continue_on_failure].
12239 ///
12240 /// # Example
12241 /// ```ignore,no_run
12242 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12243 /// let x = TrinoJob::new().set_continue_on_failure(true);
12244 /// ```
12245 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12246 self.continue_on_failure = v.into();
12247 self
12248 }
12249
12250 /// Sets the value of [output_format][crate::model::TrinoJob::output_format].
12251 ///
12252 /// # Example
12253 /// ```ignore,no_run
12254 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12255 /// let x = TrinoJob::new().set_output_format("example");
12256 /// ```
12257 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12258 self.output_format = v.into();
12259 self
12260 }
12261
12262 /// Sets the value of [client_tags][crate::model::TrinoJob::client_tags].
12263 ///
12264 /// # Example
12265 /// ```ignore,no_run
12266 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12267 /// let x = TrinoJob::new().set_client_tags(["a", "b", "c"]);
12268 /// ```
12269 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12270 where
12271 T: std::iter::IntoIterator<Item = V>,
12272 V: std::convert::Into<std::string::String>,
12273 {
12274 use std::iter::Iterator;
12275 self.client_tags = v.into_iter().map(|i| i.into()).collect();
12276 self
12277 }
12278
12279 /// Sets the value of [properties][crate::model::TrinoJob::properties].
12280 ///
12281 /// # Example
12282 /// ```ignore,no_run
12283 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12284 /// let x = TrinoJob::new().set_properties([
12285 /// ("key0", "abc"),
12286 /// ("key1", "xyz"),
12287 /// ]);
12288 /// ```
12289 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12290 where
12291 T: std::iter::IntoIterator<Item = (K, V)>,
12292 K: std::convert::Into<std::string::String>,
12293 V: std::convert::Into<std::string::String>,
12294 {
12295 use std::iter::Iterator;
12296 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12297 self
12298 }
12299
12300 /// Sets the value of [logging_config][crate::model::TrinoJob::logging_config].
12301 ///
12302 /// # Example
12303 /// ```ignore,no_run
12304 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12305 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12306 /// let x = TrinoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12307 /// ```
12308 pub fn set_logging_config<T>(mut self, v: T) -> Self
12309 where
12310 T: std::convert::Into<crate::model::LoggingConfig>,
12311 {
12312 self.logging_config = std::option::Option::Some(v.into());
12313 self
12314 }
12315
12316 /// Sets or clears the value of [logging_config][crate::model::TrinoJob::logging_config].
12317 ///
12318 /// # Example
12319 /// ```ignore,no_run
12320 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12321 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12322 /// let x = TrinoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12323 /// let x = TrinoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12324 /// ```
12325 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12326 where
12327 T: std::convert::Into<crate::model::LoggingConfig>,
12328 {
12329 self.logging_config = v.map(|x| x.into());
12330 self
12331 }
12332
12333 /// Sets the value of [queries][crate::model::TrinoJob::queries].
12334 ///
12335 /// Note that all the setters affecting `queries` are mutually
12336 /// exclusive.
12337 ///
12338 /// # Example
12339 /// ```ignore,no_run
12340 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12341 /// use google_cloud_dataproc_v1::model::trino_job::Queries;
12342 /// let x = TrinoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12343 /// ```
12344 pub fn set_queries<
12345 T: std::convert::Into<std::option::Option<crate::model::trino_job::Queries>>,
12346 >(
12347 mut self,
12348 v: T,
12349 ) -> Self {
12350 self.queries = v.into();
12351 self
12352 }
12353
12354 /// The value of [queries][crate::model::TrinoJob::queries]
12355 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12356 /// holds a different branch.
12357 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12358 #[allow(unreachable_patterns)]
12359 self.queries.as_ref().and_then(|v| match v {
12360 crate::model::trino_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12361 _ => std::option::Option::None,
12362 })
12363 }
12364
12365 /// Sets the value of [queries][crate::model::TrinoJob::queries]
12366 /// to hold a `QueryFileUri`.
12367 ///
12368 /// Note that all the setters affecting `queries` are
12369 /// mutually exclusive.
12370 ///
12371 /// # Example
12372 /// ```ignore,no_run
12373 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12374 /// let x = TrinoJob::new().set_query_file_uri("example");
12375 /// assert!(x.query_file_uri().is_some());
12376 /// assert!(x.query_list().is_none());
12377 /// ```
12378 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12379 self.queries =
12380 std::option::Option::Some(crate::model::trino_job::Queries::QueryFileUri(v.into()));
12381 self
12382 }
12383
12384 /// The value of [queries][crate::model::TrinoJob::queries]
12385 /// if it holds a `QueryList`, `None` if the field is not set or
12386 /// holds a different branch.
12387 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12388 #[allow(unreachable_patterns)]
12389 self.queries.as_ref().and_then(|v| match v {
12390 crate::model::trino_job::Queries::QueryList(v) => std::option::Option::Some(v),
12391 _ => std::option::Option::None,
12392 })
12393 }
12394
12395 /// Sets the value of [queries][crate::model::TrinoJob::queries]
12396 /// to hold a `QueryList`.
12397 ///
12398 /// Note that all the setters affecting `queries` are
12399 /// mutually exclusive.
12400 ///
12401 /// # Example
12402 /// ```ignore,no_run
12403 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12404 /// use google_cloud_dataproc_v1::model::QueryList;
12405 /// let x = TrinoJob::new().set_query_list(QueryList::default()/* use setters */);
12406 /// assert!(x.query_list().is_some());
12407 /// assert!(x.query_file_uri().is_none());
12408 /// ```
12409 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12410 mut self,
12411 v: T,
12412 ) -> Self {
12413 self.queries =
12414 std::option::Option::Some(crate::model::trino_job::Queries::QueryList(v.into()));
12415 self
12416 }
12417}
12418
12419impl wkt::message::Message for TrinoJob {
12420 fn typename() -> &'static str {
12421 "type.googleapis.com/google.cloud.dataproc.v1.TrinoJob"
12422 }
12423}
12424
12425/// Defines additional types related to [TrinoJob].
12426pub mod trino_job {
12427 #[allow(unused_imports)]
12428 use super::*;
12429
12430 /// Required. The sequence of Trino queries to execute, specified as
12431 /// either an HCFS file URI or as a list of queries.
12432 #[derive(Clone, Debug, PartialEq)]
12433 #[non_exhaustive]
12434 pub enum Queries {
12435 /// The HCFS URI of the script that contains SQL queries.
12436 QueryFileUri(std::string::String),
12437 /// A list of queries.
12438 QueryList(std::boxed::Box<crate::model::QueryList>),
12439 }
12440}
12441
12442/// A Dataproc job for running Apache Flink applications on YARN.
12443#[derive(Clone, Default, PartialEq)]
12444#[non_exhaustive]
12445pub struct FlinkJob {
12446 /// Optional. The arguments to pass to the driver. Do not include arguments,
12447 /// such as `--conf`, that can be set as job properties, since a collision
12448 /// might occur that causes an incorrect job submission.
12449 pub args: std::vec::Vec<std::string::String>,
12450
12451 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
12452 /// Flink driver and tasks.
12453 pub jar_file_uris: std::vec::Vec<std::string::String>,
12454
12455 /// Optional. HCFS URI of the savepoint, which contains the last saved progress
12456 /// for starting the current job.
12457 pub savepoint_uri: std::string::String,
12458
12459 /// Optional. A mapping of property names to values, used to configure Flink.
12460 /// Properties that conflict with values set by the Dataproc API might be
12461 /// overwritten. Can include properties set in
12462 /// `/etc/flink/conf/flink-defaults.conf` and classes in user code.
12463 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12464
12465 /// Optional. The runtime log config for job execution.
12466 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12467
12468 /// Required. The specification of the main method to call to drive the job.
12469 /// Specify either the jar file that contains the main class or the main class
12470 /// name. To pass both a main jar and a main class in the jar, add the jar to
12471 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
12472 /// specify the main class name in
12473 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
12474 ///
12475 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
12476 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
12477 pub driver: std::option::Option<crate::model::flink_job::Driver>,
12478
12479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12480}
12481
12482impl FlinkJob {
12483 pub fn new() -> Self {
12484 std::default::Default::default()
12485 }
12486
12487 /// Sets the value of [args][crate::model::FlinkJob::args].
12488 ///
12489 /// # Example
12490 /// ```ignore,no_run
12491 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12492 /// let x = FlinkJob::new().set_args(["a", "b", "c"]);
12493 /// ```
12494 pub fn set_args<T, V>(mut self, v: T) -> Self
12495 where
12496 T: std::iter::IntoIterator<Item = V>,
12497 V: std::convert::Into<std::string::String>,
12498 {
12499 use std::iter::Iterator;
12500 self.args = v.into_iter().map(|i| i.into()).collect();
12501 self
12502 }
12503
12504 /// Sets the value of [jar_file_uris][crate::model::FlinkJob::jar_file_uris].
12505 ///
12506 /// # Example
12507 /// ```ignore,no_run
12508 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12509 /// let x = FlinkJob::new().set_jar_file_uris(["a", "b", "c"]);
12510 /// ```
12511 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12512 where
12513 T: std::iter::IntoIterator<Item = V>,
12514 V: std::convert::Into<std::string::String>,
12515 {
12516 use std::iter::Iterator;
12517 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12518 self
12519 }
12520
12521 /// Sets the value of [savepoint_uri][crate::model::FlinkJob::savepoint_uri].
12522 ///
12523 /// # Example
12524 /// ```ignore,no_run
12525 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12526 /// let x = FlinkJob::new().set_savepoint_uri("example");
12527 /// ```
12528 pub fn set_savepoint_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12529 self.savepoint_uri = v.into();
12530 self
12531 }
12532
12533 /// Sets the value of [properties][crate::model::FlinkJob::properties].
12534 ///
12535 /// # Example
12536 /// ```ignore,no_run
12537 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12538 /// let x = FlinkJob::new().set_properties([
12539 /// ("key0", "abc"),
12540 /// ("key1", "xyz"),
12541 /// ]);
12542 /// ```
12543 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12544 where
12545 T: std::iter::IntoIterator<Item = (K, V)>,
12546 K: std::convert::Into<std::string::String>,
12547 V: std::convert::Into<std::string::String>,
12548 {
12549 use std::iter::Iterator;
12550 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12551 self
12552 }
12553
12554 /// Sets the value of [logging_config][crate::model::FlinkJob::logging_config].
12555 ///
12556 /// # Example
12557 /// ```ignore,no_run
12558 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12559 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12560 /// let x = FlinkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12561 /// ```
12562 pub fn set_logging_config<T>(mut self, v: T) -> Self
12563 where
12564 T: std::convert::Into<crate::model::LoggingConfig>,
12565 {
12566 self.logging_config = std::option::Option::Some(v.into());
12567 self
12568 }
12569
12570 /// Sets or clears the value of [logging_config][crate::model::FlinkJob::logging_config].
12571 ///
12572 /// # Example
12573 /// ```ignore,no_run
12574 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12575 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12576 /// let x = FlinkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12577 /// let x = FlinkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12578 /// ```
12579 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12580 where
12581 T: std::convert::Into<crate::model::LoggingConfig>,
12582 {
12583 self.logging_config = v.map(|x| x.into());
12584 self
12585 }
12586
12587 /// Sets the value of [driver][crate::model::FlinkJob::driver].
12588 ///
12589 /// Note that all the setters affecting `driver` are mutually
12590 /// exclusive.
12591 ///
12592 /// # Example
12593 /// ```ignore,no_run
12594 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12595 /// use google_cloud_dataproc_v1::model::flink_job::Driver;
12596 /// let x = FlinkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
12597 /// ```
12598 pub fn set_driver<
12599 T: std::convert::Into<std::option::Option<crate::model::flink_job::Driver>>,
12600 >(
12601 mut self,
12602 v: T,
12603 ) -> Self {
12604 self.driver = v.into();
12605 self
12606 }
12607
12608 /// The value of [driver][crate::model::FlinkJob::driver]
12609 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
12610 /// holds a different branch.
12611 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
12612 #[allow(unreachable_patterns)]
12613 self.driver.as_ref().and_then(|v| match v {
12614 crate::model::flink_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
12615 _ => std::option::Option::None,
12616 })
12617 }
12618
12619 /// Sets the value of [driver][crate::model::FlinkJob::driver]
12620 /// to hold a `MainJarFileUri`.
12621 ///
12622 /// Note that all the setters affecting `driver` are
12623 /// mutually exclusive.
12624 ///
12625 /// # Example
12626 /// ```ignore,no_run
12627 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12628 /// let x = FlinkJob::new().set_main_jar_file_uri("example");
12629 /// assert!(x.main_jar_file_uri().is_some());
12630 /// assert!(x.main_class().is_none());
12631 /// ```
12632 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
12633 mut self,
12634 v: T,
12635 ) -> Self {
12636 self.driver =
12637 std::option::Option::Some(crate::model::flink_job::Driver::MainJarFileUri(v.into()));
12638 self
12639 }
12640
12641 /// The value of [driver][crate::model::FlinkJob::driver]
12642 /// if it holds a `MainClass`, `None` if the field is not set or
12643 /// holds a different branch.
12644 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
12645 #[allow(unreachable_patterns)]
12646 self.driver.as_ref().and_then(|v| match v {
12647 crate::model::flink_job::Driver::MainClass(v) => std::option::Option::Some(v),
12648 _ => std::option::Option::None,
12649 })
12650 }
12651
12652 /// Sets the value of [driver][crate::model::FlinkJob::driver]
12653 /// to hold a `MainClass`.
12654 ///
12655 /// Note that all the setters affecting `driver` are
12656 /// mutually exclusive.
12657 ///
12658 /// # Example
12659 /// ```ignore,no_run
12660 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12661 /// let x = FlinkJob::new().set_main_class("example");
12662 /// assert!(x.main_class().is_some());
12663 /// assert!(x.main_jar_file_uri().is_none());
12664 /// ```
12665 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12666 self.driver =
12667 std::option::Option::Some(crate::model::flink_job::Driver::MainClass(v.into()));
12668 self
12669 }
12670}
12671
12672impl wkt::message::Message for FlinkJob {
12673 fn typename() -> &'static str {
12674 "type.googleapis.com/google.cloud.dataproc.v1.FlinkJob"
12675 }
12676}
12677
12678/// Defines additional types related to [FlinkJob].
12679pub mod flink_job {
12680 #[allow(unused_imports)]
12681 use super::*;
12682
12683 /// Required. The specification of the main method to call to drive the job.
12684 /// Specify either the jar file that contains the main class or the main class
12685 /// name. To pass both a main jar and a main class in the jar, add the jar to
12686 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
12687 /// specify the main class name in
12688 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
12689 ///
12690 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
12691 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
12692 #[derive(Clone, Debug, PartialEq)]
12693 #[non_exhaustive]
12694 pub enum Driver {
12695 /// The HCFS URI of the jar file that contains the main class.
12696 MainJarFileUri(std::string::String),
12697 /// The name of the driver's main class. The jar file that contains the class
12698 /// must be in the default CLASSPATH or specified in
12699 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris].
12700 ///
12701 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
12702 MainClass(std::string::String),
12703 }
12704}
12705
12706/// Dataproc job config.
12707#[derive(Clone, Default, PartialEq)]
12708#[non_exhaustive]
12709pub struct JobPlacement {
12710 /// Required. The name of the cluster where the job will be submitted.
12711 pub cluster_name: std::string::String,
12712
12713 /// Output only. A cluster UUID generated by the Dataproc service when
12714 /// the job is submitted.
12715 pub cluster_uuid: std::string::String,
12716
12717 /// Optional. Cluster labels to identify a cluster where the job will be
12718 /// submitted.
12719 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
12720
12721 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12722}
12723
12724impl JobPlacement {
12725 pub fn new() -> Self {
12726 std::default::Default::default()
12727 }
12728
12729 /// Sets the value of [cluster_name][crate::model::JobPlacement::cluster_name].
12730 ///
12731 /// # Example
12732 /// ```ignore,no_run
12733 /// # use google_cloud_dataproc_v1::model::JobPlacement;
12734 /// let x = JobPlacement::new().set_cluster_name("example");
12735 /// ```
12736 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12737 self.cluster_name = v.into();
12738 self
12739 }
12740
12741 /// Sets the value of [cluster_uuid][crate::model::JobPlacement::cluster_uuid].
12742 ///
12743 /// # Example
12744 /// ```ignore,no_run
12745 /// # use google_cloud_dataproc_v1::model::JobPlacement;
12746 /// let x = JobPlacement::new().set_cluster_uuid("example");
12747 /// ```
12748 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12749 self.cluster_uuid = v.into();
12750 self
12751 }
12752
12753 /// Sets the value of [cluster_labels][crate::model::JobPlacement::cluster_labels].
12754 ///
12755 /// # Example
12756 /// ```ignore,no_run
12757 /// # use google_cloud_dataproc_v1::model::JobPlacement;
12758 /// let x = JobPlacement::new().set_cluster_labels([
12759 /// ("key0", "abc"),
12760 /// ("key1", "xyz"),
12761 /// ]);
12762 /// ```
12763 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
12764 where
12765 T: std::iter::IntoIterator<Item = (K, V)>,
12766 K: std::convert::Into<std::string::String>,
12767 V: std::convert::Into<std::string::String>,
12768 {
12769 use std::iter::Iterator;
12770 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12771 self
12772 }
12773}
12774
12775impl wkt::message::Message for JobPlacement {
12776 fn typename() -> &'static str {
12777 "type.googleapis.com/google.cloud.dataproc.v1.JobPlacement"
12778 }
12779}
12780
12781/// Dataproc job status.
12782#[derive(Clone, Default, PartialEq)]
12783#[non_exhaustive]
12784pub struct JobStatus {
12785 /// Output only. A state message specifying the overall job state.
12786 pub state: crate::model::job_status::State,
12787
12788 /// Optional. Output only. Job state details, such as an error
12789 /// description if the state is `ERROR`.
12790 pub details: std::string::String,
12791
12792 /// Output only. The time when this state was entered.
12793 pub state_start_time: std::option::Option<wkt::Timestamp>,
12794
12795 /// Output only. Additional state information, which includes
12796 /// status reported by the agent.
12797 pub substate: crate::model::job_status::Substate,
12798
12799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12800}
12801
12802impl JobStatus {
12803 pub fn new() -> Self {
12804 std::default::Default::default()
12805 }
12806
12807 /// Sets the value of [state][crate::model::JobStatus::state].
12808 ///
12809 /// # Example
12810 /// ```ignore,no_run
12811 /// # use google_cloud_dataproc_v1::model::JobStatus;
12812 /// use google_cloud_dataproc_v1::model::job_status::State;
12813 /// let x0 = JobStatus::new().set_state(State::Pending);
12814 /// let x1 = JobStatus::new().set_state(State::SetupDone);
12815 /// let x2 = JobStatus::new().set_state(State::Running);
12816 /// ```
12817 pub fn set_state<T: std::convert::Into<crate::model::job_status::State>>(
12818 mut self,
12819 v: T,
12820 ) -> Self {
12821 self.state = v.into();
12822 self
12823 }
12824
12825 /// Sets the value of [details][crate::model::JobStatus::details].
12826 ///
12827 /// # Example
12828 /// ```ignore,no_run
12829 /// # use google_cloud_dataproc_v1::model::JobStatus;
12830 /// let x = JobStatus::new().set_details("example");
12831 /// ```
12832 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12833 self.details = v.into();
12834 self
12835 }
12836
12837 /// Sets the value of [state_start_time][crate::model::JobStatus::state_start_time].
12838 ///
12839 /// # Example
12840 /// ```ignore,no_run
12841 /// # use google_cloud_dataproc_v1::model::JobStatus;
12842 /// use wkt::Timestamp;
12843 /// let x = JobStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
12844 /// ```
12845 pub fn set_state_start_time<T>(mut self, v: T) -> Self
12846 where
12847 T: std::convert::Into<wkt::Timestamp>,
12848 {
12849 self.state_start_time = std::option::Option::Some(v.into());
12850 self
12851 }
12852
12853 /// Sets or clears the value of [state_start_time][crate::model::JobStatus::state_start_time].
12854 ///
12855 /// # Example
12856 /// ```ignore,no_run
12857 /// # use google_cloud_dataproc_v1::model::JobStatus;
12858 /// use wkt::Timestamp;
12859 /// let x = JobStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
12860 /// let x = JobStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
12861 /// ```
12862 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
12863 where
12864 T: std::convert::Into<wkt::Timestamp>,
12865 {
12866 self.state_start_time = v.map(|x| x.into());
12867 self
12868 }
12869
12870 /// Sets the value of [substate][crate::model::JobStatus::substate].
12871 ///
12872 /// # Example
12873 /// ```ignore,no_run
12874 /// # use google_cloud_dataproc_v1::model::JobStatus;
12875 /// use google_cloud_dataproc_v1::model::job_status::Substate;
12876 /// let x0 = JobStatus::new().set_substate(Substate::Submitted);
12877 /// let x1 = JobStatus::new().set_substate(Substate::Queued);
12878 /// let x2 = JobStatus::new().set_substate(Substate::StaleStatus);
12879 /// ```
12880 pub fn set_substate<T: std::convert::Into<crate::model::job_status::Substate>>(
12881 mut self,
12882 v: T,
12883 ) -> Self {
12884 self.substate = v.into();
12885 self
12886 }
12887}
12888
12889impl wkt::message::Message for JobStatus {
12890 fn typename() -> &'static str {
12891 "type.googleapis.com/google.cloud.dataproc.v1.JobStatus"
12892 }
12893}
12894
12895/// Defines additional types related to [JobStatus].
12896pub mod job_status {
12897 #[allow(unused_imports)]
12898 use super::*;
12899
12900 /// The job state.
12901 ///
12902 /// # Working with unknown values
12903 ///
12904 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12905 /// additional enum variants at any time. Adding new variants is not considered
12906 /// a breaking change. Applications should write their code in anticipation of:
12907 ///
12908 /// - New values appearing in future releases of the client library, **and**
12909 /// - New values received dynamically, without application changes.
12910 ///
12911 /// Please consult the [Working with enums] section in the user guide for some
12912 /// guidelines.
12913 ///
12914 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12915 #[derive(Clone, Debug, PartialEq)]
12916 #[non_exhaustive]
12917 pub enum State {
12918 /// The job state is unknown.
12919 Unspecified,
12920 /// The job is pending; it has been submitted, but is not yet running.
12921 Pending,
12922 /// Job has been received by the service and completed initial setup;
12923 /// it will soon be submitted to the cluster.
12924 SetupDone,
12925 /// The job is running on the cluster.
12926 Running,
12927 /// A CancelJob request has been received, but is pending.
12928 CancelPending,
12929 /// Transient in-flight resources have been canceled, and the request to
12930 /// cancel the running job has been issued to the cluster.
12931 CancelStarted,
12932 /// The job cancellation was successful.
12933 Cancelled,
12934 /// The job has completed successfully.
12935 Done,
12936 /// The job has completed, but encountered an error.
12937 Error,
12938 /// Job attempt has failed. The detail field contains failure details for
12939 /// this attempt.
12940 ///
12941 /// Applies to restartable jobs only.
12942 AttemptFailure,
12943 /// If set, the enum was initialized with an unknown value.
12944 ///
12945 /// Applications can examine the value using [State::value] or
12946 /// [State::name].
12947 UnknownValue(state::UnknownValue),
12948 }
12949
12950 #[doc(hidden)]
12951 pub mod state {
12952 #[allow(unused_imports)]
12953 use super::*;
12954 #[derive(Clone, Debug, PartialEq)]
12955 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12956 }
12957
12958 impl State {
12959 /// Gets the enum value.
12960 ///
12961 /// Returns `None` if the enum contains an unknown value deserialized from
12962 /// the string representation of enums.
12963 pub fn value(&self) -> std::option::Option<i32> {
12964 match self {
12965 Self::Unspecified => std::option::Option::Some(0),
12966 Self::Pending => std::option::Option::Some(1),
12967 Self::SetupDone => std::option::Option::Some(8),
12968 Self::Running => std::option::Option::Some(2),
12969 Self::CancelPending => std::option::Option::Some(3),
12970 Self::CancelStarted => std::option::Option::Some(7),
12971 Self::Cancelled => std::option::Option::Some(4),
12972 Self::Done => std::option::Option::Some(5),
12973 Self::Error => std::option::Option::Some(6),
12974 Self::AttemptFailure => std::option::Option::Some(9),
12975 Self::UnknownValue(u) => u.0.value(),
12976 }
12977 }
12978
12979 /// Gets the enum value as a string.
12980 ///
12981 /// Returns `None` if the enum contains an unknown value deserialized from
12982 /// the integer representation of enums.
12983 pub fn name(&self) -> std::option::Option<&str> {
12984 match self {
12985 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12986 Self::Pending => std::option::Option::Some("PENDING"),
12987 Self::SetupDone => std::option::Option::Some("SETUP_DONE"),
12988 Self::Running => std::option::Option::Some("RUNNING"),
12989 Self::CancelPending => std::option::Option::Some("CANCEL_PENDING"),
12990 Self::CancelStarted => std::option::Option::Some("CANCEL_STARTED"),
12991 Self::Cancelled => std::option::Option::Some("CANCELLED"),
12992 Self::Done => std::option::Option::Some("DONE"),
12993 Self::Error => std::option::Option::Some("ERROR"),
12994 Self::AttemptFailure => std::option::Option::Some("ATTEMPT_FAILURE"),
12995 Self::UnknownValue(u) => u.0.name(),
12996 }
12997 }
12998 }
12999
13000 impl std::default::Default for State {
13001 fn default() -> Self {
13002 use std::convert::From;
13003 Self::from(0)
13004 }
13005 }
13006
13007 impl std::fmt::Display for State {
13008 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13009 wkt::internal::display_enum(f, self.name(), self.value())
13010 }
13011 }
13012
13013 impl std::convert::From<i32> for State {
13014 fn from(value: i32) -> Self {
13015 match value {
13016 0 => Self::Unspecified,
13017 1 => Self::Pending,
13018 2 => Self::Running,
13019 3 => Self::CancelPending,
13020 4 => Self::Cancelled,
13021 5 => Self::Done,
13022 6 => Self::Error,
13023 7 => Self::CancelStarted,
13024 8 => Self::SetupDone,
13025 9 => Self::AttemptFailure,
13026 _ => Self::UnknownValue(state::UnknownValue(
13027 wkt::internal::UnknownEnumValue::Integer(value),
13028 )),
13029 }
13030 }
13031 }
13032
13033 impl std::convert::From<&str> for State {
13034 fn from(value: &str) -> Self {
13035 use std::string::ToString;
13036 match value {
13037 "STATE_UNSPECIFIED" => Self::Unspecified,
13038 "PENDING" => Self::Pending,
13039 "SETUP_DONE" => Self::SetupDone,
13040 "RUNNING" => Self::Running,
13041 "CANCEL_PENDING" => Self::CancelPending,
13042 "CANCEL_STARTED" => Self::CancelStarted,
13043 "CANCELLED" => Self::Cancelled,
13044 "DONE" => Self::Done,
13045 "ERROR" => Self::Error,
13046 "ATTEMPT_FAILURE" => Self::AttemptFailure,
13047 _ => Self::UnknownValue(state::UnknownValue(
13048 wkt::internal::UnknownEnumValue::String(value.to_string()),
13049 )),
13050 }
13051 }
13052 }
13053
13054 impl serde::ser::Serialize for State {
13055 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13056 where
13057 S: serde::Serializer,
13058 {
13059 match self {
13060 Self::Unspecified => serializer.serialize_i32(0),
13061 Self::Pending => serializer.serialize_i32(1),
13062 Self::SetupDone => serializer.serialize_i32(8),
13063 Self::Running => serializer.serialize_i32(2),
13064 Self::CancelPending => serializer.serialize_i32(3),
13065 Self::CancelStarted => serializer.serialize_i32(7),
13066 Self::Cancelled => serializer.serialize_i32(4),
13067 Self::Done => serializer.serialize_i32(5),
13068 Self::Error => serializer.serialize_i32(6),
13069 Self::AttemptFailure => serializer.serialize_i32(9),
13070 Self::UnknownValue(u) => u.0.serialize(serializer),
13071 }
13072 }
13073 }
13074
13075 impl<'de> serde::de::Deserialize<'de> for State {
13076 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13077 where
13078 D: serde::Deserializer<'de>,
13079 {
13080 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13081 ".google.cloud.dataproc.v1.JobStatus.State",
13082 ))
13083 }
13084 }
13085
13086 /// The job substate.
13087 ///
13088 /// # Working with unknown values
13089 ///
13090 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13091 /// additional enum variants at any time. Adding new variants is not considered
13092 /// a breaking change. Applications should write their code in anticipation of:
13093 ///
13094 /// - New values appearing in future releases of the client library, **and**
13095 /// - New values received dynamically, without application changes.
13096 ///
13097 /// Please consult the [Working with enums] section in the user guide for some
13098 /// guidelines.
13099 ///
13100 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13101 #[derive(Clone, Debug, PartialEq)]
13102 #[non_exhaustive]
13103 pub enum Substate {
13104 /// The job substate is unknown.
13105 Unspecified,
13106 /// The Job is submitted to the agent.
13107 ///
13108 /// Applies to RUNNING state.
13109 Submitted,
13110 /// The Job has been received and is awaiting execution (it might be waiting
13111 /// for a condition to be met). See the "details" field for the reason for
13112 /// the delay.
13113 ///
13114 /// Applies to RUNNING state.
13115 Queued,
13116 /// The agent-reported status is out of date, which can be caused by a
13117 /// loss of communication between the agent and Dataproc. If the
13118 /// agent does not send a timely update, the job will fail.
13119 ///
13120 /// Applies to RUNNING state.
13121 StaleStatus,
13122 /// If set, the enum was initialized with an unknown value.
13123 ///
13124 /// Applications can examine the value using [Substate::value] or
13125 /// [Substate::name].
13126 UnknownValue(substate::UnknownValue),
13127 }
13128
13129 #[doc(hidden)]
13130 pub mod substate {
13131 #[allow(unused_imports)]
13132 use super::*;
13133 #[derive(Clone, Debug, PartialEq)]
13134 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13135 }
13136
13137 impl Substate {
13138 /// Gets the enum value.
13139 ///
13140 /// Returns `None` if the enum contains an unknown value deserialized from
13141 /// the string representation of enums.
13142 pub fn value(&self) -> std::option::Option<i32> {
13143 match self {
13144 Self::Unspecified => std::option::Option::Some(0),
13145 Self::Submitted => std::option::Option::Some(1),
13146 Self::Queued => std::option::Option::Some(2),
13147 Self::StaleStatus => std::option::Option::Some(3),
13148 Self::UnknownValue(u) => u.0.value(),
13149 }
13150 }
13151
13152 /// Gets the enum value as a string.
13153 ///
13154 /// Returns `None` if the enum contains an unknown value deserialized from
13155 /// the integer representation of enums.
13156 pub fn name(&self) -> std::option::Option<&str> {
13157 match self {
13158 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
13159 Self::Submitted => std::option::Option::Some("SUBMITTED"),
13160 Self::Queued => std::option::Option::Some("QUEUED"),
13161 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
13162 Self::UnknownValue(u) => u.0.name(),
13163 }
13164 }
13165 }
13166
13167 impl std::default::Default for Substate {
13168 fn default() -> Self {
13169 use std::convert::From;
13170 Self::from(0)
13171 }
13172 }
13173
13174 impl std::fmt::Display for Substate {
13175 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13176 wkt::internal::display_enum(f, self.name(), self.value())
13177 }
13178 }
13179
13180 impl std::convert::From<i32> for Substate {
13181 fn from(value: i32) -> Self {
13182 match value {
13183 0 => Self::Unspecified,
13184 1 => Self::Submitted,
13185 2 => Self::Queued,
13186 3 => Self::StaleStatus,
13187 _ => Self::UnknownValue(substate::UnknownValue(
13188 wkt::internal::UnknownEnumValue::Integer(value),
13189 )),
13190 }
13191 }
13192 }
13193
13194 impl std::convert::From<&str> for Substate {
13195 fn from(value: &str) -> Self {
13196 use std::string::ToString;
13197 match value {
13198 "UNSPECIFIED" => Self::Unspecified,
13199 "SUBMITTED" => Self::Submitted,
13200 "QUEUED" => Self::Queued,
13201 "STALE_STATUS" => Self::StaleStatus,
13202 _ => Self::UnknownValue(substate::UnknownValue(
13203 wkt::internal::UnknownEnumValue::String(value.to_string()),
13204 )),
13205 }
13206 }
13207 }
13208
13209 impl serde::ser::Serialize for Substate {
13210 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13211 where
13212 S: serde::Serializer,
13213 {
13214 match self {
13215 Self::Unspecified => serializer.serialize_i32(0),
13216 Self::Submitted => serializer.serialize_i32(1),
13217 Self::Queued => serializer.serialize_i32(2),
13218 Self::StaleStatus => serializer.serialize_i32(3),
13219 Self::UnknownValue(u) => u.0.serialize(serializer),
13220 }
13221 }
13222 }
13223
13224 impl<'de> serde::de::Deserialize<'de> for Substate {
13225 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13226 where
13227 D: serde::Deserializer<'de>,
13228 {
13229 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
13230 ".google.cloud.dataproc.v1.JobStatus.Substate",
13231 ))
13232 }
13233 }
13234}
13235
13236/// Encapsulates the full scoping used to reference a job.
13237#[derive(Clone, Default, PartialEq)]
13238#[non_exhaustive]
13239pub struct JobReference {
13240 /// Optional. The ID of the Google Cloud Platform project that the job belongs
13241 /// to. If specified, must match the request project ID.
13242 pub project_id: std::string::String,
13243
13244 /// Optional. The job ID, which must be unique within the project.
13245 ///
13246 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
13247 /// underscores (_), or hyphens (-). The maximum length is 100 characters.
13248 ///
13249 /// If not specified by the caller, the job ID will be provided by the server.
13250 pub job_id: std::string::String,
13251
13252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13253}
13254
13255impl JobReference {
13256 pub fn new() -> Self {
13257 std::default::Default::default()
13258 }
13259
13260 /// Sets the value of [project_id][crate::model::JobReference::project_id].
13261 ///
13262 /// # Example
13263 /// ```ignore,no_run
13264 /// # use google_cloud_dataproc_v1::model::JobReference;
13265 /// let x = JobReference::new().set_project_id("example");
13266 /// ```
13267 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13268 self.project_id = v.into();
13269 self
13270 }
13271
13272 /// Sets the value of [job_id][crate::model::JobReference::job_id].
13273 ///
13274 /// # Example
13275 /// ```ignore,no_run
13276 /// # use google_cloud_dataproc_v1::model::JobReference;
13277 /// let x = JobReference::new().set_job_id("example");
13278 /// ```
13279 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13280 self.job_id = v.into();
13281 self
13282 }
13283}
13284
13285impl wkt::message::Message for JobReference {
13286 fn typename() -> &'static str {
13287 "type.googleapis.com/google.cloud.dataproc.v1.JobReference"
13288 }
13289}
13290
13291/// A YARN application created by a job. Application information is a subset of
13292/// \<code\>org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto\</code\>.
13293///
13294/// **Beta Feature**: This report is available for testing purposes only. It may
13295/// be changed before final release.
13296#[derive(Clone, Default, PartialEq)]
13297#[non_exhaustive]
13298pub struct YarnApplication {
13299 /// Required. The application name.
13300 pub name: std::string::String,
13301
13302 /// Required. The application state.
13303 pub state: crate::model::yarn_application::State,
13304
13305 /// Required. The numerical progress of the application, from 1 to 100.
13306 pub progress: f32,
13307
13308 /// Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or
13309 /// TimelineServer that provides application-specific information. The URL uses
13310 /// the internal hostname, and requires a proxy server for resolution and,
13311 /// possibly, access.
13312 pub tracking_url: std::string::String,
13313
13314 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13315}
13316
13317impl YarnApplication {
13318 pub fn new() -> Self {
13319 std::default::Default::default()
13320 }
13321
13322 /// Sets the value of [name][crate::model::YarnApplication::name].
13323 ///
13324 /// # Example
13325 /// ```ignore,no_run
13326 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13327 /// let x = YarnApplication::new().set_name("example");
13328 /// ```
13329 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13330 self.name = v.into();
13331 self
13332 }
13333
13334 /// Sets the value of [state][crate::model::YarnApplication::state].
13335 ///
13336 /// # Example
13337 /// ```ignore,no_run
13338 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13339 /// use google_cloud_dataproc_v1::model::yarn_application::State;
13340 /// let x0 = YarnApplication::new().set_state(State::New);
13341 /// let x1 = YarnApplication::new().set_state(State::NewSaving);
13342 /// let x2 = YarnApplication::new().set_state(State::Submitted);
13343 /// ```
13344 pub fn set_state<T: std::convert::Into<crate::model::yarn_application::State>>(
13345 mut self,
13346 v: T,
13347 ) -> Self {
13348 self.state = v.into();
13349 self
13350 }
13351
13352 /// Sets the value of [progress][crate::model::YarnApplication::progress].
13353 ///
13354 /// # Example
13355 /// ```ignore,no_run
13356 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13357 /// let x = YarnApplication::new().set_progress(42.0);
13358 /// ```
13359 pub fn set_progress<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
13360 self.progress = v.into();
13361 self
13362 }
13363
13364 /// Sets the value of [tracking_url][crate::model::YarnApplication::tracking_url].
13365 ///
13366 /// # Example
13367 /// ```ignore,no_run
13368 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13369 /// let x = YarnApplication::new().set_tracking_url("example");
13370 /// ```
13371 pub fn set_tracking_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13372 self.tracking_url = v.into();
13373 self
13374 }
13375}
13376
13377impl wkt::message::Message for YarnApplication {
13378 fn typename() -> &'static str {
13379 "type.googleapis.com/google.cloud.dataproc.v1.YarnApplication"
13380 }
13381}
13382
13383/// Defines additional types related to [YarnApplication].
13384pub mod yarn_application {
13385 #[allow(unused_imports)]
13386 use super::*;
13387
13388 /// The application state, corresponding to
13389 /// \<code\>YarnProtos.YarnApplicationStateProto\</code\>.
13390 ///
13391 /// # Working with unknown values
13392 ///
13393 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13394 /// additional enum variants at any time. Adding new variants is not considered
13395 /// a breaking change. Applications should write their code in anticipation of:
13396 ///
13397 /// - New values appearing in future releases of the client library, **and**
13398 /// - New values received dynamically, without application changes.
13399 ///
13400 /// Please consult the [Working with enums] section in the user guide for some
13401 /// guidelines.
13402 ///
13403 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13404 #[derive(Clone, Debug, PartialEq)]
13405 #[non_exhaustive]
13406 pub enum State {
13407 /// Status is unspecified.
13408 Unspecified,
13409 /// Status is NEW.
13410 New,
13411 /// Status is NEW_SAVING.
13412 NewSaving,
13413 /// Status is SUBMITTED.
13414 Submitted,
13415 /// Status is ACCEPTED.
13416 Accepted,
13417 /// Status is RUNNING.
13418 Running,
13419 /// Status is FINISHED.
13420 Finished,
13421 /// Status is FAILED.
13422 Failed,
13423 /// Status is KILLED.
13424 Killed,
13425 /// If set, the enum was initialized with an unknown value.
13426 ///
13427 /// Applications can examine the value using [State::value] or
13428 /// [State::name].
13429 UnknownValue(state::UnknownValue),
13430 }
13431
13432 #[doc(hidden)]
13433 pub mod state {
13434 #[allow(unused_imports)]
13435 use super::*;
13436 #[derive(Clone, Debug, PartialEq)]
13437 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13438 }
13439
13440 impl State {
13441 /// Gets the enum value.
13442 ///
13443 /// Returns `None` if the enum contains an unknown value deserialized from
13444 /// the string representation of enums.
13445 pub fn value(&self) -> std::option::Option<i32> {
13446 match self {
13447 Self::Unspecified => std::option::Option::Some(0),
13448 Self::New => std::option::Option::Some(1),
13449 Self::NewSaving => std::option::Option::Some(2),
13450 Self::Submitted => std::option::Option::Some(3),
13451 Self::Accepted => std::option::Option::Some(4),
13452 Self::Running => std::option::Option::Some(5),
13453 Self::Finished => std::option::Option::Some(6),
13454 Self::Failed => std::option::Option::Some(7),
13455 Self::Killed => std::option::Option::Some(8),
13456 Self::UnknownValue(u) => u.0.value(),
13457 }
13458 }
13459
13460 /// Gets the enum value as a string.
13461 ///
13462 /// Returns `None` if the enum contains an unknown value deserialized from
13463 /// the integer representation of enums.
13464 pub fn name(&self) -> std::option::Option<&str> {
13465 match self {
13466 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13467 Self::New => std::option::Option::Some("NEW"),
13468 Self::NewSaving => std::option::Option::Some("NEW_SAVING"),
13469 Self::Submitted => std::option::Option::Some("SUBMITTED"),
13470 Self::Accepted => std::option::Option::Some("ACCEPTED"),
13471 Self::Running => std::option::Option::Some("RUNNING"),
13472 Self::Finished => std::option::Option::Some("FINISHED"),
13473 Self::Failed => std::option::Option::Some("FAILED"),
13474 Self::Killed => std::option::Option::Some("KILLED"),
13475 Self::UnknownValue(u) => u.0.name(),
13476 }
13477 }
13478 }
13479
13480 impl std::default::Default for State {
13481 fn default() -> Self {
13482 use std::convert::From;
13483 Self::from(0)
13484 }
13485 }
13486
13487 impl std::fmt::Display for State {
13488 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13489 wkt::internal::display_enum(f, self.name(), self.value())
13490 }
13491 }
13492
13493 impl std::convert::From<i32> for State {
13494 fn from(value: i32) -> Self {
13495 match value {
13496 0 => Self::Unspecified,
13497 1 => Self::New,
13498 2 => Self::NewSaving,
13499 3 => Self::Submitted,
13500 4 => Self::Accepted,
13501 5 => Self::Running,
13502 6 => Self::Finished,
13503 7 => Self::Failed,
13504 8 => Self::Killed,
13505 _ => Self::UnknownValue(state::UnknownValue(
13506 wkt::internal::UnknownEnumValue::Integer(value),
13507 )),
13508 }
13509 }
13510 }
13511
13512 impl std::convert::From<&str> for State {
13513 fn from(value: &str) -> Self {
13514 use std::string::ToString;
13515 match value {
13516 "STATE_UNSPECIFIED" => Self::Unspecified,
13517 "NEW" => Self::New,
13518 "NEW_SAVING" => Self::NewSaving,
13519 "SUBMITTED" => Self::Submitted,
13520 "ACCEPTED" => Self::Accepted,
13521 "RUNNING" => Self::Running,
13522 "FINISHED" => Self::Finished,
13523 "FAILED" => Self::Failed,
13524 "KILLED" => Self::Killed,
13525 _ => Self::UnknownValue(state::UnknownValue(
13526 wkt::internal::UnknownEnumValue::String(value.to_string()),
13527 )),
13528 }
13529 }
13530 }
13531
13532 impl serde::ser::Serialize for State {
13533 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13534 where
13535 S: serde::Serializer,
13536 {
13537 match self {
13538 Self::Unspecified => serializer.serialize_i32(0),
13539 Self::New => serializer.serialize_i32(1),
13540 Self::NewSaving => serializer.serialize_i32(2),
13541 Self::Submitted => serializer.serialize_i32(3),
13542 Self::Accepted => serializer.serialize_i32(4),
13543 Self::Running => serializer.serialize_i32(5),
13544 Self::Finished => serializer.serialize_i32(6),
13545 Self::Failed => serializer.serialize_i32(7),
13546 Self::Killed => serializer.serialize_i32(8),
13547 Self::UnknownValue(u) => u.0.serialize(serializer),
13548 }
13549 }
13550 }
13551
13552 impl<'de> serde::de::Deserialize<'de> for State {
13553 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13554 where
13555 D: serde::Deserializer<'de>,
13556 {
13557 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13558 ".google.cloud.dataproc.v1.YarnApplication.State",
13559 ))
13560 }
13561 }
13562}
13563
13564/// A Dataproc job resource.
13565#[derive(Clone, Default, PartialEq)]
13566#[non_exhaustive]
13567pub struct Job {
13568 /// Optional. The fully qualified reference to the job, which can be used to
13569 /// obtain the equivalent REST path of the job resource. If this property
13570 /// is not specified when a job is created, the server generates a
13571 /// \<code\>job_id\</code\>.
13572 pub reference: std::option::Option<crate::model::JobReference>,
13573
13574 /// Required. Job information, including how, when, and where to
13575 /// run the job.
13576 pub placement: std::option::Option<crate::model::JobPlacement>,
13577
13578 /// Output only. The job status. Additional application-specific
13579 /// status information might be contained in the \<code\>type_job\</code\>
13580 /// and \<code\>yarn_applications\</code\> fields.
13581 pub status: std::option::Option<crate::model::JobStatus>,
13582
13583 /// Output only. The previous job status.
13584 pub status_history: std::vec::Vec<crate::model::JobStatus>,
13585
13586 /// Output only. The collection of YARN applications spun up by this job.
13587 ///
13588 /// **Beta** Feature: This report is available for testing purposes only. It
13589 /// might be changed before final release.
13590 pub yarn_applications: std::vec::Vec<crate::model::YarnApplication>,
13591
13592 /// Output only. A URI pointing to the location of the stdout of the job's
13593 /// driver program.
13594 pub driver_output_resource_uri: std::string::String,
13595
13596 /// Output only. If present, the location of miscellaneous control files
13597 /// which can be used as part of job setup and handling. If not present,
13598 /// control files might be placed in the same location as `driver_output_uri`.
13599 pub driver_control_files_uri: std::string::String,
13600
13601 /// Optional. The labels to associate with this job.
13602 /// Label **keys** must contain 1 to 63 characters, and must conform to
13603 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
13604 /// Label **values** can be empty, but, if present, must contain 1 to 63
13605 /// characters, and must conform to [RFC
13606 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
13607 /// associated with a job.
13608 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
13609
13610 /// Optional. Job scheduling configuration.
13611 pub scheduling: std::option::Option<crate::model::JobScheduling>,
13612
13613 /// Output only. A UUID that uniquely identifies a job within the project
13614 /// over time. This is in contrast to a user-settable reference.job_id that
13615 /// might be reused over time.
13616 pub job_uuid: std::string::String,
13617
13618 /// Output only. Indicates whether the job is completed. If the value is
13619 /// `false`, the job is still in progress. If `true`, the job is completed, and
13620 /// `status.state` field will indicate if it was successful, failed,
13621 /// or cancelled.
13622 pub done: bool,
13623
13624 /// Optional. Driver scheduling configuration.
13625 pub driver_scheduling_config: std::option::Option<crate::model::DriverSchedulingConfig>,
13626
13627 /// Required. The application/framework-specific portion of the job.
13628 pub type_job: std::option::Option<crate::model::job::TypeJob>,
13629
13630 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13631}
13632
13633impl Job {
13634 pub fn new() -> Self {
13635 std::default::Default::default()
13636 }
13637
13638 /// Sets the value of [reference][crate::model::Job::reference].
13639 ///
13640 /// # Example
13641 /// ```ignore,no_run
13642 /// # use google_cloud_dataproc_v1::model::Job;
13643 /// use google_cloud_dataproc_v1::model::JobReference;
13644 /// let x = Job::new().set_reference(JobReference::default()/* use setters */);
13645 /// ```
13646 pub fn set_reference<T>(mut self, v: T) -> Self
13647 where
13648 T: std::convert::Into<crate::model::JobReference>,
13649 {
13650 self.reference = std::option::Option::Some(v.into());
13651 self
13652 }
13653
13654 /// Sets or clears the value of [reference][crate::model::Job::reference].
13655 ///
13656 /// # Example
13657 /// ```ignore,no_run
13658 /// # use google_cloud_dataproc_v1::model::Job;
13659 /// use google_cloud_dataproc_v1::model::JobReference;
13660 /// let x = Job::new().set_or_clear_reference(Some(JobReference::default()/* use setters */));
13661 /// let x = Job::new().set_or_clear_reference(None::<JobReference>);
13662 /// ```
13663 pub fn set_or_clear_reference<T>(mut self, v: std::option::Option<T>) -> Self
13664 where
13665 T: std::convert::Into<crate::model::JobReference>,
13666 {
13667 self.reference = v.map(|x| x.into());
13668 self
13669 }
13670
13671 /// Sets the value of [placement][crate::model::Job::placement].
13672 ///
13673 /// # Example
13674 /// ```ignore,no_run
13675 /// # use google_cloud_dataproc_v1::model::Job;
13676 /// use google_cloud_dataproc_v1::model::JobPlacement;
13677 /// let x = Job::new().set_placement(JobPlacement::default()/* use setters */);
13678 /// ```
13679 pub fn set_placement<T>(mut self, v: T) -> Self
13680 where
13681 T: std::convert::Into<crate::model::JobPlacement>,
13682 {
13683 self.placement = std::option::Option::Some(v.into());
13684 self
13685 }
13686
13687 /// Sets or clears the value of [placement][crate::model::Job::placement].
13688 ///
13689 /// # Example
13690 /// ```ignore,no_run
13691 /// # use google_cloud_dataproc_v1::model::Job;
13692 /// use google_cloud_dataproc_v1::model::JobPlacement;
13693 /// let x = Job::new().set_or_clear_placement(Some(JobPlacement::default()/* use setters */));
13694 /// let x = Job::new().set_or_clear_placement(None::<JobPlacement>);
13695 /// ```
13696 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
13697 where
13698 T: std::convert::Into<crate::model::JobPlacement>,
13699 {
13700 self.placement = v.map(|x| x.into());
13701 self
13702 }
13703
13704 /// Sets the value of [status][crate::model::Job::status].
13705 ///
13706 /// # Example
13707 /// ```ignore,no_run
13708 /// # use google_cloud_dataproc_v1::model::Job;
13709 /// use google_cloud_dataproc_v1::model::JobStatus;
13710 /// let x = Job::new().set_status(JobStatus::default()/* use setters */);
13711 /// ```
13712 pub fn set_status<T>(mut self, v: T) -> Self
13713 where
13714 T: std::convert::Into<crate::model::JobStatus>,
13715 {
13716 self.status = std::option::Option::Some(v.into());
13717 self
13718 }
13719
13720 /// Sets or clears the value of [status][crate::model::Job::status].
13721 ///
13722 /// # Example
13723 /// ```ignore,no_run
13724 /// # use google_cloud_dataproc_v1::model::Job;
13725 /// use google_cloud_dataproc_v1::model::JobStatus;
13726 /// let x = Job::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
13727 /// let x = Job::new().set_or_clear_status(None::<JobStatus>);
13728 /// ```
13729 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
13730 where
13731 T: std::convert::Into<crate::model::JobStatus>,
13732 {
13733 self.status = v.map(|x| x.into());
13734 self
13735 }
13736
13737 /// Sets the value of [status_history][crate::model::Job::status_history].
13738 ///
13739 /// # Example
13740 /// ```ignore,no_run
13741 /// # use google_cloud_dataproc_v1::model::Job;
13742 /// use google_cloud_dataproc_v1::model::JobStatus;
13743 /// let x = Job::new()
13744 /// .set_status_history([
13745 /// JobStatus::default()/* use setters */,
13746 /// JobStatus::default()/* use (different) setters */,
13747 /// ]);
13748 /// ```
13749 pub fn set_status_history<T, V>(mut self, v: T) -> Self
13750 where
13751 T: std::iter::IntoIterator<Item = V>,
13752 V: std::convert::Into<crate::model::JobStatus>,
13753 {
13754 use std::iter::Iterator;
13755 self.status_history = v.into_iter().map(|i| i.into()).collect();
13756 self
13757 }
13758
13759 /// Sets the value of [yarn_applications][crate::model::Job::yarn_applications].
13760 ///
13761 /// # Example
13762 /// ```ignore,no_run
13763 /// # use google_cloud_dataproc_v1::model::Job;
13764 /// use google_cloud_dataproc_v1::model::YarnApplication;
13765 /// let x = Job::new()
13766 /// .set_yarn_applications([
13767 /// YarnApplication::default()/* use setters */,
13768 /// YarnApplication::default()/* use (different) setters */,
13769 /// ]);
13770 /// ```
13771 pub fn set_yarn_applications<T, V>(mut self, v: T) -> Self
13772 where
13773 T: std::iter::IntoIterator<Item = V>,
13774 V: std::convert::Into<crate::model::YarnApplication>,
13775 {
13776 use std::iter::Iterator;
13777 self.yarn_applications = v.into_iter().map(|i| i.into()).collect();
13778 self
13779 }
13780
13781 /// Sets the value of [driver_output_resource_uri][crate::model::Job::driver_output_resource_uri].
13782 ///
13783 /// # Example
13784 /// ```ignore,no_run
13785 /// # use google_cloud_dataproc_v1::model::Job;
13786 /// let x = Job::new().set_driver_output_resource_uri("example");
13787 /// ```
13788 pub fn set_driver_output_resource_uri<T: std::convert::Into<std::string::String>>(
13789 mut self,
13790 v: T,
13791 ) -> Self {
13792 self.driver_output_resource_uri = v.into();
13793 self
13794 }
13795
13796 /// Sets the value of [driver_control_files_uri][crate::model::Job::driver_control_files_uri].
13797 ///
13798 /// # Example
13799 /// ```ignore,no_run
13800 /// # use google_cloud_dataproc_v1::model::Job;
13801 /// let x = Job::new().set_driver_control_files_uri("example");
13802 /// ```
13803 pub fn set_driver_control_files_uri<T: std::convert::Into<std::string::String>>(
13804 mut self,
13805 v: T,
13806 ) -> Self {
13807 self.driver_control_files_uri = v.into();
13808 self
13809 }
13810
13811 /// Sets the value of [labels][crate::model::Job::labels].
13812 ///
13813 /// # Example
13814 /// ```ignore,no_run
13815 /// # use google_cloud_dataproc_v1::model::Job;
13816 /// let x = Job::new().set_labels([
13817 /// ("key0", "abc"),
13818 /// ("key1", "xyz"),
13819 /// ]);
13820 /// ```
13821 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
13822 where
13823 T: std::iter::IntoIterator<Item = (K, V)>,
13824 K: std::convert::Into<std::string::String>,
13825 V: std::convert::Into<std::string::String>,
13826 {
13827 use std::iter::Iterator;
13828 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13829 self
13830 }
13831
13832 /// Sets the value of [scheduling][crate::model::Job::scheduling].
13833 ///
13834 /// # Example
13835 /// ```ignore,no_run
13836 /// # use google_cloud_dataproc_v1::model::Job;
13837 /// use google_cloud_dataproc_v1::model::JobScheduling;
13838 /// let x = Job::new().set_scheduling(JobScheduling::default()/* use setters */);
13839 /// ```
13840 pub fn set_scheduling<T>(mut self, v: T) -> Self
13841 where
13842 T: std::convert::Into<crate::model::JobScheduling>,
13843 {
13844 self.scheduling = std::option::Option::Some(v.into());
13845 self
13846 }
13847
13848 /// Sets or clears the value of [scheduling][crate::model::Job::scheduling].
13849 ///
13850 /// # Example
13851 /// ```ignore,no_run
13852 /// # use google_cloud_dataproc_v1::model::Job;
13853 /// use google_cloud_dataproc_v1::model::JobScheduling;
13854 /// let x = Job::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
13855 /// let x = Job::new().set_or_clear_scheduling(None::<JobScheduling>);
13856 /// ```
13857 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
13858 where
13859 T: std::convert::Into<crate::model::JobScheduling>,
13860 {
13861 self.scheduling = v.map(|x| x.into());
13862 self
13863 }
13864
13865 /// Sets the value of [job_uuid][crate::model::Job::job_uuid].
13866 ///
13867 /// # Example
13868 /// ```ignore,no_run
13869 /// # use google_cloud_dataproc_v1::model::Job;
13870 /// let x = Job::new().set_job_uuid("example");
13871 /// ```
13872 pub fn set_job_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13873 self.job_uuid = v.into();
13874 self
13875 }
13876
13877 /// Sets the value of [done][crate::model::Job::done].
13878 ///
13879 /// # Example
13880 /// ```ignore,no_run
13881 /// # use google_cloud_dataproc_v1::model::Job;
13882 /// let x = Job::new().set_done(true);
13883 /// ```
13884 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13885 self.done = v.into();
13886 self
13887 }
13888
13889 /// Sets the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
13890 ///
13891 /// # Example
13892 /// ```ignore,no_run
13893 /// # use google_cloud_dataproc_v1::model::Job;
13894 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
13895 /// let x = Job::new().set_driver_scheduling_config(DriverSchedulingConfig::default()/* use setters */);
13896 /// ```
13897 pub fn set_driver_scheduling_config<T>(mut self, v: T) -> Self
13898 where
13899 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
13900 {
13901 self.driver_scheduling_config = std::option::Option::Some(v.into());
13902 self
13903 }
13904
13905 /// Sets or clears the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
13906 ///
13907 /// # Example
13908 /// ```ignore,no_run
13909 /// # use google_cloud_dataproc_v1::model::Job;
13910 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
13911 /// let x = Job::new().set_or_clear_driver_scheduling_config(Some(DriverSchedulingConfig::default()/* use setters */));
13912 /// let x = Job::new().set_or_clear_driver_scheduling_config(None::<DriverSchedulingConfig>);
13913 /// ```
13914 pub fn set_or_clear_driver_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
13915 where
13916 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
13917 {
13918 self.driver_scheduling_config = v.map(|x| x.into());
13919 self
13920 }
13921
13922 /// Sets the value of [type_job][crate::model::Job::type_job].
13923 ///
13924 /// Note that all the setters affecting `type_job` are mutually
13925 /// exclusive.
13926 ///
13927 /// # Example
13928 /// ```ignore,no_run
13929 /// # use google_cloud_dataproc_v1::model::Job;
13930 /// use google_cloud_dataproc_v1::model::HadoopJob;
13931 /// let x = Job::new().set_type_job(Some(
13932 /// google_cloud_dataproc_v1::model::job::TypeJob::HadoopJob(HadoopJob::default().into())));
13933 /// ```
13934 pub fn set_type_job<T: std::convert::Into<std::option::Option<crate::model::job::TypeJob>>>(
13935 mut self,
13936 v: T,
13937 ) -> Self {
13938 self.type_job = v.into();
13939 self
13940 }
13941
13942 /// The value of [type_job][crate::model::Job::type_job]
13943 /// if it holds a `HadoopJob`, `None` if the field is not set or
13944 /// holds a different branch.
13945 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
13946 #[allow(unreachable_patterns)]
13947 self.type_job.as_ref().and_then(|v| match v {
13948 crate::model::job::TypeJob::HadoopJob(v) => std::option::Option::Some(v),
13949 _ => std::option::Option::None,
13950 })
13951 }
13952
13953 /// Sets the value of [type_job][crate::model::Job::type_job]
13954 /// to hold a `HadoopJob`.
13955 ///
13956 /// Note that all the setters affecting `type_job` are
13957 /// mutually exclusive.
13958 ///
13959 /// # Example
13960 /// ```ignore,no_run
13961 /// # use google_cloud_dataproc_v1::model::Job;
13962 /// use google_cloud_dataproc_v1::model::HadoopJob;
13963 /// let x = Job::new().set_hadoop_job(HadoopJob::default()/* use setters */);
13964 /// assert!(x.hadoop_job().is_some());
13965 /// assert!(x.spark_job().is_none());
13966 /// assert!(x.pyspark_job().is_none());
13967 /// assert!(x.hive_job().is_none());
13968 /// assert!(x.pig_job().is_none());
13969 /// assert!(x.spark_r_job().is_none());
13970 /// assert!(x.spark_sql_job().is_none());
13971 /// assert!(x.presto_job().is_none());
13972 /// assert!(x.trino_job().is_none());
13973 /// assert!(x.flink_job().is_none());
13974 /// ```
13975 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
13976 mut self,
13977 v: T,
13978 ) -> Self {
13979 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HadoopJob(v.into()));
13980 self
13981 }
13982
13983 /// The value of [type_job][crate::model::Job::type_job]
13984 /// if it holds a `SparkJob`, `None` if the field is not set or
13985 /// holds a different branch.
13986 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
13987 #[allow(unreachable_patterns)]
13988 self.type_job.as_ref().and_then(|v| match v {
13989 crate::model::job::TypeJob::SparkJob(v) => std::option::Option::Some(v),
13990 _ => std::option::Option::None,
13991 })
13992 }
13993
13994 /// Sets the value of [type_job][crate::model::Job::type_job]
13995 /// to hold a `SparkJob`.
13996 ///
13997 /// Note that all the setters affecting `type_job` are
13998 /// mutually exclusive.
13999 ///
14000 /// # Example
14001 /// ```ignore,no_run
14002 /// # use google_cloud_dataproc_v1::model::Job;
14003 /// use google_cloud_dataproc_v1::model::SparkJob;
14004 /// let x = Job::new().set_spark_job(SparkJob::default()/* use setters */);
14005 /// assert!(x.spark_job().is_some());
14006 /// assert!(x.hadoop_job().is_none());
14007 /// assert!(x.pyspark_job().is_none());
14008 /// assert!(x.hive_job().is_none());
14009 /// assert!(x.pig_job().is_none());
14010 /// assert!(x.spark_r_job().is_none());
14011 /// assert!(x.spark_sql_job().is_none());
14012 /// assert!(x.presto_job().is_none());
14013 /// assert!(x.trino_job().is_none());
14014 /// assert!(x.flink_job().is_none());
14015 /// ```
14016 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
14017 mut self,
14018 v: T,
14019 ) -> Self {
14020 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkJob(v.into()));
14021 self
14022 }
14023
14024 /// The value of [type_job][crate::model::Job::type_job]
14025 /// if it holds a `PysparkJob`, `None` if the field is not set or
14026 /// holds a different branch.
14027 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
14028 #[allow(unreachable_patterns)]
14029 self.type_job.as_ref().and_then(|v| match v {
14030 crate::model::job::TypeJob::PysparkJob(v) => std::option::Option::Some(v),
14031 _ => std::option::Option::None,
14032 })
14033 }
14034
14035 /// Sets the value of [type_job][crate::model::Job::type_job]
14036 /// to hold a `PysparkJob`.
14037 ///
14038 /// Note that all the setters affecting `type_job` are
14039 /// mutually exclusive.
14040 ///
14041 /// # Example
14042 /// ```ignore,no_run
14043 /// # use google_cloud_dataproc_v1::model::Job;
14044 /// use google_cloud_dataproc_v1::model::PySparkJob;
14045 /// let x = Job::new().set_pyspark_job(PySparkJob::default()/* use setters */);
14046 /// assert!(x.pyspark_job().is_some());
14047 /// assert!(x.hadoop_job().is_none());
14048 /// assert!(x.spark_job().is_none());
14049 /// assert!(x.hive_job().is_none());
14050 /// assert!(x.pig_job().is_none());
14051 /// assert!(x.spark_r_job().is_none());
14052 /// assert!(x.spark_sql_job().is_none());
14053 /// assert!(x.presto_job().is_none());
14054 /// assert!(x.trino_job().is_none());
14055 /// assert!(x.flink_job().is_none());
14056 /// ```
14057 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
14058 mut self,
14059 v: T,
14060 ) -> Self {
14061 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PysparkJob(v.into()));
14062 self
14063 }
14064
14065 /// The value of [type_job][crate::model::Job::type_job]
14066 /// if it holds a `HiveJob`, `None` if the field is not set or
14067 /// holds a different branch.
14068 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
14069 #[allow(unreachable_patterns)]
14070 self.type_job.as_ref().and_then(|v| match v {
14071 crate::model::job::TypeJob::HiveJob(v) => std::option::Option::Some(v),
14072 _ => std::option::Option::None,
14073 })
14074 }
14075
14076 /// Sets the value of [type_job][crate::model::Job::type_job]
14077 /// to hold a `HiveJob`.
14078 ///
14079 /// Note that all the setters affecting `type_job` are
14080 /// mutually exclusive.
14081 ///
14082 /// # Example
14083 /// ```ignore,no_run
14084 /// # use google_cloud_dataproc_v1::model::Job;
14085 /// use google_cloud_dataproc_v1::model::HiveJob;
14086 /// let x = Job::new().set_hive_job(HiveJob::default()/* use setters */);
14087 /// assert!(x.hive_job().is_some());
14088 /// assert!(x.hadoop_job().is_none());
14089 /// assert!(x.spark_job().is_none());
14090 /// assert!(x.pyspark_job().is_none());
14091 /// assert!(x.pig_job().is_none());
14092 /// assert!(x.spark_r_job().is_none());
14093 /// assert!(x.spark_sql_job().is_none());
14094 /// assert!(x.presto_job().is_none());
14095 /// assert!(x.trino_job().is_none());
14096 /// assert!(x.flink_job().is_none());
14097 /// ```
14098 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
14099 mut self,
14100 v: T,
14101 ) -> Self {
14102 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HiveJob(v.into()));
14103 self
14104 }
14105
14106 /// The value of [type_job][crate::model::Job::type_job]
14107 /// if it holds a `PigJob`, `None` if the field is not set or
14108 /// holds a different branch.
14109 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
14110 #[allow(unreachable_patterns)]
14111 self.type_job.as_ref().and_then(|v| match v {
14112 crate::model::job::TypeJob::PigJob(v) => std::option::Option::Some(v),
14113 _ => std::option::Option::None,
14114 })
14115 }
14116
14117 /// Sets the value of [type_job][crate::model::Job::type_job]
14118 /// to hold a `PigJob`.
14119 ///
14120 /// Note that all the setters affecting `type_job` are
14121 /// mutually exclusive.
14122 ///
14123 /// # Example
14124 /// ```ignore,no_run
14125 /// # use google_cloud_dataproc_v1::model::Job;
14126 /// use google_cloud_dataproc_v1::model::PigJob;
14127 /// let x = Job::new().set_pig_job(PigJob::default()/* use setters */);
14128 /// assert!(x.pig_job().is_some());
14129 /// assert!(x.hadoop_job().is_none());
14130 /// assert!(x.spark_job().is_none());
14131 /// assert!(x.pyspark_job().is_none());
14132 /// assert!(x.hive_job().is_none());
14133 /// assert!(x.spark_r_job().is_none());
14134 /// assert!(x.spark_sql_job().is_none());
14135 /// assert!(x.presto_job().is_none());
14136 /// assert!(x.trino_job().is_none());
14137 /// assert!(x.flink_job().is_none());
14138 /// ```
14139 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
14140 mut self,
14141 v: T,
14142 ) -> Self {
14143 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PigJob(v.into()));
14144 self
14145 }
14146
14147 /// The value of [type_job][crate::model::Job::type_job]
14148 /// if it holds a `SparkRJob`, `None` if the field is not set or
14149 /// holds a different branch.
14150 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
14151 #[allow(unreachable_patterns)]
14152 self.type_job.as_ref().and_then(|v| match v {
14153 crate::model::job::TypeJob::SparkRJob(v) => std::option::Option::Some(v),
14154 _ => std::option::Option::None,
14155 })
14156 }
14157
14158 /// Sets the value of [type_job][crate::model::Job::type_job]
14159 /// to hold a `SparkRJob`.
14160 ///
14161 /// Note that all the setters affecting `type_job` are
14162 /// mutually exclusive.
14163 ///
14164 /// # Example
14165 /// ```ignore,no_run
14166 /// # use google_cloud_dataproc_v1::model::Job;
14167 /// use google_cloud_dataproc_v1::model::SparkRJob;
14168 /// let x = Job::new().set_spark_r_job(SparkRJob::default()/* use setters */);
14169 /// assert!(x.spark_r_job().is_some());
14170 /// assert!(x.hadoop_job().is_none());
14171 /// assert!(x.spark_job().is_none());
14172 /// assert!(x.pyspark_job().is_none());
14173 /// assert!(x.hive_job().is_none());
14174 /// assert!(x.pig_job().is_none());
14175 /// assert!(x.spark_sql_job().is_none());
14176 /// assert!(x.presto_job().is_none());
14177 /// assert!(x.trino_job().is_none());
14178 /// assert!(x.flink_job().is_none());
14179 /// ```
14180 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
14181 mut self,
14182 v: T,
14183 ) -> Self {
14184 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkRJob(v.into()));
14185 self
14186 }
14187
14188 /// The value of [type_job][crate::model::Job::type_job]
14189 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
14190 /// holds a different branch.
14191 pub fn spark_sql_job(
14192 &self,
14193 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
14194 #[allow(unreachable_patterns)]
14195 self.type_job.as_ref().and_then(|v| match v {
14196 crate::model::job::TypeJob::SparkSqlJob(v) => std::option::Option::Some(v),
14197 _ => std::option::Option::None,
14198 })
14199 }
14200
14201 /// Sets the value of [type_job][crate::model::Job::type_job]
14202 /// to hold a `SparkSqlJob`.
14203 ///
14204 /// Note that all the setters affecting `type_job` are
14205 /// mutually exclusive.
14206 ///
14207 /// # Example
14208 /// ```ignore,no_run
14209 /// # use google_cloud_dataproc_v1::model::Job;
14210 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
14211 /// let x = Job::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
14212 /// assert!(x.spark_sql_job().is_some());
14213 /// assert!(x.hadoop_job().is_none());
14214 /// assert!(x.spark_job().is_none());
14215 /// assert!(x.pyspark_job().is_none());
14216 /// assert!(x.hive_job().is_none());
14217 /// assert!(x.pig_job().is_none());
14218 /// assert!(x.spark_r_job().is_none());
14219 /// assert!(x.presto_job().is_none());
14220 /// assert!(x.trino_job().is_none());
14221 /// assert!(x.flink_job().is_none());
14222 /// ```
14223 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
14224 mut self,
14225 v: T,
14226 ) -> Self {
14227 self.type_job =
14228 std::option::Option::Some(crate::model::job::TypeJob::SparkSqlJob(v.into()));
14229 self
14230 }
14231
14232 /// The value of [type_job][crate::model::Job::type_job]
14233 /// if it holds a `PrestoJob`, `None` if the field is not set or
14234 /// holds a different branch.
14235 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
14236 #[allow(unreachable_patterns)]
14237 self.type_job.as_ref().and_then(|v| match v {
14238 crate::model::job::TypeJob::PrestoJob(v) => std::option::Option::Some(v),
14239 _ => std::option::Option::None,
14240 })
14241 }
14242
14243 /// Sets the value of [type_job][crate::model::Job::type_job]
14244 /// to hold a `PrestoJob`.
14245 ///
14246 /// Note that all the setters affecting `type_job` are
14247 /// mutually exclusive.
14248 ///
14249 /// # Example
14250 /// ```ignore,no_run
14251 /// # use google_cloud_dataproc_v1::model::Job;
14252 /// use google_cloud_dataproc_v1::model::PrestoJob;
14253 /// let x = Job::new().set_presto_job(PrestoJob::default()/* use setters */);
14254 /// assert!(x.presto_job().is_some());
14255 /// assert!(x.hadoop_job().is_none());
14256 /// assert!(x.spark_job().is_none());
14257 /// assert!(x.pyspark_job().is_none());
14258 /// assert!(x.hive_job().is_none());
14259 /// assert!(x.pig_job().is_none());
14260 /// assert!(x.spark_r_job().is_none());
14261 /// assert!(x.spark_sql_job().is_none());
14262 /// assert!(x.trino_job().is_none());
14263 /// assert!(x.flink_job().is_none());
14264 /// ```
14265 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
14266 mut self,
14267 v: T,
14268 ) -> Self {
14269 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PrestoJob(v.into()));
14270 self
14271 }
14272
14273 /// The value of [type_job][crate::model::Job::type_job]
14274 /// if it holds a `TrinoJob`, `None` if the field is not set or
14275 /// holds a different branch.
14276 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
14277 #[allow(unreachable_patterns)]
14278 self.type_job.as_ref().and_then(|v| match v {
14279 crate::model::job::TypeJob::TrinoJob(v) => std::option::Option::Some(v),
14280 _ => std::option::Option::None,
14281 })
14282 }
14283
14284 /// Sets the value of [type_job][crate::model::Job::type_job]
14285 /// to hold a `TrinoJob`.
14286 ///
14287 /// Note that all the setters affecting `type_job` are
14288 /// mutually exclusive.
14289 ///
14290 /// # Example
14291 /// ```ignore,no_run
14292 /// # use google_cloud_dataproc_v1::model::Job;
14293 /// use google_cloud_dataproc_v1::model::TrinoJob;
14294 /// let x = Job::new().set_trino_job(TrinoJob::default()/* use setters */);
14295 /// assert!(x.trino_job().is_some());
14296 /// assert!(x.hadoop_job().is_none());
14297 /// assert!(x.spark_job().is_none());
14298 /// assert!(x.pyspark_job().is_none());
14299 /// assert!(x.hive_job().is_none());
14300 /// assert!(x.pig_job().is_none());
14301 /// assert!(x.spark_r_job().is_none());
14302 /// assert!(x.spark_sql_job().is_none());
14303 /// assert!(x.presto_job().is_none());
14304 /// assert!(x.flink_job().is_none());
14305 /// ```
14306 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
14307 mut self,
14308 v: T,
14309 ) -> Self {
14310 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::TrinoJob(v.into()));
14311 self
14312 }
14313
14314 /// The value of [type_job][crate::model::Job::type_job]
14315 /// if it holds a `FlinkJob`, `None` if the field is not set or
14316 /// holds a different branch.
14317 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
14318 #[allow(unreachable_patterns)]
14319 self.type_job.as_ref().and_then(|v| match v {
14320 crate::model::job::TypeJob::FlinkJob(v) => std::option::Option::Some(v),
14321 _ => std::option::Option::None,
14322 })
14323 }
14324
14325 /// Sets the value of [type_job][crate::model::Job::type_job]
14326 /// to hold a `FlinkJob`.
14327 ///
14328 /// Note that all the setters affecting `type_job` are
14329 /// mutually exclusive.
14330 ///
14331 /// # Example
14332 /// ```ignore,no_run
14333 /// # use google_cloud_dataproc_v1::model::Job;
14334 /// use google_cloud_dataproc_v1::model::FlinkJob;
14335 /// let x = Job::new().set_flink_job(FlinkJob::default()/* use setters */);
14336 /// assert!(x.flink_job().is_some());
14337 /// assert!(x.hadoop_job().is_none());
14338 /// assert!(x.spark_job().is_none());
14339 /// assert!(x.pyspark_job().is_none());
14340 /// assert!(x.hive_job().is_none());
14341 /// assert!(x.pig_job().is_none());
14342 /// assert!(x.spark_r_job().is_none());
14343 /// assert!(x.spark_sql_job().is_none());
14344 /// assert!(x.presto_job().is_none());
14345 /// assert!(x.trino_job().is_none());
14346 /// ```
14347 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
14348 mut self,
14349 v: T,
14350 ) -> Self {
14351 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::FlinkJob(v.into()));
14352 self
14353 }
14354}
14355
14356impl wkt::message::Message for Job {
14357 fn typename() -> &'static str {
14358 "type.googleapis.com/google.cloud.dataproc.v1.Job"
14359 }
14360}
14361
14362/// Defines additional types related to [Job].
14363pub mod job {
14364 #[allow(unused_imports)]
14365 use super::*;
14366
14367 /// Required. The application/framework-specific portion of the job.
14368 #[derive(Clone, Debug, PartialEq)]
14369 #[non_exhaustive]
14370 pub enum TypeJob {
14371 /// Optional. Job is a Hadoop job.
14372 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
14373 /// Optional. Job is a Spark job.
14374 SparkJob(std::boxed::Box<crate::model::SparkJob>),
14375 /// Optional. Job is a PySpark job.
14376 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
14377 /// Optional. Job is a Hive job.
14378 HiveJob(std::boxed::Box<crate::model::HiveJob>),
14379 /// Optional. Job is a Pig job.
14380 PigJob(std::boxed::Box<crate::model::PigJob>),
14381 /// Optional. Job is a SparkR job.
14382 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
14383 /// Optional. Job is a SparkSql job.
14384 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
14385 /// Optional. Job is a Presto job.
14386 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
14387 /// Optional. Job is a Trino job.
14388 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
14389 /// Optional. Job is a Flink job.
14390 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
14391 }
14392}
14393
14394/// Driver scheduling configuration.
14395#[derive(Clone, Default, PartialEq)]
14396#[non_exhaustive]
14397pub struct DriverSchedulingConfig {
14398 /// Required. The amount of memory in MB the driver is requesting.
14399 pub memory_mb: i32,
14400
14401 /// Required. The number of vCPUs the driver is requesting.
14402 pub vcores: i32,
14403
14404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14405}
14406
14407impl DriverSchedulingConfig {
14408 pub fn new() -> Self {
14409 std::default::Default::default()
14410 }
14411
14412 /// Sets the value of [memory_mb][crate::model::DriverSchedulingConfig::memory_mb].
14413 ///
14414 /// # Example
14415 /// ```ignore,no_run
14416 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14417 /// let x = DriverSchedulingConfig::new().set_memory_mb(42);
14418 /// ```
14419 pub fn set_memory_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14420 self.memory_mb = v.into();
14421 self
14422 }
14423
14424 /// Sets the value of [vcores][crate::model::DriverSchedulingConfig::vcores].
14425 ///
14426 /// # Example
14427 /// ```ignore,no_run
14428 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14429 /// let x = DriverSchedulingConfig::new().set_vcores(42);
14430 /// ```
14431 pub fn set_vcores<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14432 self.vcores = v.into();
14433 self
14434 }
14435}
14436
14437impl wkt::message::Message for DriverSchedulingConfig {
14438 fn typename() -> &'static str {
14439 "type.googleapis.com/google.cloud.dataproc.v1.DriverSchedulingConfig"
14440 }
14441}
14442
14443/// Job scheduling options.
14444#[derive(Clone, Default, PartialEq)]
14445#[non_exhaustive]
14446pub struct JobScheduling {
14447 /// Optional. Maximum number of times per hour a driver can be restarted as
14448 /// a result of driver exiting with non-zero code before job is
14449 /// reported failed.
14450 ///
14451 /// A job might be reported as thrashing if the driver exits with a non-zero
14452 /// code four times within a 10-minute window.
14453 ///
14454 /// Maximum value is 10.
14455 ///
14456 /// **Note:** This restartable job option is not supported in Dataproc
14457 /// [workflow templates]
14458 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template>).
14459 pub max_failures_per_hour: i32,
14460
14461 /// Optional. Maximum total number of times a driver can be restarted as a
14462 /// result of the driver exiting with a non-zero code. After the maximum number
14463 /// is reached, the job will be reported as failed.
14464 ///
14465 /// Maximum value is 240.
14466 ///
14467 /// **Note:** Currently, this restartable job option is
14468 /// not supported in Dataproc
14469 /// [workflow
14470 /// templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
14471 pub max_failures_total: i32,
14472
14473 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14474}
14475
14476impl JobScheduling {
14477 pub fn new() -> Self {
14478 std::default::Default::default()
14479 }
14480
14481 /// Sets the value of [max_failures_per_hour][crate::model::JobScheduling::max_failures_per_hour].
14482 ///
14483 /// # Example
14484 /// ```ignore,no_run
14485 /// # use google_cloud_dataproc_v1::model::JobScheduling;
14486 /// let x = JobScheduling::new().set_max_failures_per_hour(42);
14487 /// ```
14488 pub fn set_max_failures_per_hour<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14489 self.max_failures_per_hour = v.into();
14490 self
14491 }
14492
14493 /// Sets the value of [max_failures_total][crate::model::JobScheduling::max_failures_total].
14494 ///
14495 /// # Example
14496 /// ```ignore,no_run
14497 /// # use google_cloud_dataproc_v1::model::JobScheduling;
14498 /// let x = JobScheduling::new().set_max_failures_total(42);
14499 /// ```
14500 pub fn set_max_failures_total<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14501 self.max_failures_total = v.into();
14502 self
14503 }
14504}
14505
14506impl wkt::message::Message for JobScheduling {
14507 fn typename() -> &'static str {
14508 "type.googleapis.com/google.cloud.dataproc.v1.JobScheduling"
14509 }
14510}
14511
14512/// A request to submit a job.
14513#[derive(Clone, Default, PartialEq)]
14514#[non_exhaustive]
14515pub struct SubmitJobRequest {
14516 /// Required. The ID of the Google Cloud Platform project that the job
14517 /// belongs to.
14518 pub project_id: std::string::String,
14519
14520 /// Required. The Dataproc region in which to handle the request.
14521 pub region: std::string::String,
14522
14523 /// Required. The job resource.
14524 pub job: std::option::Option<crate::model::Job>,
14525
14526 /// Optional. A unique id used to identify the request. If the server
14527 /// receives two
14528 /// [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
14529 /// with the same id, then the second request will be ignored and the
14530 /// first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend
14531 /// is returned.
14532 ///
14533 /// It is recommended to always set this value to a
14534 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
14535 ///
14536 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
14537 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
14538 ///
14539 /// [google.cloud.dataproc.v1.Job]: crate::model::Job
14540 pub request_id: std::string::String,
14541
14542 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14543}
14544
14545impl SubmitJobRequest {
14546 pub fn new() -> Self {
14547 std::default::Default::default()
14548 }
14549
14550 /// Sets the value of [project_id][crate::model::SubmitJobRequest::project_id].
14551 ///
14552 /// # Example
14553 /// ```ignore,no_run
14554 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14555 /// let x = SubmitJobRequest::new().set_project_id("example");
14556 /// ```
14557 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14558 self.project_id = v.into();
14559 self
14560 }
14561
14562 /// Sets the value of [region][crate::model::SubmitJobRequest::region].
14563 ///
14564 /// # Example
14565 /// ```ignore,no_run
14566 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14567 /// let x = SubmitJobRequest::new().set_region("example");
14568 /// ```
14569 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14570 self.region = v.into();
14571 self
14572 }
14573
14574 /// Sets the value of [job][crate::model::SubmitJobRequest::job].
14575 ///
14576 /// # Example
14577 /// ```ignore,no_run
14578 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14579 /// use google_cloud_dataproc_v1::model::Job;
14580 /// let x = SubmitJobRequest::new().set_job(Job::default()/* use setters */);
14581 /// ```
14582 pub fn set_job<T>(mut self, v: T) -> Self
14583 where
14584 T: std::convert::Into<crate::model::Job>,
14585 {
14586 self.job = std::option::Option::Some(v.into());
14587 self
14588 }
14589
14590 /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
14591 ///
14592 /// # Example
14593 /// ```ignore,no_run
14594 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14595 /// use google_cloud_dataproc_v1::model::Job;
14596 /// let x = SubmitJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
14597 /// let x = SubmitJobRequest::new().set_or_clear_job(None::<Job>);
14598 /// ```
14599 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
14600 where
14601 T: std::convert::Into<crate::model::Job>,
14602 {
14603 self.job = v.map(|x| x.into());
14604 self
14605 }
14606
14607 /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
14608 ///
14609 /// # Example
14610 /// ```ignore,no_run
14611 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14612 /// let x = SubmitJobRequest::new().set_request_id("example");
14613 /// ```
14614 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14615 self.request_id = v.into();
14616 self
14617 }
14618}
14619
14620impl wkt::message::Message for SubmitJobRequest {
14621 fn typename() -> &'static str {
14622 "type.googleapis.com/google.cloud.dataproc.v1.SubmitJobRequest"
14623 }
14624}
14625
14626/// Job Operation metadata.
14627#[derive(Clone, Default, PartialEq)]
14628#[non_exhaustive]
14629pub struct JobMetadata {
14630 /// Output only. The job id.
14631 pub job_id: std::string::String,
14632
14633 /// Output only. Most recent job status.
14634 pub status: std::option::Option<crate::model::JobStatus>,
14635
14636 /// Output only. Operation type.
14637 pub operation_type: std::string::String,
14638
14639 /// Output only. Job submission time.
14640 pub start_time: std::option::Option<wkt::Timestamp>,
14641
14642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14643}
14644
14645impl JobMetadata {
14646 pub fn new() -> Self {
14647 std::default::Default::default()
14648 }
14649
14650 /// Sets the value of [job_id][crate::model::JobMetadata::job_id].
14651 ///
14652 /// # Example
14653 /// ```ignore,no_run
14654 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14655 /// let x = JobMetadata::new().set_job_id("example");
14656 /// ```
14657 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14658 self.job_id = v.into();
14659 self
14660 }
14661
14662 /// Sets the value of [status][crate::model::JobMetadata::status].
14663 ///
14664 /// # Example
14665 /// ```ignore,no_run
14666 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14667 /// use google_cloud_dataproc_v1::model::JobStatus;
14668 /// let x = JobMetadata::new().set_status(JobStatus::default()/* use setters */);
14669 /// ```
14670 pub fn set_status<T>(mut self, v: T) -> Self
14671 where
14672 T: std::convert::Into<crate::model::JobStatus>,
14673 {
14674 self.status = std::option::Option::Some(v.into());
14675 self
14676 }
14677
14678 /// Sets or clears the value of [status][crate::model::JobMetadata::status].
14679 ///
14680 /// # Example
14681 /// ```ignore,no_run
14682 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14683 /// use google_cloud_dataproc_v1::model::JobStatus;
14684 /// let x = JobMetadata::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
14685 /// let x = JobMetadata::new().set_or_clear_status(None::<JobStatus>);
14686 /// ```
14687 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
14688 where
14689 T: std::convert::Into<crate::model::JobStatus>,
14690 {
14691 self.status = v.map(|x| x.into());
14692 self
14693 }
14694
14695 /// Sets the value of [operation_type][crate::model::JobMetadata::operation_type].
14696 ///
14697 /// # Example
14698 /// ```ignore,no_run
14699 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14700 /// let x = JobMetadata::new().set_operation_type("example");
14701 /// ```
14702 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14703 self.operation_type = v.into();
14704 self
14705 }
14706
14707 /// Sets the value of [start_time][crate::model::JobMetadata::start_time].
14708 ///
14709 /// # Example
14710 /// ```ignore,no_run
14711 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14712 /// use wkt::Timestamp;
14713 /// let x = JobMetadata::new().set_start_time(Timestamp::default()/* use setters */);
14714 /// ```
14715 pub fn set_start_time<T>(mut self, v: T) -> Self
14716 where
14717 T: std::convert::Into<wkt::Timestamp>,
14718 {
14719 self.start_time = std::option::Option::Some(v.into());
14720 self
14721 }
14722
14723 /// Sets or clears the value of [start_time][crate::model::JobMetadata::start_time].
14724 ///
14725 /// # Example
14726 /// ```ignore,no_run
14727 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14728 /// use wkt::Timestamp;
14729 /// let x = JobMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
14730 /// let x = JobMetadata::new().set_or_clear_start_time(None::<Timestamp>);
14731 /// ```
14732 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
14733 where
14734 T: std::convert::Into<wkt::Timestamp>,
14735 {
14736 self.start_time = v.map(|x| x.into());
14737 self
14738 }
14739}
14740
14741impl wkt::message::Message for JobMetadata {
14742 fn typename() -> &'static str {
14743 "type.googleapis.com/google.cloud.dataproc.v1.JobMetadata"
14744 }
14745}
14746
14747/// A request to get the resource representation for a job in a project.
14748#[derive(Clone, Default, PartialEq)]
14749#[non_exhaustive]
14750pub struct GetJobRequest {
14751 /// Required. The ID of the Google Cloud Platform project that the job
14752 /// belongs to.
14753 pub project_id: std::string::String,
14754
14755 /// Required. The Dataproc region in which to handle the request.
14756 pub region: std::string::String,
14757
14758 /// Required. The job ID.
14759 pub job_id: std::string::String,
14760
14761 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14762}
14763
14764impl GetJobRequest {
14765 pub fn new() -> Self {
14766 std::default::Default::default()
14767 }
14768
14769 /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
14770 ///
14771 /// # Example
14772 /// ```ignore,no_run
14773 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
14774 /// let x = GetJobRequest::new().set_project_id("example");
14775 /// ```
14776 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14777 self.project_id = v.into();
14778 self
14779 }
14780
14781 /// Sets the value of [region][crate::model::GetJobRequest::region].
14782 ///
14783 /// # Example
14784 /// ```ignore,no_run
14785 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
14786 /// let x = GetJobRequest::new().set_region("example");
14787 /// ```
14788 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14789 self.region = v.into();
14790 self
14791 }
14792
14793 /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
14794 ///
14795 /// # Example
14796 /// ```ignore,no_run
14797 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
14798 /// let x = GetJobRequest::new().set_job_id("example");
14799 /// ```
14800 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14801 self.job_id = v.into();
14802 self
14803 }
14804}
14805
14806impl wkt::message::Message for GetJobRequest {
14807 fn typename() -> &'static str {
14808 "type.googleapis.com/google.cloud.dataproc.v1.GetJobRequest"
14809 }
14810}
14811
14812/// A request to list jobs in a project.
14813#[derive(Clone, Default, PartialEq)]
14814#[non_exhaustive]
14815pub struct ListJobsRequest {
14816 /// Required. The ID of the Google Cloud Platform project that the job
14817 /// belongs to.
14818 pub project_id: std::string::String,
14819
14820 /// Required. The Dataproc region in which to handle the request.
14821 pub region: std::string::String,
14822
14823 /// Optional. The number of results to return in each response.
14824 pub page_size: i32,
14825
14826 /// Optional. The page token, returned by a previous call, to request the
14827 /// next page of results.
14828 pub page_token: std::string::String,
14829
14830 /// Optional. If set, the returned jobs list includes only jobs that were
14831 /// submitted to the named cluster.
14832 pub cluster_name: std::string::String,
14833
14834 /// Optional. Specifies enumerated categories of jobs to list.
14835 /// (default = match ALL jobs).
14836 ///
14837 /// If `filter` is provided, `jobStateMatcher` will be ignored.
14838 pub job_state_matcher: crate::model::list_jobs_request::JobStateMatcher,
14839
14840 /// Optional. A filter constraining the jobs to list. Filters are
14841 /// case-sensitive and have the following syntax:
14842 ///
14843 /// [field = value] AND [field [= value]] ...
14844 ///
14845 /// where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label
14846 /// key. **value** can be `*` to match all values.
14847 /// `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
14848 /// Only the logical `AND` operator is supported; space-separated items are
14849 /// treated as having an implicit `AND` operator.
14850 ///
14851 /// Example filter:
14852 ///
14853 /// status.state = ACTIVE AND labels.env = staging AND labels.starred = *
14854 pub filter: std::string::String,
14855
14856 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14857}
14858
14859impl ListJobsRequest {
14860 pub fn new() -> Self {
14861 std::default::Default::default()
14862 }
14863
14864 /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
14865 ///
14866 /// # Example
14867 /// ```ignore,no_run
14868 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14869 /// let x = ListJobsRequest::new().set_project_id("example");
14870 /// ```
14871 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14872 self.project_id = v.into();
14873 self
14874 }
14875
14876 /// Sets the value of [region][crate::model::ListJobsRequest::region].
14877 ///
14878 /// # Example
14879 /// ```ignore,no_run
14880 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14881 /// let x = ListJobsRequest::new().set_region("example");
14882 /// ```
14883 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14884 self.region = v.into();
14885 self
14886 }
14887
14888 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
14889 ///
14890 /// # Example
14891 /// ```ignore,no_run
14892 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14893 /// let x = ListJobsRequest::new().set_page_size(42);
14894 /// ```
14895 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14896 self.page_size = v.into();
14897 self
14898 }
14899
14900 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
14901 ///
14902 /// # Example
14903 /// ```ignore,no_run
14904 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14905 /// let x = ListJobsRequest::new().set_page_token("example");
14906 /// ```
14907 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14908 self.page_token = v.into();
14909 self
14910 }
14911
14912 /// Sets the value of [cluster_name][crate::model::ListJobsRequest::cluster_name].
14913 ///
14914 /// # Example
14915 /// ```ignore,no_run
14916 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14917 /// let x = ListJobsRequest::new().set_cluster_name("example");
14918 /// ```
14919 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14920 self.cluster_name = v.into();
14921 self
14922 }
14923
14924 /// Sets the value of [job_state_matcher][crate::model::ListJobsRequest::job_state_matcher].
14925 ///
14926 /// # Example
14927 /// ```ignore,no_run
14928 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14929 /// use google_cloud_dataproc_v1::model::list_jobs_request::JobStateMatcher;
14930 /// let x0 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::Active);
14931 /// let x1 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::NonActive);
14932 /// ```
14933 pub fn set_job_state_matcher<
14934 T: std::convert::Into<crate::model::list_jobs_request::JobStateMatcher>,
14935 >(
14936 mut self,
14937 v: T,
14938 ) -> Self {
14939 self.job_state_matcher = v.into();
14940 self
14941 }
14942
14943 /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
14944 ///
14945 /// # Example
14946 /// ```ignore,no_run
14947 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14948 /// let x = ListJobsRequest::new().set_filter("example");
14949 /// ```
14950 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14951 self.filter = v.into();
14952 self
14953 }
14954}
14955
14956impl wkt::message::Message for ListJobsRequest {
14957 fn typename() -> &'static str {
14958 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsRequest"
14959 }
14960}
14961
14962/// Defines additional types related to [ListJobsRequest].
14963pub mod list_jobs_request {
14964 #[allow(unused_imports)]
14965 use super::*;
14966
14967 /// A matcher that specifies categories of job states.
14968 ///
14969 /// # Working with unknown values
14970 ///
14971 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14972 /// additional enum variants at any time. Adding new variants is not considered
14973 /// a breaking change. Applications should write their code in anticipation of:
14974 ///
14975 /// - New values appearing in future releases of the client library, **and**
14976 /// - New values received dynamically, without application changes.
14977 ///
14978 /// Please consult the [Working with enums] section in the user guide for some
14979 /// guidelines.
14980 ///
14981 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14982 #[derive(Clone, Debug, PartialEq)]
14983 #[non_exhaustive]
14984 pub enum JobStateMatcher {
14985 /// Match all jobs, regardless of state.
14986 All,
14987 /// Only match jobs in non-terminal states: PENDING, RUNNING, or
14988 /// CANCEL_PENDING.
14989 Active,
14990 /// Only match jobs in terminal states: CANCELLED, DONE, or ERROR.
14991 NonActive,
14992 /// If set, the enum was initialized with an unknown value.
14993 ///
14994 /// Applications can examine the value using [JobStateMatcher::value] or
14995 /// [JobStateMatcher::name].
14996 UnknownValue(job_state_matcher::UnknownValue),
14997 }
14998
14999 #[doc(hidden)]
15000 pub mod job_state_matcher {
15001 #[allow(unused_imports)]
15002 use super::*;
15003 #[derive(Clone, Debug, PartialEq)]
15004 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15005 }
15006
15007 impl JobStateMatcher {
15008 /// Gets the enum value.
15009 ///
15010 /// Returns `None` if the enum contains an unknown value deserialized from
15011 /// the string representation of enums.
15012 pub fn value(&self) -> std::option::Option<i32> {
15013 match self {
15014 Self::All => std::option::Option::Some(0),
15015 Self::Active => std::option::Option::Some(1),
15016 Self::NonActive => std::option::Option::Some(2),
15017 Self::UnknownValue(u) => u.0.value(),
15018 }
15019 }
15020
15021 /// Gets the enum value as a string.
15022 ///
15023 /// Returns `None` if the enum contains an unknown value deserialized from
15024 /// the integer representation of enums.
15025 pub fn name(&self) -> std::option::Option<&str> {
15026 match self {
15027 Self::All => std::option::Option::Some("ALL"),
15028 Self::Active => std::option::Option::Some("ACTIVE"),
15029 Self::NonActive => std::option::Option::Some("NON_ACTIVE"),
15030 Self::UnknownValue(u) => u.0.name(),
15031 }
15032 }
15033 }
15034
15035 impl std::default::Default for JobStateMatcher {
15036 fn default() -> Self {
15037 use std::convert::From;
15038 Self::from(0)
15039 }
15040 }
15041
15042 impl std::fmt::Display for JobStateMatcher {
15043 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15044 wkt::internal::display_enum(f, self.name(), self.value())
15045 }
15046 }
15047
15048 impl std::convert::From<i32> for JobStateMatcher {
15049 fn from(value: i32) -> Self {
15050 match value {
15051 0 => Self::All,
15052 1 => Self::Active,
15053 2 => Self::NonActive,
15054 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15055 wkt::internal::UnknownEnumValue::Integer(value),
15056 )),
15057 }
15058 }
15059 }
15060
15061 impl std::convert::From<&str> for JobStateMatcher {
15062 fn from(value: &str) -> Self {
15063 use std::string::ToString;
15064 match value {
15065 "ALL" => Self::All,
15066 "ACTIVE" => Self::Active,
15067 "NON_ACTIVE" => Self::NonActive,
15068 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15069 wkt::internal::UnknownEnumValue::String(value.to_string()),
15070 )),
15071 }
15072 }
15073 }
15074
15075 impl serde::ser::Serialize for JobStateMatcher {
15076 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15077 where
15078 S: serde::Serializer,
15079 {
15080 match self {
15081 Self::All => serializer.serialize_i32(0),
15082 Self::Active => serializer.serialize_i32(1),
15083 Self::NonActive => serializer.serialize_i32(2),
15084 Self::UnknownValue(u) => u.0.serialize(serializer),
15085 }
15086 }
15087 }
15088
15089 impl<'de> serde::de::Deserialize<'de> for JobStateMatcher {
15090 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15091 where
15092 D: serde::Deserializer<'de>,
15093 {
15094 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobStateMatcher>::new(
15095 ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher",
15096 ))
15097 }
15098 }
15099}
15100
15101/// A request to update a job.
15102#[derive(Clone, Default, PartialEq)]
15103#[non_exhaustive]
15104pub struct UpdateJobRequest {
15105 /// Required. The ID of the Google Cloud Platform project that the job
15106 /// belongs to.
15107 pub project_id: std::string::String,
15108
15109 /// Required. The Dataproc region in which to handle the request.
15110 pub region: std::string::String,
15111
15112 /// Required. The job ID.
15113 pub job_id: std::string::String,
15114
15115 /// Required. The changes to the job.
15116 pub job: std::option::Option<crate::model::Job>,
15117
15118 /// Required. Specifies the path, relative to \<code\>Job\</code\>, of
15119 /// the field to update. For example, to update the labels of a Job the
15120 /// \<code\>update_mask\</code\> parameter would be specified as
15121 /// \<code\>labels\</code\>, and the `PATCH` request body would specify the new
15122 /// value. \<strong\>Note:\</strong\> Currently, \<code\>labels\</code\> is the only
15123 /// field that can be updated.
15124 pub update_mask: std::option::Option<wkt::FieldMask>,
15125
15126 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15127}
15128
15129impl UpdateJobRequest {
15130 pub fn new() -> Self {
15131 std::default::Default::default()
15132 }
15133
15134 /// Sets the value of [project_id][crate::model::UpdateJobRequest::project_id].
15135 ///
15136 /// # Example
15137 /// ```ignore,no_run
15138 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15139 /// let x = UpdateJobRequest::new().set_project_id("example");
15140 /// ```
15141 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15142 self.project_id = v.into();
15143 self
15144 }
15145
15146 /// Sets the value of [region][crate::model::UpdateJobRequest::region].
15147 ///
15148 /// # Example
15149 /// ```ignore,no_run
15150 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15151 /// let x = UpdateJobRequest::new().set_region("example");
15152 /// ```
15153 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15154 self.region = v.into();
15155 self
15156 }
15157
15158 /// Sets the value of [job_id][crate::model::UpdateJobRequest::job_id].
15159 ///
15160 /// # Example
15161 /// ```ignore,no_run
15162 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15163 /// let x = UpdateJobRequest::new().set_job_id("example");
15164 /// ```
15165 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15166 self.job_id = v.into();
15167 self
15168 }
15169
15170 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
15171 ///
15172 /// # Example
15173 /// ```ignore,no_run
15174 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15175 /// use google_cloud_dataproc_v1::model::Job;
15176 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
15177 /// ```
15178 pub fn set_job<T>(mut self, v: T) -> Self
15179 where
15180 T: std::convert::Into<crate::model::Job>,
15181 {
15182 self.job = std::option::Option::Some(v.into());
15183 self
15184 }
15185
15186 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
15187 ///
15188 /// # Example
15189 /// ```ignore,no_run
15190 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15191 /// use google_cloud_dataproc_v1::model::Job;
15192 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
15193 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
15194 /// ```
15195 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
15196 where
15197 T: std::convert::Into<crate::model::Job>,
15198 {
15199 self.job = v.map(|x| x.into());
15200 self
15201 }
15202
15203 /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15204 ///
15205 /// # Example
15206 /// ```ignore,no_run
15207 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15208 /// use wkt::FieldMask;
15209 /// let x = UpdateJobRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15210 /// ```
15211 pub fn set_update_mask<T>(mut self, v: T) -> Self
15212 where
15213 T: std::convert::Into<wkt::FieldMask>,
15214 {
15215 self.update_mask = std::option::Option::Some(v.into());
15216 self
15217 }
15218
15219 /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15220 ///
15221 /// # Example
15222 /// ```ignore,no_run
15223 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15224 /// use wkt::FieldMask;
15225 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15226 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15227 /// ```
15228 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15229 where
15230 T: std::convert::Into<wkt::FieldMask>,
15231 {
15232 self.update_mask = v.map(|x| x.into());
15233 self
15234 }
15235}
15236
15237impl wkt::message::Message for UpdateJobRequest {
15238 fn typename() -> &'static str {
15239 "type.googleapis.com/google.cloud.dataproc.v1.UpdateJobRequest"
15240 }
15241}
15242
15243/// A list of jobs in a project.
15244#[derive(Clone, Default, PartialEq)]
15245#[non_exhaustive]
15246pub struct ListJobsResponse {
15247 /// Output only. Jobs list.
15248 pub jobs: std::vec::Vec<crate::model::Job>,
15249
15250 /// Optional. This token is included in the response if there are more results
15251 /// to fetch. To fetch additional results, provide this value as the
15252 /// `page_token` in a subsequent \<code\>ListJobsRequest\</code\>.
15253 pub next_page_token: std::string::String,
15254
15255 /// Output only. List of jobs with
15256 /// [kms_key][google.cloud.dataproc.v1.EncryptionConfig.kms_key]-encrypted
15257 /// parameters that could not be decrypted. A response to a `jobs.get` request
15258 /// may indicate the reason for the decryption failure for a specific job.
15259 ///
15260 /// [google.cloud.dataproc.v1.EncryptionConfig.kms_key]: crate::model::EncryptionConfig::kms_key
15261 pub unreachable: std::vec::Vec<std::string::String>,
15262
15263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15264}
15265
15266impl ListJobsResponse {
15267 pub fn new() -> Self {
15268 std::default::Default::default()
15269 }
15270
15271 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
15272 ///
15273 /// # Example
15274 /// ```ignore,no_run
15275 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15276 /// use google_cloud_dataproc_v1::model::Job;
15277 /// let x = ListJobsResponse::new()
15278 /// .set_jobs([
15279 /// Job::default()/* use setters */,
15280 /// Job::default()/* use (different) setters */,
15281 /// ]);
15282 /// ```
15283 pub fn set_jobs<T, V>(mut self, v: T) -> Self
15284 where
15285 T: std::iter::IntoIterator<Item = V>,
15286 V: std::convert::Into<crate::model::Job>,
15287 {
15288 use std::iter::Iterator;
15289 self.jobs = v.into_iter().map(|i| i.into()).collect();
15290 self
15291 }
15292
15293 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
15294 ///
15295 /// # Example
15296 /// ```ignore,no_run
15297 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15298 /// let x = ListJobsResponse::new().set_next_page_token("example");
15299 /// ```
15300 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15301 self.next_page_token = v.into();
15302 self
15303 }
15304
15305 /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
15306 ///
15307 /// # Example
15308 /// ```ignore,no_run
15309 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15310 /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
15311 /// ```
15312 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
15313 where
15314 T: std::iter::IntoIterator<Item = V>,
15315 V: std::convert::Into<std::string::String>,
15316 {
15317 use std::iter::Iterator;
15318 self.unreachable = v.into_iter().map(|i| i.into()).collect();
15319 self
15320 }
15321}
15322
15323impl wkt::message::Message for ListJobsResponse {
15324 fn typename() -> &'static str {
15325 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsResponse"
15326 }
15327}
15328
15329#[doc(hidden)]
15330impl gax::paginator::internal::PageableResponse for ListJobsResponse {
15331 type PageItem = crate::model::Job;
15332
15333 fn items(self) -> std::vec::Vec<Self::PageItem> {
15334 self.jobs
15335 }
15336
15337 fn next_page_token(&self) -> std::string::String {
15338 use std::clone::Clone;
15339 self.next_page_token.clone()
15340 }
15341}
15342
15343/// A request to cancel a job.
15344#[derive(Clone, Default, PartialEq)]
15345#[non_exhaustive]
15346pub struct CancelJobRequest {
15347 /// Required. The ID of the Google Cloud Platform project that the job
15348 /// belongs to.
15349 pub project_id: std::string::String,
15350
15351 /// Required. The Dataproc region in which to handle the request.
15352 pub region: std::string::String,
15353
15354 /// Required. The job ID.
15355 pub job_id: std::string::String,
15356
15357 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15358}
15359
15360impl CancelJobRequest {
15361 pub fn new() -> Self {
15362 std::default::Default::default()
15363 }
15364
15365 /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
15366 ///
15367 /// # Example
15368 /// ```ignore,no_run
15369 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15370 /// let x = CancelJobRequest::new().set_project_id("example");
15371 /// ```
15372 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15373 self.project_id = v.into();
15374 self
15375 }
15376
15377 /// Sets the value of [region][crate::model::CancelJobRequest::region].
15378 ///
15379 /// # Example
15380 /// ```ignore,no_run
15381 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15382 /// let x = CancelJobRequest::new().set_region("example");
15383 /// ```
15384 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15385 self.region = v.into();
15386 self
15387 }
15388
15389 /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
15390 ///
15391 /// # Example
15392 /// ```ignore,no_run
15393 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15394 /// let x = CancelJobRequest::new().set_job_id("example");
15395 /// ```
15396 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15397 self.job_id = v.into();
15398 self
15399 }
15400}
15401
15402impl wkt::message::Message for CancelJobRequest {
15403 fn typename() -> &'static str {
15404 "type.googleapis.com/google.cloud.dataproc.v1.CancelJobRequest"
15405 }
15406}
15407
15408/// A request to delete a job.
15409#[derive(Clone, Default, PartialEq)]
15410#[non_exhaustive]
15411pub struct DeleteJobRequest {
15412 /// Required. The ID of the Google Cloud Platform project that the job
15413 /// belongs to.
15414 pub project_id: std::string::String,
15415
15416 /// Required. The Dataproc region in which to handle the request.
15417 pub region: std::string::String,
15418
15419 /// Required. The job ID.
15420 pub job_id: std::string::String,
15421
15422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15423}
15424
15425impl DeleteJobRequest {
15426 pub fn new() -> Self {
15427 std::default::Default::default()
15428 }
15429
15430 /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
15431 ///
15432 /// # Example
15433 /// ```ignore,no_run
15434 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15435 /// let x = DeleteJobRequest::new().set_project_id("example");
15436 /// ```
15437 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15438 self.project_id = v.into();
15439 self
15440 }
15441
15442 /// Sets the value of [region][crate::model::DeleteJobRequest::region].
15443 ///
15444 /// # Example
15445 /// ```ignore,no_run
15446 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15447 /// let x = DeleteJobRequest::new().set_region("example");
15448 /// ```
15449 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15450 self.region = v.into();
15451 self
15452 }
15453
15454 /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
15455 ///
15456 /// # Example
15457 /// ```ignore,no_run
15458 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15459 /// let x = DeleteJobRequest::new().set_job_id("example");
15460 /// ```
15461 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15462 self.job_id = v.into();
15463 self
15464 }
15465}
15466
15467impl wkt::message::Message for DeleteJobRequest {
15468 fn typename() -> &'static str {
15469 "type.googleapis.com/google.cloud.dataproc.v1.DeleteJobRequest"
15470 }
15471}
15472
15473/// A request to create a node group.
15474#[derive(Clone, Default, PartialEq)]
15475#[non_exhaustive]
15476pub struct CreateNodeGroupRequest {
15477 /// Required. The parent resource where this node group will be created.
15478 /// Format: `projects/{project}/regions/{region}/clusters/{cluster}`
15479 pub parent: std::string::String,
15480
15481 /// Required. The node group to create.
15482 pub node_group: std::option::Option<crate::model::NodeGroup>,
15483
15484 /// Optional. An optional node group ID. Generated if not specified.
15485 ///
15486 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15487 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
15488 /// or hyphen. Must consist of from 3 to 33 characters.
15489 pub node_group_id: std::string::String,
15490
15491 /// Optional. A unique ID used to identify the request. If the server receives
15492 /// two
15493 /// [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests)
15494 /// with the same ID, the second request is ignored and the
15495 /// first [google.longrunning.Operation][google.longrunning.Operation] created
15496 /// and stored in the backend is returned.
15497 ///
15498 /// Recommendation: Set this value to a
15499 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15500 ///
15501 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15502 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15503 ///
15504 /// [google.longrunning.Operation]: longrunning::model::Operation
15505 pub request_id: std::string::String,
15506
15507 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15508}
15509
15510impl CreateNodeGroupRequest {
15511 pub fn new() -> Self {
15512 std::default::Default::default()
15513 }
15514
15515 /// Sets the value of [parent][crate::model::CreateNodeGroupRequest::parent].
15516 ///
15517 /// # Example
15518 /// ```ignore,no_run
15519 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15520 /// let x = CreateNodeGroupRequest::new().set_parent("example");
15521 /// ```
15522 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15523 self.parent = v.into();
15524 self
15525 }
15526
15527 /// Sets the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
15528 ///
15529 /// # Example
15530 /// ```ignore,no_run
15531 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15532 /// use google_cloud_dataproc_v1::model::NodeGroup;
15533 /// let x = CreateNodeGroupRequest::new().set_node_group(NodeGroup::default()/* use setters */);
15534 /// ```
15535 pub fn set_node_group<T>(mut self, v: T) -> Self
15536 where
15537 T: std::convert::Into<crate::model::NodeGroup>,
15538 {
15539 self.node_group = std::option::Option::Some(v.into());
15540 self
15541 }
15542
15543 /// Sets or clears the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
15544 ///
15545 /// # Example
15546 /// ```ignore,no_run
15547 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15548 /// use google_cloud_dataproc_v1::model::NodeGroup;
15549 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
15550 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(None::<NodeGroup>);
15551 /// ```
15552 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
15553 where
15554 T: std::convert::Into<crate::model::NodeGroup>,
15555 {
15556 self.node_group = v.map(|x| x.into());
15557 self
15558 }
15559
15560 /// Sets the value of [node_group_id][crate::model::CreateNodeGroupRequest::node_group_id].
15561 ///
15562 /// # Example
15563 /// ```ignore,no_run
15564 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15565 /// let x = CreateNodeGroupRequest::new().set_node_group_id("example");
15566 /// ```
15567 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15568 self.node_group_id = v.into();
15569 self
15570 }
15571
15572 /// Sets the value of [request_id][crate::model::CreateNodeGroupRequest::request_id].
15573 ///
15574 /// # Example
15575 /// ```ignore,no_run
15576 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15577 /// let x = CreateNodeGroupRequest::new().set_request_id("example");
15578 /// ```
15579 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15580 self.request_id = v.into();
15581 self
15582 }
15583}
15584
15585impl wkt::message::Message for CreateNodeGroupRequest {
15586 fn typename() -> &'static str {
15587 "type.googleapis.com/google.cloud.dataproc.v1.CreateNodeGroupRequest"
15588 }
15589}
15590
15591/// A request to resize a node group.
15592#[derive(Clone, Default, PartialEq)]
15593#[non_exhaustive]
15594pub struct ResizeNodeGroupRequest {
15595 /// Required. The name of the node group to resize.
15596 /// Format:
15597 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
15598 pub name: std::string::String,
15599
15600 /// Required. The number of running instances for the node group to maintain.
15601 /// The group adds or removes instances to maintain the number of instances
15602 /// specified by this parameter.
15603 pub size: i32,
15604
15605 /// Optional. A unique ID used to identify the request. If the server receives
15606 /// two
15607 /// [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests)
15608 /// with the same ID, the second request is ignored and the
15609 /// first [google.longrunning.Operation][google.longrunning.Operation] created
15610 /// and stored in the backend is returned.
15611 ///
15612 /// Recommendation: Set this value to a
15613 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15614 ///
15615 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15616 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15617 ///
15618 /// [google.longrunning.Operation]: longrunning::model::Operation
15619 pub request_id: std::string::String,
15620
15621 /// Optional. Timeout for graceful YARN decommissioning. [Graceful
15622 /// decommissioning]
15623 /// (<https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning>)
15624 /// allows the removal of nodes from the Compute Engine node group
15625 /// without interrupting jobs in progress. This timeout specifies how long to
15626 /// wait for jobs in progress to finish before forcefully removing nodes (and
15627 /// potentially interrupting jobs). Default timeout is 0 (for forceful
15628 /// decommission), and the maximum allowed timeout is 1 day. (see JSON
15629 /// representation of
15630 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
15631 ///
15632 /// Only supported on Dataproc image versions 1.2 and higher.
15633 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
15634
15635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15636}
15637
15638impl ResizeNodeGroupRequest {
15639 pub fn new() -> Self {
15640 std::default::Default::default()
15641 }
15642
15643 /// Sets the value of [name][crate::model::ResizeNodeGroupRequest::name].
15644 ///
15645 /// # Example
15646 /// ```ignore,no_run
15647 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15648 /// let x = ResizeNodeGroupRequest::new().set_name("example");
15649 /// ```
15650 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15651 self.name = v.into();
15652 self
15653 }
15654
15655 /// Sets the value of [size][crate::model::ResizeNodeGroupRequest::size].
15656 ///
15657 /// # Example
15658 /// ```ignore,no_run
15659 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15660 /// let x = ResizeNodeGroupRequest::new().set_size(42);
15661 /// ```
15662 pub fn set_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15663 self.size = v.into();
15664 self
15665 }
15666
15667 /// Sets the value of [request_id][crate::model::ResizeNodeGroupRequest::request_id].
15668 ///
15669 /// # Example
15670 /// ```ignore,no_run
15671 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15672 /// let x = ResizeNodeGroupRequest::new().set_request_id("example");
15673 /// ```
15674 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15675 self.request_id = v.into();
15676 self
15677 }
15678
15679 /// Sets the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
15680 ///
15681 /// # Example
15682 /// ```ignore,no_run
15683 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15684 /// use wkt::Duration;
15685 /// let x = ResizeNodeGroupRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
15686 /// ```
15687 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
15688 where
15689 T: std::convert::Into<wkt::Duration>,
15690 {
15691 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
15692 self
15693 }
15694
15695 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
15696 ///
15697 /// # Example
15698 /// ```ignore,no_run
15699 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15700 /// use wkt::Duration;
15701 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
15702 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
15703 /// ```
15704 pub fn set_or_clear_graceful_decommission_timeout<T>(
15705 mut self,
15706 v: std::option::Option<T>,
15707 ) -> Self
15708 where
15709 T: std::convert::Into<wkt::Duration>,
15710 {
15711 self.graceful_decommission_timeout = v.map(|x| x.into());
15712 self
15713 }
15714}
15715
15716impl wkt::message::Message for ResizeNodeGroupRequest {
15717 fn typename() -> &'static str {
15718 "type.googleapis.com/google.cloud.dataproc.v1.ResizeNodeGroupRequest"
15719 }
15720}
15721
15722/// A request to get a node group .
15723#[derive(Clone, Default, PartialEq)]
15724#[non_exhaustive]
15725pub struct GetNodeGroupRequest {
15726 /// Required. The name of the node group to retrieve.
15727 /// Format:
15728 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
15729 pub name: std::string::String,
15730
15731 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15732}
15733
15734impl GetNodeGroupRequest {
15735 pub fn new() -> Self {
15736 std::default::Default::default()
15737 }
15738
15739 /// Sets the value of [name][crate::model::GetNodeGroupRequest::name].
15740 ///
15741 /// # Example
15742 /// ```ignore,no_run
15743 /// # use google_cloud_dataproc_v1::model::GetNodeGroupRequest;
15744 /// let x = GetNodeGroupRequest::new().set_name("example");
15745 /// ```
15746 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15747 self.name = v.into();
15748 self
15749 }
15750}
15751
15752impl wkt::message::Message for GetNodeGroupRequest {
15753 fn typename() -> &'static str {
15754 "type.googleapis.com/google.cloud.dataproc.v1.GetNodeGroupRequest"
15755 }
15756}
15757
15758/// Metadata describing the Batch operation.
15759#[derive(Clone, Default, PartialEq)]
15760#[non_exhaustive]
15761pub struct BatchOperationMetadata {
15762 /// Name of the batch for the operation.
15763 pub batch: std::string::String,
15764
15765 /// Batch UUID for the operation.
15766 pub batch_uuid: std::string::String,
15767
15768 /// The time when the operation was created.
15769 pub create_time: std::option::Option<wkt::Timestamp>,
15770
15771 /// The time when the operation finished.
15772 pub done_time: std::option::Option<wkt::Timestamp>,
15773
15774 /// The operation type.
15775 pub operation_type: crate::model::batch_operation_metadata::BatchOperationType,
15776
15777 /// Short description of the operation.
15778 pub description: std::string::String,
15779
15780 /// Labels associated with the operation.
15781 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15782
15783 /// Warnings encountered during operation execution.
15784 pub warnings: std::vec::Vec<std::string::String>,
15785
15786 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15787}
15788
15789impl BatchOperationMetadata {
15790 pub fn new() -> Self {
15791 std::default::Default::default()
15792 }
15793
15794 /// Sets the value of [batch][crate::model::BatchOperationMetadata::batch].
15795 ///
15796 /// # Example
15797 /// ```ignore,no_run
15798 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15799 /// let x = BatchOperationMetadata::new().set_batch("example");
15800 /// ```
15801 pub fn set_batch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15802 self.batch = v.into();
15803 self
15804 }
15805
15806 /// Sets the value of [batch_uuid][crate::model::BatchOperationMetadata::batch_uuid].
15807 ///
15808 /// # Example
15809 /// ```ignore,no_run
15810 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15811 /// let x = BatchOperationMetadata::new().set_batch_uuid("example");
15812 /// ```
15813 pub fn set_batch_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15814 self.batch_uuid = v.into();
15815 self
15816 }
15817
15818 /// Sets the value of [create_time][crate::model::BatchOperationMetadata::create_time].
15819 ///
15820 /// # Example
15821 /// ```ignore,no_run
15822 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15823 /// use wkt::Timestamp;
15824 /// let x = BatchOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
15825 /// ```
15826 pub fn set_create_time<T>(mut self, v: T) -> Self
15827 where
15828 T: std::convert::Into<wkt::Timestamp>,
15829 {
15830 self.create_time = std::option::Option::Some(v.into());
15831 self
15832 }
15833
15834 /// Sets or clears the value of [create_time][crate::model::BatchOperationMetadata::create_time].
15835 ///
15836 /// # Example
15837 /// ```ignore,no_run
15838 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15839 /// use wkt::Timestamp;
15840 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15841 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
15842 /// ```
15843 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15844 where
15845 T: std::convert::Into<wkt::Timestamp>,
15846 {
15847 self.create_time = v.map(|x| x.into());
15848 self
15849 }
15850
15851 /// Sets the value of [done_time][crate::model::BatchOperationMetadata::done_time].
15852 ///
15853 /// # Example
15854 /// ```ignore,no_run
15855 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15856 /// use wkt::Timestamp;
15857 /// let x = BatchOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
15858 /// ```
15859 pub fn set_done_time<T>(mut self, v: T) -> Self
15860 where
15861 T: std::convert::Into<wkt::Timestamp>,
15862 {
15863 self.done_time = std::option::Option::Some(v.into());
15864 self
15865 }
15866
15867 /// Sets or clears the value of [done_time][crate::model::BatchOperationMetadata::done_time].
15868 ///
15869 /// # Example
15870 /// ```ignore,no_run
15871 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15872 /// use wkt::Timestamp;
15873 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
15874 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
15875 /// ```
15876 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
15877 where
15878 T: std::convert::Into<wkt::Timestamp>,
15879 {
15880 self.done_time = v.map(|x| x.into());
15881 self
15882 }
15883
15884 /// Sets the value of [operation_type][crate::model::BatchOperationMetadata::operation_type].
15885 ///
15886 /// # Example
15887 /// ```ignore,no_run
15888 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15889 /// use google_cloud_dataproc_v1::model::batch_operation_metadata::BatchOperationType;
15890 /// let x0 = BatchOperationMetadata::new().set_operation_type(BatchOperationType::Batch);
15891 /// ```
15892 pub fn set_operation_type<
15893 T: std::convert::Into<crate::model::batch_operation_metadata::BatchOperationType>,
15894 >(
15895 mut self,
15896 v: T,
15897 ) -> Self {
15898 self.operation_type = v.into();
15899 self
15900 }
15901
15902 /// Sets the value of [description][crate::model::BatchOperationMetadata::description].
15903 ///
15904 /// # Example
15905 /// ```ignore,no_run
15906 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15907 /// let x = BatchOperationMetadata::new().set_description("example");
15908 /// ```
15909 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15910 self.description = v.into();
15911 self
15912 }
15913
15914 /// Sets the value of [labels][crate::model::BatchOperationMetadata::labels].
15915 ///
15916 /// # Example
15917 /// ```ignore,no_run
15918 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15919 /// let x = BatchOperationMetadata::new().set_labels([
15920 /// ("key0", "abc"),
15921 /// ("key1", "xyz"),
15922 /// ]);
15923 /// ```
15924 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15925 where
15926 T: std::iter::IntoIterator<Item = (K, V)>,
15927 K: std::convert::Into<std::string::String>,
15928 V: std::convert::Into<std::string::String>,
15929 {
15930 use std::iter::Iterator;
15931 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15932 self
15933 }
15934
15935 /// Sets the value of [warnings][crate::model::BatchOperationMetadata::warnings].
15936 ///
15937 /// # Example
15938 /// ```ignore,no_run
15939 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15940 /// let x = BatchOperationMetadata::new().set_warnings(["a", "b", "c"]);
15941 /// ```
15942 pub fn set_warnings<T, V>(mut self, v: T) -> Self
15943 where
15944 T: std::iter::IntoIterator<Item = V>,
15945 V: std::convert::Into<std::string::String>,
15946 {
15947 use std::iter::Iterator;
15948 self.warnings = v.into_iter().map(|i| i.into()).collect();
15949 self
15950 }
15951}
15952
15953impl wkt::message::Message for BatchOperationMetadata {
15954 fn typename() -> &'static str {
15955 "type.googleapis.com/google.cloud.dataproc.v1.BatchOperationMetadata"
15956 }
15957}
15958
15959/// Defines additional types related to [BatchOperationMetadata].
15960pub mod batch_operation_metadata {
15961 #[allow(unused_imports)]
15962 use super::*;
15963
15964 /// Operation type for Batch resources
15965 ///
15966 /// # Working with unknown values
15967 ///
15968 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15969 /// additional enum variants at any time. Adding new variants is not considered
15970 /// a breaking change. Applications should write their code in anticipation of:
15971 ///
15972 /// - New values appearing in future releases of the client library, **and**
15973 /// - New values received dynamically, without application changes.
15974 ///
15975 /// Please consult the [Working with enums] section in the user guide for some
15976 /// guidelines.
15977 ///
15978 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15979 #[derive(Clone, Debug, PartialEq)]
15980 #[non_exhaustive]
15981 pub enum BatchOperationType {
15982 /// Batch operation type is unknown.
15983 Unspecified,
15984 /// Batch operation type.
15985 Batch,
15986 /// If set, the enum was initialized with an unknown value.
15987 ///
15988 /// Applications can examine the value using [BatchOperationType::value] or
15989 /// [BatchOperationType::name].
15990 UnknownValue(batch_operation_type::UnknownValue),
15991 }
15992
15993 #[doc(hidden)]
15994 pub mod batch_operation_type {
15995 #[allow(unused_imports)]
15996 use super::*;
15997 #[derive(Clone, Debug, PartialEq)]
15998 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15999 }
16000
16001 impl BatchOperationType {
16002 /// Gets the enum value.
16003 ///
16004 /// Returns `None` if the enum contains an unknown value deserialized from
16005 /// the string representation of enums.
16006 pub fn value(&self) -> std::option::Option<i32> {
16007 match self {
16008 Self::Unspecified => std::option::Option::Some(0),
16009 Self::Batch => std::option::Option::Some(1),
16010 Self::UnknownValue(u) => u.0.value(),
16011 }
16012 }
16013
16014 /// Gets the enum value as a string.
16015 ///
16016 /// Returns `None` if the enum contains an unknown value deserialized from
16017 /// the integer representation of enums.
16018 pub fn name(&self) -> std::option::Option<&str> {
16019 match self {
16020 Self::Unspecified => std::option::Option::Some("BATCH_OPERATION_TYPE_UNSPECIFIED"),
16021 Self::Batch => std::option::Option::Some("BATCH"),
16022 Self::UnknownValue(u) => u.0.name(),
16023 }
16024 }
16025 }
16026
16027 impl std::default::Default for BatchOperationType {
16028 fn default() -> Self {
16029 use std::convert::From;
16030 Self::from(0)
16031 }
16032 }
16033
16034 impl std::fmt::Display for BatchOperationType {
16035 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16036 wkt::internal::display_enum(f, self.name(), self.value())
16037 }
16038 }
16039
16040 impl std::convert::From<i32> for BatchOperationType {
16041 fn from(value: i32) -> Self {
16042 match value {
16043 0 => Self::Unspecified,
16044 1 => Self::Batch,
16045 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16046 wkt::internal::UnknownEnumValue::Integer(value),
16047 )),
16048 }
16049 }
16050 }
16051
16052 impl std::convert::From<&str> for BatchOperationType {
16053 fn from(value: &str) -> Self {
16054 use std::string::ToString;
16055 match value {
16056 "BATCH_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16057 "BATCH" => Self::Batch,
16058 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16059 wkt::internal::UnknownEnumValue::String(value.to_string()),
16060 )),
16061 }
16062 }
16063 }
16064
16065 impl serde::ser::Serialize for BatchOperationType {
16066 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16067 where
16068 S: serde::Serializer,
16069 {
16070 match self {
16071 Self::Unspecified => serializer.serialize_i32(0),
16072 Self::Batch => serializer.serialize_i32(1),
16073 Self::UnknownValue(u) => u.0.serialize(serializer),
16074 }
16075 }
16076 }
16077
16078 impl<'de> serde::de::Deserialize<'de> for BatchOperationType {
16079 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16080 where
16081 D: serde::Deserializer<'de>,
16082 {
16083 deserializer.deserialize_any(wkt::internal::EnumVisitor::<BatchOperationType>::new(
16084 ".google.cloud.dataproc.v1.BatchOperationMetadata.BatchOperationType",
16085 ))
16086 }
16087 }
16088}
16089
16090/// Metadata describing the Session operation.
16091#[derive(Clone, Default, PartialEq)]
16092#[non_exhaustive]
16093pub struct SessionOperationMetadata {
16094 /// Name of the session for the operation.
16095 pub session: std::string::String,
16096
16097 /// Session UUID for the operation.
16098 pub session_uuid: std::string::String,
16099
16100 /// The time when the operation was created.
16101 pub create_time: std::option::Option<wkt::Timestamp>,
16102
16103 /// The time when the operation was finished.
16104 pub done_time: std::option::Option<wkt::Timestamp>,
16105
16106 /// The operation type.
16107 pub operation_type: crate::model::session_operation_metadata::SessionOperationType,
16108
16109 /// Short description of the operation.
16110 pub description: std::string::String,
16111
16112 /// Labels associated with the operation.
16113 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16114
16115 /// Warnings encountered during operation execution.
16116 pub warnings: std::vec::Vec<std::string::String>,
16117
16118 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16119}
16120
16121impl SessionOperationMetadata {
16122 pub fn new() -> Self {
16123 std::default::Default::default()
16124 }
16125
16126 /// Sets the value of [session][crate::model::SessionOperationMetadata::session].
16127 ///
16128 /// # Example
16129 /// ```ignore,no_run
16130 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16131 /// let x = SessionOperationMetadata::new().set_session("example");
16132 /// ```
16133 pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16134 self.session = v.into();
16135 self
16136 }
16137
16138 /// Sets the value of [session_uuid][crate::model::SessionOperationMetadata::session_uuid].
16139 ///
16140 /// # Example
16141 /// ```ignore,no_run
16142 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16143 /// let x = SessionOperationMetadata::new().set_session_uuid("example");
16144 /// ```
16145 pub fn set_session_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16146 self.session_uuid = v.into();
16147 self
16148 }
16149
16150 /// Sets the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16151 ///
16152 /// # Example
16153 /// ```ignore,no_run
16154 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16155 /// use wkt::Timestamp;
16156 /// let x = SessionOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16157 /// ```
16158 pub fn set_create_time<T>(mut self, v: T) -> Self
16159 where
16160 T: std::convert::Into<wkt::Timestamp>,
16161 {
16162 self.create_time = std::option::Option::Some(v.into());
16163 self
16164 }
16165
16166 /// Sets or clears the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16167 ///
16168 /// # Example
16169 /// ```ignore,no_run
16170 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16171 /// use wkt::Timestamp;
16172 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16173 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16174 /// ```
16175 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16176 where
16177 T: std::convert::Into<wkt::Timestamp>,
16178 {
16179 self.create_time = v.map(|x| x.into());
16180 self
16181 }
16182
16183 /// Sets the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16184 ///
16185 /// # Example
16186 /// ```ignore,no_run
16187 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16188 /// use wkt::Timestamp;
16189 /// let x = SessionOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16190 /// ```
16191 pub fn set_done_time<T>(mut self, v: T) -> Self
16192 where
16193 T: std::convert::Into<wkt::Timestamp>,
16194 {
16195 self.done_time = std::option::Option::Some(v.into());
16196 self
16197 }
16198
16199 /// Sets or clears the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16200 ///
16201 /// # Example
16202 /// ```ignore,no_run
16203 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16204 /// use wkt::Timestamp;
16205 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16206 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16207 /// ```
16208 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16209 where
16210 T: std::convert::Into<wkt::Timestamp>,
16211 {
16212 self.done_time = v.map(|x| x.into());
16213 self
16214 }
16215
16216 /// Sets the value of [operation_type][crate::model::SessionOperationMetadata::operation_type].
16217 ///
16218 /// # Example
16219 /// ```ignore,no_run
16220 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16221 /// use google_cloud_dataproc_v1::model::session_operation_metadata::SessionOperationType;
16222 /// let x0 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Create);
16223 /// let x1 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Terminate);
16224 /// let x2 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Delete);
16225 /// ```
16226 pub fn set_operation_type<
16227 T: std::convert::Into<crate::model::session_operation_metadata::SessionOperationType>,
16228 >(
16229 mut self,
16230 v: T,
16231 ) -> Self {
16232 self.operation_type = v.into();
16233 self
16234 }
16235
16236 /// Sets the value of [description][crate::model::SessionOperationMetadata::description].
16237 ///
16238 /// # Example
16239 /// ```ignore,no_run
16240 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16241 /// let x = SessionOperationMetadata::new().set_description("example");
16242 /// ```
16243 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16244 self.description = v.into();
16245 self
16246 }
16247
16248 /// Sets the value of [labels][crate::model::SessionOperationMetadata::labels].
16249 ///
16250 /// # Example
16251 /// ```ignore,no_run
16252 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16253 /// let x = SessionOperationMetadata::new().set_labels([
16254 /// ("key0", "abc"),
16255 /// ("key1", "xyz"),
16256 /// ]);
16257 /// ```
16258 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16259 where
16260 T: std::iter::IntoIterator<Item = (K, V)>,
16261 K: std::convert::Into<std::string::String>,
16262 V: std::convert::Into<std::string::String>,
16263 {
16264 use std::iter::Iterator;
16265 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16266 self
16267 }
16268
16269 /// Sets the value of [warnings][crate::model::SessionOperationMetadata::warnings].
16270 ///
16271 /// # Example
16272 /// ```ignore,no_run
16273 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16274 /// let x = SessionOperationMetadata::new().set_warnings(["a", "b", "c"]);
16275 /// ```
16276 pub fn set_warnings<T, V>(mut self, v: T) -> Self
16277 where
16278 T: std::iter::IntoIterator<Item = V>,
16279 V: std::convert::Into<std::string::String>,
16280 {
16281 use std::iter::Iterator;
16282 self.warnings = v.into_iter().map(|i| i.into()).collect();
16283 self
16284 }
16285}
16286
16287impl wkt::message::Message for SessionOperationMetadata {
16288 fn typename() -> &'static str {
16289 "type.googleapis.com/google.cloud.dataproc.v1.SessionOperationMetadata"
16290 }
16291}
16292
16293/// Defines additional types related to [SessionOperationMetadata].
16294pub mod session_operation_metadata {
16295 #[allow(unused_imports)]
16296 use super::*;
16297
16298 /// Operation type for Session resources
16299 ///
16300 /// # Working with unknown values
16301 ///
16302 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16303 /// additional enum variants at any time. Adding new variants is not considered
16304 /// a breaking change. Applications should write their code in anticipation of:
16305 ///
16306 /// - New values appearing in future releases of the client library, **and**
16307 /// - New values received dynamically, without application changes.
16308 ///
16309 /// Please consult the [Working with enums] section in the user guide for some
16310 /// guidelines.
16311 ///
16312 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16313 #[derive(Clone, Debug, PartialEq)]
16314 #[non_exhaustive]
16315 pub enum SessionOperationType {
16316 /// Session operation type is unknown.
16317 Unspecified,
16318 /// Create Session operation type.
16319 Create,
16320 /// Terminate Session operation type.
16321 Terminate,
16322 /// Delete Session operation type.
16323 Delete,
16324 /// If set, the enum was initialized with an unknown value.
16325 ///
16326 /// Applications can examine the value using [SessionOperationType::value] or
16327 /// [SessionOperationType::name].
16328 UnknownValue(session_operation_type::UnknownValue),
16329 }
16330
16331 #[doc(hidden)]
16332 pub mod session_operation_type {
16333 #[allow(unused_imports)]
16334 use super::*;
16335 #[derive(Clone, Debug, PartialEq)]
16336 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16337 }
16338
16339 impl SessionOperationType {
16340 /// Gets the enum value.
16341 ///
16342 /// Returns `None` if the enum contains an unknown value deserialized from
16343 /// the string representation of enums.
16344 pub fn value(&self) -> std::option::Option<i32> {
16345 match self {
16346 Self::Unspecified => std::option::Option::Some(0),
16347 Self::Create => std::option::Option::Some(1),
16348 Self::Terminate => std::option::Option::Some(2),
16349 Self::Delete => std::option::Option::Some(3),
16350 Self::UnknownValue(u) => u.0.value(),
16351 }
16352 }
16353
16354 /// Gets the enum value as a string.
16355 ///
16356 /// Returns `None` if the enum contains an unknown value deserialized from
16357 /// the integer representation of enums.
16358 pub fn name(&self) -> std::option::Option<&str> {
16359 match self {
16360 Self::Unspecified => {
16361 std::option::Option::Some("SESSION_OPERATION_TYPE_UNSPECIFIED")
16362 }
16363 Self::Create => std::option::Option::Some("CREATE"),
16364 Self::Terminate => std::option::Option::Some("TERMINATE"),
16365 Self::Delete => std::option::Option::Some("DELETE"),
16366 Self::UnknownValue(u) => u.0.name(),
16367 }
16368 }
16369 }
16370
16371 impl std::default::Default for SessionOperationType {
16372 fn default() -> Self {
16373 use std::convert::From;
16374 Self::from(0)
16375 }
16376 }
16377
16378 impl std::fmt::Display for SessionOperationType {
16379 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16380 wkt::internal::display_enum(f, self.name(), self.value())
16381 }
16382 }
16383
16384 impl std::convert::From<i32> for SessionOperationType {
16385 fn from(value: i32) -> Self {
16386 match value {
16387 0 => Self::Unspecified,
16388 1 => Self::Create,
16389 2 => Self::Terminate,
16390 3 => Self::Delete,
16391 _ => Self::UnknownValue(session_operation_type::UnknownValue(
16392 wkt::internal::UnknownEnumValue::Integer(value),
16393 )),
16394 }
16395 }
16396 }
16397
16398 impl std::convert::From<&str> for SessionOperationType {
16399 fn from(value: &str) -> Self {
16400 use std::string::ToString;
16401 match value {
16402 "SESSION_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16403 "CREATE" => Self::Create,
16404 "TERMINATE" => Self::Terminate,
16405 "DELETE" => Self::Delete,
16406 _ => Self::UnknownValue(session_operation_type::UnknownValue(
16407 wkt::internal::UnknownEnumValue::String(value.to_string()),
16408 )),
16409 }
16410 }
16411 }
16412
16413 impl serde::ser::Serialize for SessionOperationType {
16414 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16415 where
16416 S: serde::Serializer,
16417 {
16418 match self {
16419 Self::Unspecified => serializer.serialize_i32(0),
16420 Self::Create => serializer.serialize_i32(1),
16421 Self::Terminate => serializer.serialize_i32(2),
16422 Self::Delete => serializer.serialize_i32(3),
16423 Self::UnknownValue(u) => u.0.serialize(serializer),
16424 }
16425 }
16426 }
16427
16428 impl<'de> serde::de::Deserialize<'de> for SessionOperationType {
16429 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16430 where
16431 D: serde::Deserializer<'de>,
16432 {
16433 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionOperationType>::new(
16434 ".google.cloud.dataproc.v1.SessionOperationMetadata.SessionOperationType",
16435 ))
16436 }
16437 }
16438}
16439
16440/// The status of the operation.
16441#[derive(Clone, Default, PartialEq)]
16442#[non_exhaustive]
16443pub struct ClusterOperationStatus {
16444 /// Output only. A message containing the operation state.
16445 pub state: crate::model::cluster_operation_status::State,
16446
16447 /// Output only. A message containing the detailed operation state.
16448 pub inner_state: std::string::String,
16449
16450 /// Output only. A message containing any operation metadata details.
16451 pub details: std::string::String,
16452
16453 /// Output only. The time this state was entered.
16454 pub state_start_time: std::option::Option<wkt::Timestamp>,
16455
16456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16457}
16458
16459impl ClusterOperationStatus {
16460 pub fn new() -> Self {
16461 std::default::Default::default()
16462 }
16463
16464 /// Sets the value of [state][crate::model::ClusterOperationStatus::state].
16465 ///
16466 /// # Example
16467 /// ```ignore,no_run
16468 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16469 /// use google_cloud_dataproc_v1::model::cluster_operation_status::State;
16470 /// let x0 = ClusterOperationStatus::new().set_state(State::Pending);
16471 /// let x1 = ClusterOperationStatus::new().set_state(State::Running);
16472 /// let x2 = ClusterOperationStatus::new().set_state(State::Done);
16473 /// ```
16474 pub fn set_state<T: std::convert::Into<crate::model::cluster_operation_status::State>>(
16475 mut self,
16476 v: T,
16477 ) -> Self {
16478 self.state = v.into();
16479 self
16480 }
16481
16482 /// Sets the value of [inner_state][crate::model::ClusterOperationStatus::inner_state].
16483 ///
16484 /// # Example
16485 /// ```ignore,no_run
16486 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16487 /// let x = ClusterOperationStatus::new().set_inner_state("example");
16488 /// ```
16489 pub fn set_inner_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16490 self.inner_state = v.into();
16491 self
16492 }
16493
16494 /// Sets the value of [details][crate::model::ClusterOperationStatus::details].
16495 ///
16496 /// # Example
16497 /// ```ignore,no_run
16498 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16499 /// let x = ClusterOperationStatus::new().set_details("example");
16500 /// ```
16501 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16502 self.details = v.into();
16503 self
16504 }
16505
16506 /// Sets the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
16507 ///
16508 /// # Example
16509 /// ```ignore,no_run
16510 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16511 /// use wkt::Timestamp;
16512 /// let x = ClusterOperationStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
16513 /// ```
16514 pub fn set_state_start_time<T>(mut self, v: T) -> Self
16515 where
16516 T: std::convert::Into<wkt::Timestamp>,
16517 {
16518 self.state_start_time = std::option::Option::Some(v.into());
16519 self
16520 }
16521
16522 /// Sets or clears the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
16523 ///
16524 /// # Example
16525 /// ```ignore,no_run
16526 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16527 /// use wkt::Timestamp;
16528 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
16529 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
16530 /// ```
16531 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
16532 where
16533 T: std::convert::Into<wkt::Timestamp>,
16534 {
16535 self.state_start_time = v.map(|x| x.into());
16536 self
16537 }
16538}
16539
16540impl wkt::message::Message for ClusterOperationStatus {
16541 fn typename() -> &'static str {
16542 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationStatus"
16543 }
16544}
16545
16546/// Defines additional types related to [ClusterOperationStatus].
16547pub mod cluster_operation_status {
16548 #[allow(unused_imports)]
16549 use super::*;
16550
16551 /// The operation state.
16552 ///
16553 /// # Working with unknown values
16554 ///
16555 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16556 /// additional enum variants at any time. Adding new variants is not considered
16557 /// a breaking change. Applications should write their code in anticipation of:
16558 ///
16559 /// - New values appearing in future releases of the client library, **and**
16560 /// - New values received dynamically, without application changes.
16561 ///
16562 /// Please consult the [Working with enums] section in the user guide for some
16563 /// guidelines.
16564 ///
16565 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16566 #[derive(Clone, Debug, PartialEq)]
16567 #[non_exhaustive]
16568 pub enum State {
16569 /// Unused.
16570 Unknown,
16571 /// The operation has been created.
16572 Pending,
16573 /// The operation is running.
16574 Running,
16575 /// The operation is done; either cancelled or completed.
16576 Done,
16577 /// If set, the enum was initialized with an unknown value.
16578 ///
16579 /// Applications can examine the value using [State::value] or
16580 /// [State::name].
16581 UnknownValue(state::UnknownValue),
16582 }
16583
16584 #[doc(hidden)]
16585 pub mod state {
16586 #[allow(unused_imports)]
16587 use super::*;
16588 #[derive(Clone, Debug, PartialEq)]
16589 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16590 }
16591
16592 impl State {
16593 /// Gets the enum value.
16594 ///
16595 /// Returns `None` if the enum contains an unknown value deserialized from
16596 /// the string representation of enums.
16597 pub fn value(&self) -> std::option::Option<i32> {
16598 match self {
16599 Self::Unknown => std::option::Option::Some(0),
16600 Self::Pending => std::option::Option::Some(1),
16601 Self::Running => std::option::Option::Some(2),
16602 Self::Done => std::option::Option::Some(3),
16603 Self::UnknownValue(u) => u.0.value(),
16604 }
16605 }
16606
16607 /// Gets the enum value as a string.
16608 ///
16609 /// Returns `None` if the enum contains an unknown value deserialized from
16610 /// the integer representation of enums.
16611 pub fn name(&self) -> std::option::Option<&str> {
16612 match self {
16613 Self::Unknown => std::option::Option::Some("UNKNOWN"),
16614 Self::Pending => std::option::Option::Some("PENDING"),
16615 Self::Running => std::option::Option::Some("RUNNING"),
16616 Self::Done => std::option::Option::Some("DONE"),
16617 Self::UnknownValue(u) => u.0.name(),
16618 }
16619 }
16620 }
16621
16622 impl std::default::Default for State {
16623 fn default() -> Self {
16624 use std::convert::From;
16625 Self::from(0)
16626 }
16627 }
16628
16629 impl std::fmt::Display for State {
16630 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16631 wkt::internal::display_enum(f, self.name(), self.value())
16632 }
16633 }
16634
16635 impl std::convert::From<i32> for State {
16636 fn from(value: i32) -> Self {
16637 match value {
16638 0 => Self::Unknown,
16639 1 => Self::Pending,
16640 2 => Self::Running,
16641 3 => Self::Done,
16642 _ => Self::UnknownValue(state::UnknownValue(
16643 wkt::internal::UnknownEnumValue::Integer(value),
16644 )),
16645 }
16646 }
16647 }
16648
16649 impl std::convert::From<&str> for State {
16650 fn from(value: &str) -> Self {
16651 use std::string::ToString;
16652 match value {
16653 "UNKNOWN" => Self::Unknown,
16654 "PENDING" => Self::Pending,
16655 "RUNNING" => Self::Running,
16656 "DONE" => Self::Done,
16657 _ => Self::UnknownValue(state::UnknownValue(
16658 wkt::internal::UnknownEnumValue::String(value.to_string()),
16659 )),
16660 }
16661 }
16662 }
16663
16664 impl serde::ser::Serialize for State {
16665 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16666 where
16667 S: serde::Serializer,
16668 {
16669 match self {
16670 Self::Unknown => serializer.serialize_i32(0),
16671 Self::Pending => serializer.serialize_i32(1),
16672 Self::Running => serializer.serialize_i32(2),
16673 Self::Done => serializer.serialize_i32(3),
16674 Self::UnknownValue(u) => u.0.serialize(serializer),
16675 }
16676 }
16677 }
16678
16679 impl<'de> serde::de::Deserialize<'de> for State {
16680 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16681 where
16682 D: serde::Deserializer<'de>,
16683 {
16684 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
16685 ".google.cloud.dataproc.v1.ClusterOperationStatus.State",
16686 ))
16687 }
16688 }
16689}
16690
16691/// Metadata describing the operation.
16692#[derive(Clone, Default, PartialEq)]
16693#[non_exhaustive]
16694pub struct ClusterOperationMetadata {
16695 /// Output only. Name of the cluster for the operation.
16696 pub cluster_name: std::string::String,
16697
16698 /// Output only. Cluster UUID for the operation.
16699 pub cluster_uuid: std::string::String,
16700
16701 /// Output only. Current operation status.
16702 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
16703
16704 /// Output only. The previous operation status.
16705 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
16706
16707 /// Output only. The operation type.
16708 pub operation_type: std::string::String,
16709
16710 /// Output only. Short description of operation.
16711 pub description: std::string::String,
16712
16713 /// Output only. Labels associated with the operation
16714 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16715
16716 /// Output only. Errors encountered during operation execution.
16717 pub warnings: std::vec::Vec<std::string::String>,
16718
16719 /// Output only. Child operation ids
16720 pub child_operation_ids: std::vec::Vec<std::string::String>,
16721
16722 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16723}
16724
16725impl ClusterOperationMetadata {
16726 pub fn new() -> Self {
16727 std::default::Default::default()
16728 }
16729
16730 /// Sets the value of [cluster_name][crate::model::ClusterOperationMetadata::cluster_name].
16731 ///
16732 /// # Example
16733 /// ```ignore,no_run
16734 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16735 /// let x = ClusterOperationMetadata::new().set_cluster_name("example");
16736 /// ```
16737 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16738 self.cluster_name = v.into();
16739 self
16740 }
16741
16742 /// Sets the value of [cluster_uuid][crate::model::ClusterOperationMetadata::cluster_uuid].
16743 ///
16744 /// # Example
16745 /// ```ignore,no_run
16746 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16747 /// let x = ClusterOperationMetadata::new().set_cluster_uuid("example");
16748 /// ```
16749 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16750 self.cluster_uuid = v.into();
16751 self
16752 }
16753
16754 /// Sets the value of [status][crate::model::ClusterOperationMetadata::status].
16755 ///
16756 /// # Example
16757 /// ```ignore,no_run
16758 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16759 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16760 /// let x = ClusterOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
16761 /// ```
16762 pub fn set_status<T>(mut self, v: T) -> Self
16763 where
16764 T: std::convert::Into<crate::model::ClusterOperationStatus>,
16765 {
16766 self.status = std::option::Option::Some(v.into());
16767 self
16768 }
16769
16770 /// Sets or clears the value of [status][crate::model::ClusterOperationMetadata::status].
16771 ///
16772 /// # Example
16773 /// ```ignore,no_run
16774 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16775 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16776 /// let x = ClusterOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
16777 /// let x = ClusterOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
16778 /// ```
16779 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
16780 where
16781 T: std::convert::Into<crate::model::ClusterOperationStatus>,
16782 {
16783 self.status = v.map(|x| x.into());
16784 self
16785 }
16786
16787 /// Sets the value of [status_history][crate::model::ClusterOperationMetadata::status_history].
16788 ///
16789 /// # Example
16790 /// ```ignore,no_run
16791 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16792 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16793 /// let x = ClusterOperationMetadata::new()
16794 /// .set_status_history([
16795 /// ClusterOperationStatus::default()/* use setters */,
16796 /// ClusterOperationStatus::default()/* use (different) setters */,
16797 /// ]);
16798 /// ```
16799 pub fn set_status_history<T, V>(mut self, v: T) -> Self
16800 where
16801 T: std::iter::IntoIterator<Item = V>,
16802 V: std::convert::Into<crate::model::ClusterOperationStatus>,
16803 {
16804 use std::iter::Iterator;
16805 self.status_history = v.into_iter().map(|i| i.into()).collect();
16806 self
16807 }
16808
16809 /// Sets the value of [operation_type][crate::model::ClusterOperationMetadata::operation_type].
16810 ///
16811 /// # Example
16812 /// ```ignore,no_run
16813 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16814 /// let x = ClusterOperationMetadata::new().set_operation_type("example");
16815 /// ```
16816 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16817 self.operation_type = v.into();
16818 self
16819 }
16820
16821 /// Sets the value of [description][crate::model::ClusterOperationMetadata::description].
16822 ///
16823 /// # Example
16824 /// ```ignore,no_run
16825 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16826 /// let x = ClusterOperationMetadata::new().set_description("example");
16827 /// ```
16828 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16829 self.description = v.into();
16830 self
16831 }
16832
16833 /// Sets the value of [labels][crate::model::ClusterOperationMetadata::labels].
16834 ///
16835 /// # Example
16836 /// ```ignore,no_run
16837 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16838 /// let x = ClusterOperationMetadata::new().set_labels([
16839 /// ("key0", "abc"),
16840 /// ("key1", "xyz"),
16841 /// ]);
16842 /// ```
16843 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16844 where
16845 T: std::iter::IntoIterator<Item = (K, V)>,
16846 K: std::convert::Into<std::string::String>,
16847 V: std::convert::Into<std::string::String>,
16848 {
16849 use std::iter::Iterator;
16850 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16851 self
16852 }
16853
16854 /// Sets the value of [warnings][crate::model::ClusterOperationMetadata::warnings].
16855 ///
16856 /// # Example
16857 /// ```ignore,no_run
16858 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16859 /// let x = ClusterOperationMetadata::new().set_warnings(["a", "b", "c"]);
16860 /// ```
16861 pub fn set_warnings<T, V>(mut self, v: T) -> Self
16862 where
16863 T: std::iter::IntoIterator<Item = V>,
16864 V: std::convert::Into<std::string::String>,
16865 {
16866 use std::iter::Iterator;
16867 self.warnings = v.into_iter().map(|i| i.into()).collect();
16868 self
16869 }
16870
16871 /// Sets the value of [child_operation_ids][crate::model::ClusterOperationMetadata::child_operation_ids].
16872 ///
16873 /// # Example
16874 /// ```ignore,no_run
16875 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16876 /// let x = ClusterOperationMetadata::new().set_child_operation_ids(["a", "b", "c"]);
16877 /// ```
16878 pub fn set_child_operation_ids<T, V>(mut self, v: T) -> Self
16879 where
16880 T: std::iter::IntoIterator<Item = V>,
16881 V: std::convert::Into<std::string::String>,
16882 {
16883 use std::iter::Iterator;
16884 self.child_operation_ids = v.into_iter().map(|i| i.into()).collect();
16885 self
16886 }
16887}
16888
16889impl wkt::message::Message for ClusterOperationMetadata {
16890 fn typename() -> &'static str {
16891 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationMetadata"
16892 }
16893}
16894
16895/// Metadata describing the node group operation.
16896#[derive(Clone, Default, PartialEq)]
16897#[non_exhaustive]
16898pub struct NodeGroupOperationMetadata {
16899 /// Output only. Node group ID for the operation.
16900 pub node_group_id: std::string::String,
16901
16902 /// Output only. Cluster UUID associated with the node group operation.
16903 pub cluster_uuid: std::string::String,
16904
16905 /// Output only. Current operation status.
16906 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
16907
16908 /// Output only. The previous operation status.
16909 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
16910
16911 /// The operation type.
16912 pub operation_type: crate::model::node_group_operation_metadata::NodeGroupOperationType,
16913
16914 /// Output only. Short description of operation.
16915 pub description: std::string::String,
16916
16917 /// Output only. Labels associated with the operation.
16918 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16919
16920 /// Output only. Errors encountered during operation execution.
16921 pub warnings: std::vec::Vec<std::string::String>,
16922
16923 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16924}
16925
16926impl NodeGroupOperationMetadata {
16927 pub fn new() -> Self {
16928 std::default::Default::default()
16929 }
16930
16931 /// Sets the value of [node_group_id][crate::model::NodeGroupOperationMetadata::node_group_id].
16932 ///
16933 /// # Example
16934 /// ```ignore,no_run
16935 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16936 /// let x = NodeGroupOperationMetadata::new().set_node_group_id("example");
16937 /// ```
16938 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16939 self.node_group_id = v.into();
16940 self
16941 }
16942
16943 /// Sets the value of [cluster_uuid][crate::model::NodeGroupOperationMetadata::cluster_uuid].
16944 ///
16945 /// # Example
16946 /// ```ignore,no_run
16947 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16948 /// let x = NodeGroupOperationMetadata::new().set_cluster_uuid("example");
16949 /// ```
16950 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16951 self.cluster_uuid = v.into();
16952 self
16953 }
16954
16955 /// Sets the value of [status][crate::model::NodeGroupOperationMetadata::status].
16956 ///
16957 /// # Example
16958 /// ```ignore,no_run
16959 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16960 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16961 /// let x = NodeGroupOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
16962 /// ```
16963 pub fn set_status<T>(mut self, v: T) -> Self
16964 where
16965 T: std::convert::Into<crate::model::ClusterOperationStatus>,
16966 {
16967 self.status = std::option::Option::Some(v.into());
16968 self
16969 }
16970
16971 /// Sets or clears the value of [status][crate::model::NodeGroupOperationMetadata::status].
16972 ///
16973 /// # Example
16974 /// ```ignore,no_run
16975 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16976 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16977 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
16978 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
16979 /// ```
16980 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
16981 where
16982 T: std::convert::Into<crate::model::ClusterOperationStatus>,
16983 {
16984 self.status = v.map(|x| x.into());
16985 self
16986 }
16987
16988 /// Sets the value of [status_history][crate::model::NodeGroupOperationMetadata::status_history].
16989 ///
16990 /// # Example
16991 /// ```ignore,no_run
16992 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16993 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16994 /// let x = NodeGroupOperationMetadata::new()
16995 /// .set_status_history([
16996 /// ClusterOperationStatus::default()/* use setters */,
16997 /// ClusterOperationStatus::default()/* use (different) setters */,
16998 /// ]);
16999 /// ```
17000 pub fn set_status_history<T, V>(mut self, v: T) -> Self
17001 where
17002 T: std::iter::IntoIterator<Item = V>,
17003 V: std::convert::Into<crate::model::ClusterOperationStatus>,
17004 {
17005 use std::iter::Iterator;
17006 self.status_history = v.into_iter().map(|i| i.into()).collect();
17007 self
17008 }
17009
17010 /// Sets the value of [operation_type][crate::model::NodeGroupOperationMetadata::operation_type].
17011 ///
17012 /// # Example
17013 /// ```ignore,no_run
17014 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17015 /// use google_cloud_dataproc_v1::model::node_group_operation_metadata::NodeGroupOperationType;
17016 /// let x0 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Create);
17017 /// let x1 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Update);
17018 /// let x2 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Delete);
17019 /// ```
17020 pub fn set_operation_type<
17021 T: std::convert::Into<crate::model::node_group_operation_metadata::NodeGroupOperationType>,
17022 >(
17023 mut self,
17024 v: T,
17025 ) -> Self {
17026 self.operation_type = v.into();
17027 self
17028 }
17029
17030 /// Sets the value of [description][crate::model::NodeGroupOperationMetadata::description].
17031 ///
17032 /// # Example
17033 /// ```ignore,no_run
17034 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17035 /// let x = NodeGroupOperationMetadata::new().set_description("example");
17036 /// ```
17037 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17038 self.description = v.into();
17039 self
17040 }
17041
17042 /// Sets the value of [labels][crate::model::NodeGroupOperationMetadata::labels].
17043 ///
17044 /// # Example
17045 /// ```ignore,no_run
17046 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17047 /// let x = NodeGroupOperationMetadata::new().set_labels([
17048 /// ("key0", "abc"),
17049 /// ("key1", "xyz"),
17050 /// ]);
17051 /// ```
17052 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17053 where
17054 T: std::iter::IntoIterator<Item = (K, V)>,
17055 K: std::convert::Into<std::string::String>,
17056 V: std::convert::Into<std::string::String>,
17057 {
17058 use std::iter::Iterator;
17059 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17060 self
17061 }
17062
17063 /// Sets the value of [warnings][crate::model::NodeGroupOperationMetadata::warnings].
17064 ///
17065 /// # Example
17066 /// ```ignore,no_run
17067 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17068 /// let x = NodeGroupOperationMetadata::new().set_warnings(["a", "b", "c"]);
17069 /// ```
17070 pub fn set_warnings<T, V>(mut self, v: T) -> Self
17071 where
17072 T: std::iter::IntoIterator<Item = V>,
17073 V: std::convert::Into<std::string::String>,
17074 {
17075 use std::iter::Iterator;
17076 self.warnings = v.into_iter().map(|i| i.into()).collect();
17077 self
17078 }
17079}
17080
17081impl wkt::message::Message for NodeGroupOperationMetadata {
17082 fn typename() -> &'static str {
17083 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupOperationMetadata"
17084 }
17085}
17086
17087/// Defines additional types related to [NodeGroupOperationMetadata].
17088pub mod node_group_operation_metadata {
17089 #[allow(unused_imports)]
17090 use super::*;
17091
17092 /// Operation type for node group resources.
17093 ///
17094 /// # Working with unknown values
17095 ///
17096 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17097 /// additional enum variants at any time. Adding new variants is not considered
17098 /// a breaking change. Applications should write their code in anticipation of:
17099 ///
17100 /// - New values appearing in future releases of the client library, **and**
17101 /// - New values received dynamically, without application changes.
17102 ///
17103 /// Please consult the [Working with enums] section in the user guide for some
17104 /// guidelines.
17105 ///
17106 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17107 #[derive(Clone, Debug, PartialEq)]
17108 #[non_exhaustive]
17109 pub enum NodeGroupOperationType {
17110 /// Node group operation type is unknown.
17111 Unspecified,
17112 /// Create node group operation type.
17113 Create,
17114 /// Update node group operation type.
17115 Update,
17116 /// Delete node group operation type.
17117 Delete,
17118 /// Resize node group operation type.
17119 Resize,
17120 /// If set, the enum was initialized with an unknown value.
17121 ///
17122 /// Applications can examine the value using [NodeGroupOperationType::value] or
17123 /// [NodeGroupOperationType::name].
17124 UnknownValue(node_group_operation_type::UnknownValue),
17125 }
17126
17127 #[doc(hidden)]
17128 pub mod node_group_operation_type {
17129 #[allow(unused_imports)]
17130 use super::*;
17131 #[derive(Clone, Debug, PartialEq)]
17132 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17133 }
17134
17135 impl NodeGroupOperationType {
17136 /// Gets the enum value.
17137 ///
17138 /// Returns `None` if the enum contains an unknown value deserialized from
17139 /// the string representation of enums.
17140 pub fn value(&self) -> std::option::Option<i32> {
17141 match self {
17142 Self::Unspecified => std::option::Option::Some(0),
17143 Self::Create => std::option::Option::Some(1),
17144 Self::Update => std::option::Option::Some(2),
17145 Self::Delete => std::option::Option::Some(3),
17146 Self::Resize => std::option::Option::Some(4),
17147 Self::UnknownValue(u) => u.0.value(),
17148 }
17149 }
17150
17151 /// Gets the enum value as a string.
17152 ///
17153 /// Returns `None` if the enum contains an unknown value deserialized from
17154 /// the integer representation of enums.
17155 pub fn name(&self) -> std::option::Option<&str> {
17156 match self {
17157 Self::Unspecified => {
17158 std::option::Option::Some("NODE_GROUP_OPERATION_TYPE_UNSPECIFIED")
17159 }
17160 Self::Create => std::option::Option::Some("CREATE"),
17161 Self::Update => std::option::Option::Some("UPDATE"),
17162 Self::Delete => std::option::Option::Some("DELETE"),
17163 Self::Resize => std::option::Option::Some("RESIZE"),
17164 Self::UnknownValue(u) => u.0.name(),
17165 }
17166 }
17167 }
17168
17169 impl std::default::Default for NodeGroupOperationType {
17170 fn default() -> Self {
17171 use std::convert::From;
17172 Self::from(0)
17173 }
17174 }
17175
17176 impl std::fmt::Display for NodeGroupOperationType {
17177 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17178 wkt::internal::display_enum(f, self.name(), self.value())
17179 }
17180 }
17181
17182 impl std::convert::From<i32> for NodeGroupOperationType {
17183 fn from(value: i32) -> Self {
17184 match value {
17185 0 => Self::Unspecified,
17186 1 => Self::Create,
17187 2 => Self::Update,
17188 3 => Self::Delete,
17189 4 => Self::Resize,
17190 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17191 wkt::internal::UnknownEnumValue::Integer(value),
17192 )),
17193 }
17194 }
17195 }
17196
17197 impl std::convert::From<&str> for NodeGroupOperationType {
17198 fn from(value: &str) -> Self {
17199 use std::string::ToString;
17200 match value {
17201 "NODE_GROUP_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17202 "CREATE" => Self::Create,
17203 "UPDATE" => Self::Update,
17204 "DELETE" => Self::Delete,
17205 "RESIZE" => Self::Resize,
17206 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17207 wkt::internal::UnknownEnumValue::String(value.to_string()),
17208 )),
17209 }
17210 }
17211 }
17212
17213 impl serde::ser::Serialize for NodeGroupOperationType {
17214 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17215 where
17216 S: serde::Serializer,
17217 {
17218 match self {
17219 Self::Unspecified => serializer.serialize_i32(0),
17220 Self::Create => serializer.serialize_i32(1),
17221 Self::Update => serializer.serialize_i32(2),
17222 Self::Delete => serializer.serialize_i32(3),
17223 Self::Resize => serializer.serialize_i32(4),
17224 Self::UnknownValue(u) => u.0.serialize(serializer),
17225 }
17226 }
17227 }
17228
17229 impl<'de> serde::de::Deserialize<'de> for NodeGroupOperationType {
17230 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17231 where
17232 D: serde::Deserializer<'de>,
17233 {
17234 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeGroupOperationType>::new(
17235 ".google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType",
17236 ))
17237 }
17238 }
17239}
17240
17241/// A request to create a session template.
17242#[derive(Clone, Default, PartialEq)]
17243#[non_exhaustive]
17244pub struct CreateSessionTemplateRequest {
17245 /// Required. The parent resource where this session template will be created.
17246 pub parent: std::string::String,
17247
17248 /// Required. The session template to create.
17249 pub session_template: std::option::Option<crate::model::SessionTemplate>,
17250
17251 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17252}
17253
17254impl CreateSessionTemplateRequest {
17255 pub fn new() -> Self {
17256 std::default::Default::default()
17257 }
17258
17259 /// Sets the value of [parent][crate::model::CreateSessionTemplateRequest::parent].
17260 ///
17261 /// # Example
17262 /// ```ignore,no_run
17263 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17264 /// let x = CreateSessionTemplateRequest::new().set_parent("example");
17265 /// ```
17266 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17267 self.parent = v.into();
17268 self
17269 }
17270
17271 /// Sets the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
17272 ///
17273 /// # Example
17274 /// ```ignore,no_run
17275 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17276 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17277 /// let x = CreateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
17278 /// ```
17279 pub fn set_session_template<T>(mut self, v: T) -> Self
17280 where
17281 T: std::convert::Into<crate::model::SessionTemplate>,
17282 {
17283 self.session_template = std::option::Option::Some(v.into());
17284 self
17285 }
17286
17287 /// Sets or clears the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
17288 ///
17289 /// # Example
17290 /// ```ignore,no_run
17291 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17292 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17293 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
17294 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
17295 /// ```
17296 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
17297 where
17298 T: std::convert::Into<crate::model::SessionTemplate>,
17299 {
17300 self.session_template = v.map(|x| x.into());
17301 self
17302 }
17303}
17304
17305impl wkt::message::Message for CreateSessionTemplateRequest {
17306 fn typename() -> &'static str {
17307 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionTemplateRequest"
17308 }
17309}
17310
17311/// A request to update a session template.
17312#[derive(Clone, Default, PartialEq)]
17313#[non_exhaustive]
17314pub struct UpdateSessionTemplateRequest {
17315 /// Required. The updated session template.
17316 pub session_template: std::option::Option<crate::model::SessionTemplate>,
17317
17318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17319}
17320
17321impl UpdateSessionTemplateRequest {
17322 pub fn new() -> Self {
17323 std::default::Default::default()
17324 }
17325
17326 /// Sets the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
17327 ///
17328 /// # Example
17329 /// ```ignore,no_run
17330 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
17331 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17332 /// let x = UpdateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
17333 /// ```
17334 pub fn set_session_template<T>(mut self, v: T) -> Self
17335 where
17336 T: std::convert::Into<crate::model::SessionTemplate>,
17337 {
17338 self.session_template = std::option::Option::Some(v.into());
17339 self
17340 }
17341
17342 /// Sets or clears the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
17343 ///
17344 /// # Example
17345 /// ```ignore,no_run
17346 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
17347 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17348 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
17349 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
17350 /// ```
17351 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
17352 where
17353 T: std::convert::Into<crate::model::SessionTemplate>,
17354 {
17355 self.session_template = v.map(|x| x.into());
17356 self
17357 }
17358}
17359
17360impl wkt::message::Message for UpdateSessionTemplateRequest {
17361 fn typename() -> &'static str {
17362 "type.googleapis.com/google.cloud.dataproc.v1.UpdateSessionTemplateRequest"
17363 }
17364}
17365
17366/// A request to get the resource representation for a session template.
17367#[derive(Clone, Default, PartialEq)]
17368#[non_exhaustive]
17369pub struct GetSessionTemplateRequest {
17370 /// Required. The name of the session template to retrieve.
17371 pub name: std::string::String,
17372
17373 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17374}
17375
17376impl GetSessionTemplateRequest {
17377 pub fn new() -> Self {
17378 std::default::Default::default()
17379 }
17380
17381 /// Sets the value of [name][crate::model::GetSessionTemplateRequest::name].
17382 ///
17383 /// # Example
17384 /// ```ignore,no_run
17385 /// # use google_cloud_dataproc_v1::model::GetSessionTemplateRequest;
17386 /// let x = GetSessionTemplateRequest::new().set_name("example");
17387 /// ```
17388 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17389 self.name = v.into();
17390 self
17391 }
17392}
17393
17394impl wkt::message::Message for GetSessionTemplateRequest {
17395 fn typename() -> &'static str {
17396 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionTemplateRequest"
17397 }
17398}
17399
17400/// A request to list session templates in a project.
17401#[derive(Clone, Default, PartialEq)]
17402#[non_exhaustive]
17403pub struct ListSessionTemplatesRequest {
17404 /// Required. The parent that owns this collection of session templates.
17405 pub parent: std::string::String,
17406
17407 /// Optional. The maximum number of sessions to return in each response.
17408 /// The service may return fewer than this value.
17409 pub page_size: i32,
17410
17411 /// Optional. A page token received from a previous `ListSessions` call.
17412 /// Provide this token to retrieve the subsequent page.
17413 pub page_token: std::string::String,
17414
17415 /// Optional. A filter for the session templates to return in the response.
17416 /// Filters are case sensitive and have the following syntax:
17417 ///
17418 /// [field = value] AND [field [= value]] ...
17419 pub filter: std::string::String,
17420
17421 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17422}
17423
17424impl ListSessionTemplatesRequest {
17425 pub fn new() -> Self {
17426 std::default::Default::default()
17427 }
17428
17429 /// Sets the value of [parent][crate::model::ListSessionTemplatesRequest::parent].
17430 ///
17431 /// # Example
17432 /// ```ignore,no_run
17433 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17434 /// let x = ListSessionTemplatesRequest::new().set_parent("example");
17435 /// ```
17436 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17437 self.parent = v.into();
17438 self
17439 }
17440
17441 /// Sets the value of [page_size][crate::model::ListSessionTemplatesRequest::page_size].
17442 ///
17443 /// # Example
17444 /// ```ignore,no_run
17445 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17446 /// let x = ListSessionTemplatesRequest::new().set_page_size(42);
17447 /// ```
17448 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17449 self.page_size = v.into();
17450 self
17451 }
17452
17453 /// Sets the value of [page_token][crate::model::ListSessionTemplatesRequest::page_token].
17454 ///
17455 /// # Example
17456 /// ```ignore,no_run
17457 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17458 /// let x = ListSessionTemplatesRequest::new().set_page_token("example");
17459 /// ```
17460 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17461 self.page_token = v.into();
17462 self
17463 }
17464
17465 /// Sets the value of [filter][crate::model::ListSessionTemplatesRequest::filter].
17466 ///
17467 /// # Example
17468 /// ```ignore,no_run
17469 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17470 /// let x = ListSessionTemplatesRequest::new().set_filter("example");
17471 /// ```
17472 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17473 self.filter = v.into();
17474 self
17475 }
17476}
17477
17478impl wkt::message::Message for ListSessionTemplatesRequest {
17479 fn typename() -> &'static str {
17480 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesRequest"
17481 }
17482}
17483
17484/// A list of session templates.
17485#[derive(Clone, Default, PartialEq)]
17486#[non_exhaustive]
17487pub struct ListSessionTemplatesResponse {
17488 /// Output only. Session template list
17489 pub session_templates: std::vec::Vec<crate::model::SessionTemplate>,
17490
17491 /// A token, which can be sent as `page_token` to retrieve the next page.
17492 /// If this field is omitted, there are no subsequent pages.
17493 pub next_page_token: std::string::String,
17494
17495 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17496}
17497
17498impl ListSessionTemplatesResponse {
17499 pub fn new() -> Self {
17500 std::default::Default::default()
17501 }
17502
17503 /// Sets the value of [session_templates][crate::model::ListSessionTemplatesResponse::session_templates].
17504 ///
17505 /// # Example
17506 /// ```ignore,no_run
17507 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
17508 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17509 /// let x = ListSessionTemplatesResponse::new()
17510 /// .set_session_templates([
17511 /// SessionTemplate::default()/* use setters */,
17512 /// SessionTemplate::default()/* use (different) setters */,
17513 /// ]);
17514 /// ```
17515 pub fn set_session_templates<T, V>(mut self, v: T) -> Self
17516 where
17517 T: std::iter::IntoIterator<Item = V>,
17518 V: std::convert::Into<crate::model::SessionTemplate>,
17519 {
17520 use std::iter::Iterator;
17521 self.session_templates = v.into_iter().map(|i| i.into()).collect();
17522 self
17523 }
17524
17525 /// Sets the value of [next_page_token][crate::model::ListSessionTemplatesResponse::next_page_token].
17526 ///
17527 /// # Example
17528 /// ```ignore,no_run
17529 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
17530 /// let x = ListSessionTemplatesResponse::new().set_next_page_token("example");
17531 /// ```
17532 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17533 self.next_page_token = v.into();
17534 self
17535 }
17536}
17537
17538impl wkt::message::Message for ListSessionTemplatesResponse {
17539 fn typename() -> &'static str {
17540 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesResponse"
17541 }
17542}
17543
17544#[doc(hidden)]
17545impl gax::paginator::internal::PageableResponse for ListSessionTemplatesResponse {
17546 type PageItem = crate::model::SessionTemplate;
17547
17548 fn items(self) -> std::vec::Vec<Self::PageItem> {
17549 self.session_templates
17550 }
17551
17552 fn next_page_token(&self) -> std::string::String {
17553 use std::clone::Clone;
17554 self.next_page_token.clone()
17555 }
17556}
17557
17558/// A request to delete a session template.
17559#[derive(Clone, Default, PartialEq)]
17560#[non_exhaustive]
17561pub struct DeleteSessionTemplateRequest {
17562 /// Required. The name of the session template resource to delete.
17563 pub name: std::string::String,
17564
17565 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17566}
17567
17568impl DeleteSessionTemplateRequest {
17569 pub fn new() -> Self {
17570 std::default::Default::default()
17571 }
17572
17573 /// Sets the value of [name][crate::model::DeleteSessionTemplateRequest::name].
17574 ///
17575 /// # Example
17576 /// ```ignore,no_run
17577 /// # use google_cloud_dataproc_v1::model::DeleteSessionTemplateRequest;
17578 /// let x = DeleteSessionTemplateRequest::new().set_name("example");
17579 /// ```
17580 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17581 self.name = v.into();
17582 self
17583 }
17584}
17585
17586impl wkt::message::Message for DeleteSessionTemplateRequest {
17587 fn typename() -> &'static str {
17588 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionTemplateRequest"
17589 }
17590}
17591
17592/// A representation of a session template.
17593#[derive(Clone, Default, PartialEq)]
17594#[non_exhaustive]
17595pub struct SessionTemplate {
17596 /// Required. The resource name of the session template.
17597 pub name: std::string::String,
17598
17599 /// Optional. Brief description of the template.
17600 pub description: std::string::String,
17601
17602 /// Output only. The time when the template was created.
17603 pub create_time: std::option::Option<wkt::Timestamp>,
17604
17605 /// Output only. The email address of the user who created the template.
17606 pub creator: std::string::String,
17607
17608 /// Optional. Labels to associate with sessions created using this template.
17609 /// Label **keys** must contain 1 to 63 characters, and must conform to
17610 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
17611 /// Label **values** can be empty, but, if present, must contain 1 to 63
17612 /// characters and conform to [RFC
17613 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
17614 /// associated with a session.
17615 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17616
17617 /// Optional. Runtime configuration for session execution.
17618 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
17619
17620 /// Optional. Environment configuration for session execution.
17621 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
17622
17623 /// Output only. The time the template was last updated.
17624 pub update_time: std::option::Option<wkt::Timestamp>,
17625
17626 /// Output only. A session template UUID (Unique Universal Identifier). The
17627 /// service generates this value when it creates the session template.
17628 pub uuid: std::string::String,
17629
17630 /// The session configuration.
17631 pub session_config: std::option::Option<crate::model::session_template::SessionConfig>,
17632
17633 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17634}
17635
17636impl SessionTemplate {
17637 pub fn new() -> Self {
17638 std::default::Default::default()
17639 }
17640
17641 /// Sets the value of [name][crate::model::SessionTemplate::name].
17642 ///
17643 /// # Example
17644 /// ```ignore,no_run
17645 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17646 /// let x = SessionTemplate::new().set_name("example");
17647 /// ```
17648 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17649 self.name = v.into();
17650 self
17651 }
17652
17653 /// Sets the value of [description][crate::model::SessionTemplate::description].
17654 ///
17655 /// # Example
17656 /// ```ignore,no_run
17657 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17658 /// let x = SessionTemplate::new().set_description("example");
17659 /// ```
17660 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17661 self.description = v.into();
17662 self
17663 }
17664
17665 /// Sets the value of [create_time][crate::model::SessionTemplate::create_time].
17666 ///
17667 /// # Example
17668 /// ```ignore,no_run
17669 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17670 /// use wkt::Timestamp;
17671 /// let x = SessionTemplate::new().set_create_time(Timestamp::default()/* use setters */);
17672 /// ```
17673 pub fn set_create_time<T>(mut self, v: T) -> Self
17674 where
17675 T: std::convert::Into<wkt::Timestamp>,
17676 {
17677 self.create_time = std::option::Option::Some(v.into());
17678 self
17679 }
17680
17681 /// Sets or clears the value of [create_time][crate::model::SessionTemplate::create_time].
17682 ///
17683 /// # Example
17684 /// ```ignore,no_run
17685 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17686 /// use wkt::Timestamp;
17687 /// let x = SessionTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17688 /// let x = SessionTemplate::new().set_or_clear_create_time(None::<Timestamp>);
17689 /// ```
17690 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17691 where
17692 T: std::convert::Into<wkt::Timestamp>,
17693 {
17694 self.create_time = v.map(|x| x.into());
17695 self
17696 }
17697
17698 /// Sets the value of [creator][crate::model::SessionTemplate::creator].
17699 ///
17700 /// # Example
17701 /// ```ignore,no_run
17702 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17703 /// let x = SessionTemplate::new().set_creator("example");
17704 /// ```
17705 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17706 self.creator = v.into();
17707 self
17708 }
17709
17710 /// Sets the value of [labels][crate::model::SessionTemplate::labels].
17711 ///
17712 /// # Example
17713 /// ```ignore,no_run
17714 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17715 /// let x = SessionTemplate::new().set_labels([
17716 /// ("key0", "abc"),
17717 /// ("key1", "xyz"),
17718 /// ]);
17719 /// ```
17720 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17721 where
17722 T: std::iter::IntoIterator<Item = (K, V)>,
17723 K: std::convert::Into<std::string::String>,
17724 V: std::convert::Into<std::string::String>,
17725 {
17726 use std::iter::Iterator;
17727 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17728 self
17729 }
17730
17731 /// Sets the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
17732 ///
17733 /// # Example
17734 /// ```ignore,no_run
17735 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17736 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
17737 /// let x = SessionTemplate::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
17738 /// ```
17739 pub fn set_runtime_config<T>(mut self, v: T) -> Self
17740 where
17741 T: std::convert::Into<crate::model::RuntimeConfig>,
17742 {
17743 self.runtime_config = std::option::Option::Some(v.into());
17744 self
17745 }
17746
17747 /// Sets or clears the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
17748 ///
17749 /// # Example
17750 /// ```ignore,no_run
17751 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17752 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
17753 /// let x = SessionTemplate::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
17754 /// let x = SessionTemplate::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
17755 /// ```
17756 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
17757 where
17758 T: std::convert::Into<crate::model::RuntimeConfig>,
17759 {
17760 self.runtime_config = v.map(|x| x.into());
17761 self
17762 }
17763
17764 /// Sets the value of [environment_config][crate::model::SessionTemplate::environment_config].
17765 ///
17766 /// # Example
17767 /// ```ignore,no_run
17768 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17769 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
17770 /// let x = SessionTemplate::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
17771 /// ```
17772 pub fn set_environment_config<T>(mut self, v: T) -> Self
17773 where
17774 T: std::convert::Into<crate::model::EnvironmentConfig>,
17775 {
17776 self.environment_config = std::option::Option::Some(v.into());
17777 self
17778 }
17779
17780 /// Sets or clears the value of [environment_config][crate::model::SessionTemplate::environment_config].
17781 ///
17782 /// # Example
17783 /// ```ignore,no_run
17784 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17785 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
17786 /// let x = SessionTemplate::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
17787 /// let x = SessionTemplate::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
17788 /// ```
17789 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
17790 where
17791 T: std::convert::Into<crate::model::EnvironmentConfig>,
17792 {
17793 self.environment_config = v.map(|x| x.into());
17794 self
17795 }
17796
17797 /// Sets the value of [update_time][crate::model::SessionTemplate::update_time].
17798 ///
17799 /// # Example
17800 /// ```ignore,no_run
17801 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17802 /// use wkt::Timestamp;
17803 /// let x = SessionTemplate::new().set_update_time(Timestamp::default()/* use setters */);
17804 /// ```
17805 pub fn set_update_time<T>(mut self, v: T) -> Self
17806 where
17807 T: std::convert::Into<wkt::Timestamp>,
17808 {
17809 self.update_time = std::option::Option::Some(v.into());
17810 self
17811 }
17812
17813 /// Sets or clears the value of [update_time][crate::model::SessionTemplate::update_time].
17814 ///
17815 /// # Example
17816 /// ```ignore,no_run
17817 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17818 /// use wkt::Timestamp;
17819 /// let x = SessionTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
17820 /// let x = SessionTemplate::new().set_or_clear_update_time(None::<Timestamp>);
17821 /// ```
17822 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17823 where
17824 T: std::convert::Into<wkt::Timestamp>,
17825 {
17826 self.update_time = v.map(|x| x.into());
17827 self
17828 }
17829
17830 /// Sets the value of [uuid][crate::model::SessionTemplate::uuid].
17831 ///
17832 /// # Example
17833 /// ```ignore,no_run
17834 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17835 /// let x = SessionTemplate::new().set_uuid("example");
17836 /// ```
17837 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17838 self.uuid = v.into();
17839 self
17840 }
17841
17842 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config].
17843 ///
17844 /// Note that all the setters affecting `session_config` are mutually
17845 /// exclusive.
17846 ///
17847 /// # Example
17848 /// ```ignore,no_run
17849 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17850 /// use google_cloud_dataproc_v1::model::JupyterConfig;
17851 /// let x = SessionTemplate::new().set_session_config(Some(
17852 /// google_cloud_dataproc_v1::model::session_template::SessionConfig::JupyterSession(JupyterConfig::default().into())));
17853 /// ```
17854 pub fn set_session_config<
17855 T: std::convert::Into<std::option::Option<crate::model::session_template::SessionConfig>>,
17856 >(
17857 mut self,
17858 v: T,
17859 ) -> Self {
17860 self.session_config = v.into();
17861 self
17862 }
17863
17864 /// The value of [session_config][crate::model::SessionTemplate::session_config]
17865 /// if it holds a `JupyterSession`, `None` if the field is not set or
17866 /// holds a different branch.
17867 pub fn jupyter_session(
17868 &self,
17869 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
17870 #[allow(unreachable_patterns)]
17871 self.session_config.as_ref().and_then(|v| match v {
17872 crate::model::session_template::SessionConfig::JupyterSession(v) => {
17873 std::option::Option::Some(v)
17874 }
17875 _ => std::option::Option::None,
17876 })
17877 }
17878
17879 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
17880 /// to hold a `JupyterSession`.
17881 ///
17882 /// Note that all the setters affecting `session_config` are
17883 /// mutually exclusive.
17884 ///
17885 /// # Example
17886 /// ```ignore,no_run
17887 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17888 /// use google_cloud_dataproc_v1::model::JupyterConfig;
17889 /// let x = SessionTemplate::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
17890 /// assert!(x.jupyter_session().is_some());
17891 /// assert!(x.spark_connect_session().is_none());
17892 /// ```
17893 pub fn set_jupyter_session<
17894 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
17895 >(
17896 mut self,
17897 v: T,
17898 ) -> Self {
17899 self.session_config = std::option::Option::Some(
17900 crate::model::session_template::SessionConfig::JupyterSession(v.into()),
17901 );
17902 self
17903 }
17904
17905 /// The value of [session_config][crate::model::SessionTemplate::session_config]
17906 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
17907 /// holds a different branch.
17908 pub fn spark_connect_session(
17909 &self,
17910 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
17911 #[allow(unreachable_patterns)]
17912 self.session_config.as_ref().and_then(|v| match v {
17913 crate::model::session_template::SessionConfig::SparkConnectSession(v) => {
17914 std::option::Option::Some(v)
17915 }
17916 _ => std::option::Option::None,
17917 })
17918 }
17919
17920 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
17921 /// to hold a `SparkConnectSession`.
17922 ///
17923 /// Note that all the setters affecting `session_config` are
17924 /// mutually exclusive.
17925 ///
17926 /// # Example
17927 /// ```ignore,no_run
17928 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17929 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
17930 /// let x = SessionTemplate::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
17931 /// assert!(x.spark_connect_session().is_some());
17932 /// assert!(x.jupyter_session().is_none());
17933 /// ```
17934 pub fn set_spark_connect_session<
17935 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
17936 >(
17937 mut self,
17938 v: T,
17939 ) -> Self {
17940 self.session_config = std::option::Option::Some(
17941 crate::model::session_template::SessionConfig::SparkConnectSession(v.into()),
17942 );
17943 self
17944 }
17945}
17946
17947impl wkt::message::Message for SessionTemplate {
17948 fn typename() -> &'static str {
17949 "type.googleapis.com/google.cloud.dataproc.v1.SessionTemplate"
17950 }
17951}
17952
17953/// Defines additional types related to [SessionTemplate].
17954pub mod session_template {
17955 #[allow(unused_imports)]
17956 use super::*;
17957
17958 /// The session configuration.
17959 #[derive(Clone, Debug, PartialEq)]
17960 #[non_exhaustive]
17961 pub enum SessionConfig {
17962 /// Optional. Jupyter session config.
17963 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
17964 /// Optional. Spark Connect session config.
17965 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
17966 }
17967}
17968
17969/// A request to create a session.
17970#[derive(Clone, Default, PartialEq)]
17971#[non_exhaustive]
17972pub struct CreateSessionRequest {
17973 /// Required. The parent resource where this session will be created.
17974 pub parent: std::string::String,
17975
17976 /// Required. The interactive session to create.
17977 pub session: std::option::Option<crate::model::Session>,
17978
17979 /// Required. The ID to use for the session, which becomes the final component
17980 /// of the session's resource name.
17981 ///
17982 /// This value must be 4-63 characters. Valid characters
17983 /// are /[a-z][0-9]-/.
17984 pub session_id: std::string::String,
17985
17986 /// Optional. A unique ID used to identify the request. If the service
17987 /// receives two
17988 /// [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
17989 /// with the same ID, the second request is ignored, and the
17990 /// first [Session][google.cloud.dataproc.v1.Session] is created and stored in
17991 /// the backend.
17992 ///
17993 /// Recommendation: Set this value to a
17994 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
17995 ///
17996 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
17997 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
17998 ///
17999 /// [google.cloud.dataproc.v1.Session]: crate::model::Session
18000 pub request_id: std::string::String,
18001
18002 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18003}
18004
18005impl CreateSessionRequest {
18006 pub fn new() -> Self {
18007 std::default::Default::default()
18008 }
18009
18010 /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
18011 ///
18012 /// # Example
18013 /// ```ignore,no_run
18014 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18015 /// let x = CreateSessionRequest::new().set_parent("example");
18016 /// ```
18017 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18018 self.parent = v.into();
18019 self
18020 }
18021
18022 /// Sets the value of [session][crate::model::CreateSessionRequest::session].
18023 ///
18024 /// # Example
18025 /// ```ignore,no_run
18026 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18027 /// use google_cloud_dataproc_v1::model::Session;
18028 /// let x = CreateSessionRequest::new().set_session(Session::default()/* use setters */);
18029 /// ```
18030 pub fn set_session<T>(mut self, v: T) -> Self
18031 where
18032 T: std::convert::Into<crate::model::Session>,
18033 {
18034 self.session = std::option::Option::Some(v.into());
18035 self
18036 }
18037
18038 /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
18039 ///
18040 /// # Example
18041 /// ```ignore,no_run
18042 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18043 /// use google_cloud_dataproc_v1::model::Session;
18044 /// let x = CreateSessionRequest::new().set_or_clear_session(Some(Session::default()/* use setters */));
18045 /// let x = CreateSessionRequest::new().set_or_clear_session(None::<Session>);
18046 /// ```
18047 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
18048 where
18049 T: std::convert::Into<crate::model::Session>,
18050 {
18051 self.session = v.map(|x| x.into());
18052 self
18053 }
18054
18055 /// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
18056 ///
18057 /// # Example
18058 /// ```ignore,no_run
18059 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18060 /// let x = CreateSessionRequest::new().set_session_id("example");
18061 /// ```
18062 pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18063 self.session_id = v.into();
18064 self
18065 }
18066
18067 /// Sets the value of [request_id][crate::model::CreateSessionRequest::request_id].
18068 ///
18069 /// # Example
18070 /// ```ignore,no_run
18071 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18072 /// let x = CreateSessionRequest::new().set_request_id("example");
18073 /// ```
18074 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18075 self.request_id = v.into();
18076 self
18077 }
18078}
18079
18080impl wkt::message::Message for CreateSessionRequest {
18081 fn typename() -> &'static str {
18082 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionRequest"
18083 }
18084}
18085
18086/// A request to get the resource representation for a session.
18087#[derive(Clone, Default, PartialEq)]
18088#[non_exhaustive]
18089pub struct GetSessionRequest {
18090 /// Required. The name of the session to retrieve.
18091 pub name: std::string::String,
18092
18093 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18094}
18095
18096impl GetSessionRequest {
18097 pub fn new() -> Self {
18098 std::default::Default::default()
18099 }
18100
18101 /// Sets the value of [name][crate::model::GetSessionRequest::name].
18102 ///
18103 /// # Example
18104 /// ```ignore,no_run
18105 /// # use google_cloud_dataproc_v1::model::GetSessionRequest;
18106 /// let x = GetSessionRequest::new().set_name("example");
18107 /// ```
18108 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18109 self.name = v.into();
18110 self
18111 }
18112}
18113
18114impl wkt::message::Message for GetSessionRequest {
18115 fn typename() -> &'static str {
18116 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionRequest"
18117 }
18118}
18119
18120/// A request to list sessions in a project.
18121#[derive(Clone, Default, PartialEq)]
18122#[non_exhaustive]
18123pub struct ListSessionsRequest {
18124 /// Required. The parent, which owns this collection of sessions.
18125 pub parent: std::string::String,
18126
18127 /// Optional. The maximum number of sessions to return in each response.
18128 /// The service may return fewer than this value.
18129 pub page_size: i32,
18130
18131 /// Optional. A page token received from a previous `ListSessions` call.
18132 /// Provide this token to retrieve the subsequent page.
18133 pub page_token: std::string::String,
18134
18135 /// Optional. A filter for the sessions to return in the response.
18136 ///
18137 /// A filter is a logical expression constraining the values of various fields
18138 /// in each session resource. Filters are case sensitive, and may contain
18139 /// multiple clauses combined with logical operators (AND, OR).
18140 /// Supported fields are `session_id`, `session_uuid`, `state`, `create_time`,
18141 /// and `labels`.
18142 ///
18143 /// Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
18144 /// is a filter for sessions in an ACTIVE state that were created before
18145 /// 2023-01-01. `state = ACTIVE and labels.environment=production` is a filter
18146 /// for sessions in an ACTIVE state that have a production environment label.
18147 ///
18148 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
18149 /// description of the filter syntax and a list of supported comparators.
18150 pub filter: std::string::String,
18151
18152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18153}
18154
18155impl ListSessionsRequest {
18156 pub fn new() -> Self {
18157 std::default::Default::default()
18158 }
18159
18160 /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
18161 ///
18162 /// # Example
18163 /// ```ignore,no_run
18164 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18165 /// let x = ListSessionsRequest::new().set_parent("example");
18166 /// ```
18167 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18168 self.parent = v.into();
18169 self
18170 }
18171
18172 /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
18173 ///
18174 /// # Example
18175 /// ```ignore,no_run
18176 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18177 /// let x = ListSessionsRequest::new().set_page_size(42);
18178 /// ```
18179 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18180 self.page_size = v.into();
18181 self
18182 }
18183
18184 /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
18185 ///
18186 /// # Example
18187 /// ```ignore,no_run
18188 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18189 /// let x = ListSessionsRequest::new().set_page_token("example");
18190 /// ```
18191 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18192 self.page_token = v.into();
18193 self
18194 }
18195
18196 /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
18197 ///
18198 /// # Example
18199 /// ```ignore,no_run
18200 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18201 /// let x = ListSessionsRequest::new().set_filter("example");
18202 /// ```
18203 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18204 self.filter = v.into();
18205 self
18206 }
18207}
18208
18209impl wkt::message::Message for ListSessionsRequest {
18210 fn typename() -> &'static str {
18211 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsRequest"
18212 }
18213}
18214
18215/// A list of interactive sessions.
18216#[derive(Clone, Default, PartialEq)]
18217#[non_exhaustive]
18218pub struct ListSessionsResponse {
18219 /// Output only. The sessions from the specified collection.
18220 pub sessions: std::vec::Vec<crate::model::Session>,
18221
18222 /// A token, which can be sent as `page_token`, to retrieve the next page.
18223 /// If this field is omitted, there are no subsequent pages.
18224 pub next_page_token: std::string::String,
18225
18226 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18227}
18228
18229impl ListSessionsResponse {
18230 pub fn new() -> Self {
18231 std::default::Default::default()
18232 }
18233
18234 /// Sets the value of [sessions][crate::model::ListSessionsResponse::sessions].
18235 ///
18236 /// # Example
18237 /// ```ignore,no_run
18238 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18239 /// use google_cloud_dataproc_v1::model::Session;
18240 /// let x = ListSessionsResponse::new()
18241 /// .set_sessions([
18242 /// Session::default()/* use setters */,
18243 /// Session::default()/* use (different) setters */,
18244 /// ]);
18245 /// ```
18246 pub fn set_sessions<T, V>(mut self, v: T) -> Self
18247 where
18248 T: std::iter::IntoIterator<Item = V>,
18249 V: std::convert::Into<crate::model::Session>,
18250 {
18251 use std::iter::Iterator;
18252 self.sessions = v.into_iter().map(|i| i.into()).collect();
18253 self
18254 }
18255
18256 /// Sets the value of [next_page_token][crate::model::ListSessionsResponse::next_page_token].
18257 ///
18258 /// # Example
18259 /// ```ignore,no_run
18260 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18261 /// let x = ListSessionsResponse::new().set_next_page_token("example");
18262 /// ```
18263 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18264 self.next_page_token = v.into();
18265 self
18266 }
18267}
18268
18269impl wkt::message::Message for ListSessionsResponse {
18270 fn typename() -> &'static str {
18271 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsResponse"
18272 }
18273}
18274
18275#[doc(hidden)]
18276impl gax::paginator::internal::PageableResponse for ListSessionsResponse {
18277 type PageItem = crate::model::Session;
18278
18279 fn items(self) -> std::vec::Vec<Self::PageItem> {
18280 self.sessions
18281 }
18282
18283 fn next_page_token(&self) -> std::string::String {
18284 use std::clone::Clone;
18285 self.next_page_token.clone()
18286 }
18287}
18288
18289/// A request to terminate an interactive session.
18290#[derive(Clone, Default, PartialEq)]
18291#[non_exhaustive]
18292pub struct TerminateSessionRequest {
18293 /// Required. The name of the session resource to terminate.
18294 pub name: std::string::String,
18295
18296 /// Optional. A unique ID used to identify the request. If the service
18297 /// receives two
18298 /// [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
18299 /// with the same ID, the second request is ignored.
18300 ///
18301 /// Recommendation: Set this value to a
18302 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18303 ///
18304 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18305 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18306 pub request_id: std::string::String,
18307
18308 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18309}
18310
18311impl TerminateSessionRequest {
18312 pub fn new() -> Self {
18313 std::default::Default::default()
18314 }
18315
18316 /// Sets the value of [name][crate::model::TerminateSessionRequest::name].
18317 ///
18318 /// # Example
18319 /// ```ignore,no_run
18320 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
18321 /// let x = TerminateSessionRequest::new().set_name("example");
18322 /// ```
18323 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18324 self.name = v.into();
18325 self
18326 }
18327
18328 /// Sets the value of [request_id][crate::model::TerminateSessionRequest::request_id].
18329 ///
18330 /// # Example
18331 /// ```ignore,no_run
18332 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
18333 /// let x = TerminateSessionRequest::new().set_request_id("example");
18334 /// ```
18335 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18336 self.request_id = v.into();
18337 self
18338 }
18339}
18340
18341impl wkt::message::Message for TerminateSessionRequest {
18342 fn typename() -> &'static str {
18343 "type.googleapis.com/google.cloud.dataproc.v1.TerminateSessionRequest"
18344 }
18345}
18346
18347/// A request to delete a session.
18348#[derive(Clone, Default, PartialEq)]
18349#[non_exhaustive]
18350pub struct DeleteSessionRequest {
18351 /// Required. The name of the session resource to delete.
18352 pub name: std::string::String,
18353
18354 /// Optional. A unique ID used to identify the request. If the service
18355 /// receives two
18356 /// [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
18357 /// with the same ID, the second request is ignored.
18358 ///
18359 /// Recommendation: Set this value to a
18360 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18361 ///
18362 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18363 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18364 pub request_id: std::string::String,
18365
18366 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18367}
18368
18369impl DeleteSessionRequest {
18370 pub fn new() -> Self {
18371 std::default::Default::default()
18372 }
18373
18374 /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
18375 ///
18376 /// # Example
18377 /// ```ignore,no_run
18378 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
18379 /// let x = DeleteSessionRequest::new().set_name("example");
18380 /// ```
18381 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18382 self.name = v.into();
18383 self
18384 }
18385
18386 /// Sets the value of [request_id][crate::model::DeleteSessionRequest::request_id].
18387 ///
18388 /// # Example
18389 /// ```ignore,no_run
18390 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
18391 /// let x = DeleteSessionRequest::new().set_request_id("example");
18392 /// ```
18393 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18394 self.request_id = v.into();
18395 self
18396 }
18397}
18398
18399impl wkt::message::Message for DeleteSessionRequest {
18400 fn typename() -> &'static str {
18401 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionRequest"
18402 }
18403}
18404
18405/// A representation of a session.
18406#[derive(Clone, Default, PartialEq)]
18407#[non_exhaustive]
18408pub struct Session {
18409 /// Required. The resource name of the session.
18410 pub name: std::string::String,
18411
18412 /// Output only. A session UUID (Unique Universal Identifier). The service
18413 /// generates this value when it creates the session.
18414 pub uuid: std::string::String,
18415
18416 /// Output only. The time when the session was created.
18417 pub create_time: std::option::Option<wkt::Timestamp>,
18418
18419 /// Output only. Runtime information about session execution.
18420 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
18421
18422 /// Output only. A state of the session.
18423 pub state: crate::model::session::State,
18424
18425 /// Output only. Session state details, such as the failure
18426 /// description if the state is `FAILED`.
18427 pub state_message: std::string::String,
18428
18429 /// Output only. The time when the session entered the current state.
18430 pub state_time: std::option::Option<wkt::Timestamp>,
18431
18432 /// Output only. The email address of the user who created the session.
18433 pub creator: std::string::String,
18434
18435 /// Optional. The labels to associate with the session.
18436 /// Label **keys** must contain 1 to 63 characters, and must conform to
18437 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
18438 /// Label **values** may be empty, but, if present, must contain 1 to 63
18439 /// characters, and must conform to [RFC
18440 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
18441 /// associated with a session.
18442 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18443
18444 /// Optional. Runtime configuration for the session execution.
18445 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
18446
18447 /// Optional. Environment configuration for the session execution.
18448 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
18449
18450 /// Optional. The email address of the user who owns the session.
18451 pub user: std::string::String,
18452
18453 /// Output only. Historical state information for the session.
18454 pub state_history: std::vec::Vec<crate::model::session::SessionStateHistory>,
18455
18456 /// Optional. The session template used by the session.
18457 ///
18458 /// Only resource names, including project ID and location, are valid.
18459 ///
18460 /// Example:
18461 ///
18462 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
18463 /// * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
18464 ///
18465 /// The template must be in the same project and Dataproc region as the
18466 /// session.
18467 pub session_template: std::string::String,
18468
18469 /// The session configuration.
18470 pub session_config: std::option::Option<crate::model::session::SessionConfig>,
18471
18472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18473}
18474
18475impl Session {
18476 pub fn new() -> Self {
18477 std::default::Default::default()
18478 }
18479
18480 /// Sets the value of [name][crate::model::Session::name].
18481 ///
18482 /// # Example
18483 /// ```ignore,no_run
18484 /// # use google_cloud_dataproc_v1::model::Session;
18485 /// let x = Session::new().set_name("example");
18486 /// ```
18487 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18488 self.name = v.into();
18489 self
18490 }
18491
18492 /// Sets the value of [uuid][crate::model::Session::uuid].
18493 ///
18494 /// # Example
18495 /// ```ignore,no_run
18496 /// # use google_cloud_dataproc_v1::model::Session;
18497 /// let x = Session::new().set_uuid("example");
18498 /// ```
18499 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18500 self.uuid = v.into();
18501 self
18502 }
18503
18504 /// Sets the value of [create_time][crate::model::Session::create_time].
18505 ///
18506 /// # Example
18507 /// ```ignore,no_run
18508 /// # use google_cloud_dataproc_v1::model::Session;
18509 /// use wkt::Timestamp;
18510 /// let x = Session::new().set_create_time(Timestamp::default()/* use setters */);
18511 /// ```
18512 pub fn set_create_time<T>(mut self, v: T) -> Self
18513 where
18514 T: std::convert::Into<wkt::Timestamp>,
18515 {
18516 self.create_time = std::option::Option::Some(v.into());
18517 self
18518 }
18519
18520 /// Sets or clears the value of [create_time][crate::model::Session::create_time].
18521 ///
18522 /// # Example
18523 /// ```ignore,no_run
18524 /// # use google_cloud_dataproc_v1::model::Session;
18525 /// use wkt::Timestamp;
18526 /// let x = Session::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18527 /// let x = Session::new().set_or_clear_create_time(None::<Timestamp>);
18528 /// ```
18529 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18530 where
18531 T: std::convert::Into<wkt::Timestamp>,
18532 {
18533 self.create_time = v.map(|x| x.into());
18534 self
18535 }
18536
18537 /// Sets the value of [runtime_info][crate::model::Session::runtime_info].
18538 ///
18539 /// # Example
18540 /// ```ignore,no_run
18541 /// # use google_cloud_dataproc_v1::model::Session;
18542 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
18543 /// let x = Session::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
18544 /// ```
18545 pub fn set_runtime_info<T>(mut self, v: T) -> Self
18546 where
18547 T: std::convert::Into<crate::model::RuntimeInfo>,
18548 {
18549 self.runtime_info = std::option::Option::Some(v.into());
18550 self
18551 }
18552
18553 /// Sets or clears the value of [runtime_info][crate::model::Session::runtime_info].
18554 ///
18555 /// # Example
18556 /// ```ignore,no_run
18557 /// # use google_cloud_dataproc_v1::model::Session;
18558 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
18559 /// let x = Session::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
18560 /// let x = Session::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
18561 /// ```
18562 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
18563 where
18564 T: std::convert::Into<crate::model::RuntimeInfo>,
18565 {
18566 self.runtime_info = v.map(|x| x.into());
18567 self
18568 }
18569
18570 /// Sets the value of [state][crate::model::Session::state].
18571 ///
18572 /// # Example
18573 /// ```ignore,no_run
18574 /// # use google_cloud_dataproc_v1::model::Session;
18575 /// use google_cloud_dataproc_v1::model::session::State;
18576 /// let x0 = Session::new().set_state(State::Creating);
18577 /// let x1 = Session::new().set_state(State::Active);
18578 /// let x2 = Session::new().set_state(State::Terminating);
18579 /// ```
18580 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(mut self, v: T) -> Self {
18581 self.state = v.into();
18582 self
18583 }
18584
18585 /// Sets the value of [state_message][crate::model::Session::state_message].
18586 ///
18587 /// # Example
18588 /// ```ignore,no_run
18589 /// # use google_cloud_dataproc_v1::model::Session;
18590 /// let x = Session::new().set_state_message("example");
18591 /// ```
18592 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18593 self.state_message = v.into();
18594 self
18595 }
18596
18597 /// Sets the value of [state_time][crate::model::Session::state_time].
18598 ///
18599 /// # Example
18600 /// ```ignore,no_run
18601 /// # use google_cloud_dataproc_v1::model::Session;
18602 /// use wkt::Timestamp;
18603 /// let x = Session::new().set_state_time(Timestamp::default()/* use setters */);
18604 /// ```
18605 pub fn set_state_time<T>(mut self, v: T) -> Self
18606 where
18607 T: std::convert::Into<wkt::Timestamp>,
18608 {
18609 self.state_time = std::option::Option::Some(v.into());
18610 self
18611 }
18612
18613 /// Sets or clears the value of [state_time][crate::model::Session::state_time].
18614 ///
18615 /// # Example
18616 /// ```ignore,no_run
18617 /// # use google_cloud_dataproc_v1::model::Session;
18618 /// use wkt::Timestamp;
18619 /// let x = Session::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
18620 /// let x = Session::new().set_or_clear_state_time(None::<Timestamp>);
18621 /// ```
18622 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
18623 where
18624 T: std::convert::Into<wkt::Timestamp>,
18625 {
18626 self.state_time = v.map(|x| x.into());
18627 self
18628 }
18629
18630 /// Sets the value of [creator][crate::model::Session::creator].
18631 ///
18632 /// # Example
18633 /// ```ignore,no_run
18634 /// # use google_cloud_dataproc_v1::model::Session;
18635 /// let x = Session::new().set_creator("example");
18636 /// ```
18637 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18638 self.creator = v.into();
18639 self
18640 }
18641
18642 /// Sets the value of [labels][crate::model::Session::labels].
18643 ///
18644 /// # Example
18645 /// ```ignore,no_run
18646 /// # use google_cloud_dataproc_v1::model::Session;
18647 /// let x = Session::new().set_labels([
18648 /// ("key0", "abc"),
18649 /// ("key1", "xyz"),
18650 /// ]);
18651 /// ```
18652 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18653 where
18654 T: std::iter::IntoIterator<Item = (K, V)>,
18655 K: std::convert::Into<std::string::String>,
18656 V: std::convert::Into<std::string::String>,
18657 {
18658 use std::iter::Iterator;
18659 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18660 self
18661 }
18662
18663 /// Sets the value of [runtime_config][crate::model::Session::runtime_config].
18664 ///
18665 /// # Example
18666 /// ```ignore,no_run
18667 /// # use google_cloud_dataproc_v1::model::Session;
18668 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18669 /// let x = Session::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
18670 /// ```
18671 pub fn set_runtime_config<T>(mut self, v: T) -> Self
18672 where
18673 T: std::convert::Into<crate::model::RuntimeConfig>,
18674 {
18675 self.runtime_config = std::option::Option::Some(v.into());
18676 self
18677 }
18678
18679 /// Sets or clears the value of [runtime_config][crate::model::Session::runtime_config].
18680 ///
18681 /// # Example
18682 /// ```ignore,no_run
18683 /// # use google_cloud_dataproc_v1::model::Session;
18684 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18685 /// let x = Session::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
18686 /// let x = Session::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
18687 /// ```
18688 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
18689 where
18690 T: std::convert::Into<crate::model::RuntimeConfig>,
18691 {
18692 self.runtime_config = v.map(|x| x.into());
18693 self
18694 }
18695
18696 /// Sets the value of [environment_config][crate::model::Session::environment_config].
18697 ///
18698 /// # Example
18699 /// ```ignore,no_run
18700 /// # use google_cloud_dataproc_v1::model::Session;
18701 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18702 /// let x = Session::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
18703 /// ```
18704 pub fn set_environment_config<T>(mut self, v: T) -> Self
18705 where
18706 T: std::convert::Into<crate::model::EnvironmentConfig>,
18707 {
18708 self.environment_config = std::option::Option::Some(v.into());
18709 self
18710 }
18711
18712 /// Sets or clears the value of [environment_config][crate::model::Session::environment_config].
18713 ///
18714 /// # Example
18715 /// ```ignore,no_run
18716 /// # use google_cloud_dataproc_v1::model::Session;
18717 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18718 /// let x = Session::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
18719 /// let x = Session::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
18720 /// ```
18721 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
18722 where
18723 T: std::convert::Into<crate::model::EnvironmentConfig>,
18724 {
18725 self.environment_config = v.map(|x| x.into());
18726 self
18727 }
18728
18729 /// Sets the value of [user][crate::model::Session::user].
18730 ///
18731 /// # Example
18732 /// ```ignore,no_run
18733 /// # use google_cloud_dataproc_v1::model::Session;
18734 /// let x = Session::new().set_user("example");
18735 /// ```
18736 pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18737 self.user = v.into();
18738 self
18739 }
18740
18741 /// Sets the value of [state_history][crate::model::Session::state_history].
18742 ///
18743 /// # Example
18744 /// ```ignore,no_run
18745 /// # use google_cloud_dataproc_v1::model::Session;
18746 /// use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18747 /// let x = Session::new()
18748 /// .set_state_history([
18749 /// SessionStateHistory::default()/* use setters */,
18750 /// SessionStateHistory::default()/* use (different) setters */,
18751 /// ]);
18752 /// ```
18753 pub fn set_state_history<T, V>(mut self, v: T) -> Self
18754 where
18755 T: std::iter::IntoIterator<Item = V>,
18756 V: std::convert::Into<crate::model::session::SessionStateHistory>,
18757 {
18758 use std::iter::Iterator;
18759 self.state_history = v.into_iter().map(|i| i.into()).collect();
18760 self
18761 }
18762
18763 /// Sets the value of [session_template][crate::model::Session::session_template].
18764 ///
18765 /// # Example
18766 /// ```ignore,no_run
18767 /// # use google_cloud_dataproc_v1::model::Session;
18768 /// let x = Session::new().set_session_template("example");
18769 /// ```
18770 pub fn set_session_template<T: std::convert::Into<std::string::String>>(
18771 mut self,
18772 v: T,
18773 ) -> Self {
18774 self.session_template = v.into();
18775 self
18776 }
18777
18778 /// Sets the value of [session_config][crate::model::Session::session_config].
18779 ///
18780 /// Note that all the setters affecting `session_config` are mutually
18781 /// exclusive.
18782 ///
18783 /// # Example
18784 /// ```ignore,no_run
18785 /// # use google_cloud_dataproc_v1::model::Session;
18786 /// use google_cloud_dataproc_v1::model::JupyterConfig;
18787 /// let x = Session::new().set_session_config(Some(
18788 /// google_cloud_dataproc_v1::model::session::SessionConfig::JupyterSession(JupyterConfig::default().into())));
18789 /// ```
18790 pub fn set_session_config<
18791 T: std::convert::Into<std::option::Option<crate::model::session::SessionConfig>>,
18792 >(
18793 mut self,
18794 v: T,
18795 ) -> Self {
18796 self.session_config = v.into();
18797 self
18798 }
18799
18800 /// The value of [session_config][crate::model::Session::session_config]
18801 /// if it holds a `JupyterSession`, `None` if the field is not set or
18802 /// holds a different branch.
18803 pub fn jupyter_session(
18804 &self,
18805 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
18806 #[allow(unreachable_patterns)]
18807 self.session_config.as_ref().and_then(|v| match v {
18808 crate::model::session::SessionConfig::JupyterSession(v) => std::option::Option::Some(v),
18809 _ => std::option::Option::None,
18810 })
18811 }
18812
18813 /// Sets the value of [session_config][crate::model::Session::session_config]
18814 /// to hold a `JupyterSession`.
18815 ///
18816 /// Note that all the setters affecting `session_config` are
18817 /// mutually exclusive.
18818 ///
18819 /// # Example
18820 /// ```ignore,no_run
18821 /// # use google_cloud_dataproc_v1::model::Session;
18822 /// use google_cloud_dataproc_v1::model::JupyterConfig;
18823 /// let x = Session::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
18824 /// assert!(x.jupyter_session().is_some());
18825 /// assert!(x.spark_connect_session().is_none());
18826 /// ```
18827 pub fn set_jupyter_session<
18828 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
18829 >(
18830 mut self,
18831 v: T,
18832 ) -> Self {
18833 self.session_config = std::option::Option::Some(
18834 crate::model::session::SessionConfig::JupyterSession(v.into()),
18835 );
18836 self
18837 }
18838
18839 /// The value of [session_config][crate::model::Session::session_config]
18840 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
18841 /// holds a different branch.
18842 pub fn spark_connect_session(
18843 &self,
18844 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
18845 #[allow(unreachable_patterns)]
18846 self.session_config.as_ref().and_then(|v| match v {
18847 crate::model::session::SessionConfig::SparkConnectSession(v) => {
18848 std::option::Option::Some(v)
18849 }
18850 _ => std::option::Option::None,
18851 })
18852 }
18853
18854 /// Sets the value of [session_config][crate::model::Session::session_config]
18855 /// to hold a `SparkConnectSession`.
18856 ///
18857 /// Note that all the setters affecting `session_config` are
18858 /// mutually exclusive.
18859 ///
18860 /// # Example
18861 /// ```ignore,no_run
18862 /// # use google_cloud_dataproc_v1::model::Session;
18863 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
18864 /// let x = Session::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
18865 /// assert!(x.spark_connect_session().is_some());
18866 /// assert!(x.jupyter_session().is_none());
18867 /// ```
18868 pub fn set_spark_connect_session<
18869 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
18870 >(
18871 mut self,
18872 v: T,
18873 ) -> Self {
18874 self.session_config = std::option::Option::Some(
18875 crate::model::session::SessionConfig::SparkConnectSession(v.into()),
18876 );
18877 self
18878 }
18879}
18880
18881impl wkt::message::Message for Session {
18882 fn typename() -> &'static str {
18883 "type.googleapis.com/google.cloud.dataproc.v1.Session"
18884 }
18885}
18886
18887/// Defines additional types related to [Session].
18888pub mod session {
18889 #[allow(unused_imports)]
18890 use super::*;
18891
18892 /// Historical state information.
18893 #[derive(Clone, Default, PartialEq)]
18894 #[non_exhaustive]
18895 pub struct SessionStateHistory {
18896 /// Output only. The state of the session at this point in the session
18897 /// history.
18898 pub state: crate::model::session::State,
18899
18900 /// Output only. Details about the state at this point in the session
18901 /// history.
18902 pub state_message: std::string::String,
18903
18904 /// Output only. The time when the session entered the historical state.
18905 pub state_start_time: std::option::Option<wkt::Timestamp>,
18906
18907 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18908 }
18909
18910 impl SessionStateHistory {
18911 pub fn new() -> Self {
18912 std::default::Default::default()
18913 }
18914
18915 /// Sets the value of [state][crate::model::session::SessionStateHistory::state].
18916 ///
18917 /// # Example
18918 /// ```ignore,no_run
18919 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18920 /// use google_cloud_dataproc_v1::model::session::State;
18921 /// let x0 = SessionStateHistory::new().set_state(State::Creating);
18922 /// let x1 = SessionStateHistory::new().set_state(State::Active);
18923 /// let x2 = SessionStateHistory::new().set_state(State::Terminating);
18924 /// ```
18925 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(
18926 mut self,
18927 v: T,
18928 ) -> Self {
18929 self.state = v.into();
18930 self
18931 }
18932
18933 /// Sets the value of [state_message][crate::model::session::SessionStateHistory::state_message].
18934 ///
18935 /// # Example
18936 /// ```ignore,no_run
18937 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18938 /// let x = SessionStateHistory::new().set_state_message("example");
18939 /// ```
18940 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
18941 mut self,
18942 v: T,
18943 ) -> Self {
18944 self.state_message = v.into();
18945 self
18946 }
18947
18948 /// Sets the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
18949 ///
18950 /// # Example
18951 /// ```ignore,no_run
18952 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18953 /// use wkt::Timestamp;
18954 /// let x = SessionStateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
18955 /// ```
18956 pub fn set_state_start_time<T>(mut self, v: T) -> Self
18957 where
18958 T: std::convert::Into<wkt::Timestamp>,
18959 {
18960 self.state_start_time = std::option::Option::Some(v.into());
18961 self
18962 }
18963
18964 /// Sets or clears the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
18965 ///
18966 /// # Example
18967 /// ```ignore,no_run
18968 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18969 /// use wkt::Timestamp;
18970 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
18971 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
18972 /// ```
18973 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
18974 where
18975 T: std::convert::Into<wkt::Timestamp>,
18976 {
18977 self.state_start_time = v.map(|x| x.into());
18978 self
18979 }
18980 }
18981
18982 impl wkt::message::Message for SessionStateHistory {
18983 fn typename() -> &'static str {
18984 "type.googleapis.com/google.cloud.dataproc.v1.Session.SessionStateHistory"
18985 }
18986 }
18987
18988 /// The session state.
18989 ///
18990 /// # Working with unknown values
18991 ///
18992 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18993 /// additional enum variants at any time. Adding new variants is not considered
18994 /// a breaking change. Applications should write their code in anticipation of:
18995 ///
18996 /// - New values appearing in future releases of the client library, **and**
18997 /// - New values received dynamically, without application changes.
18998 ///
18999 /// Please consult the [Working with enums] section in the user guide for some
19000 /// guidelines.
19001 ///
19002 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19003 #[derive(Clone, Debug, PartialEq)]
19004 #[non_exhaustive]
19005 pub enum State {
19006 /// The session state is unknown.
19007 Unspecified,
19008 /// The session is created prior to running.
19009 Creating,
19010 /// The session is running.
19011 Active,
19012 /// The session is terminating.
19013 Terminating,
19014 /// The session is terminated successfully.
19015 Terminated,
19016 /// The session is no longer running due to an error.
19017 Failed,
19018 /// If set, the enum was initialized with an unknown value.
19019 ///
19020 /// Applications can examine the value using [State::value] or
19021 /// [State::name].
19022 UnknownValue(state::UnknownValue),
19023 }
19024
19025 #[doc(hidden)]
19026 pub mod state {
19027 #[allow(unused_imports)]
19028 use super::*;
19029 #[derive(Clone, Debug, PartialEq)]
19030 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19031 }
19032
19033 impl State {
19034 /// Gets the enum value.
19035 ///
19036 /// Returns `None` if the enum contains an unknown value deserialized from
19037 /// the string representation of enums.
19038 pub fn value(&self) -> std::option::Option<i32> {
19039 match self {
19040 Self::Unspecified => std::option::Option::Some(0),
19041 Self::Creating => std::option::Option::Some(1),
19042 Self::Active => std::option::Option::Some(2),
19043 Self::Terminating => std::option::Option::Some(3),
19044 Self::Terminated => std::option::Option::Some(4),
19045 Self::Failed => std::option::Option::Some(5),
19046 Self::UnknownValue(u) => u.0.value(),
19047 }
19048 }
19049
19050 /// Gets the enum value as a string.
19051 ///
19052 /// Returns `None` if the enum contains an unknown value deserialized from
19053 /// the integer representation of enums.
19054 pub fn name(&self) -> std::option::Option<&str> {
19055 match self {
19056 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19057 Self::Creating => std::option::Option::Some("CREATING"),
19058 Self::Active => std::option::Option::Some("ACTIVE"),
19059 Self::Terminating => std::option::Option::Some("TERMINATING"),
19060 Self::Terminated => std::option::Option::Some("TERMINATED"),
19061 Self::Failed => std::option::Option::Some("FAILED"),
19062 Self::UnknownValue(u) => u.0.name(),
19063 }
19064 }
19065 }
19066
19067 impl std::default::Default for State {
19068 fn default() -> Self {
19069 use std::convert::From;
19070 Self::from(0)
19071 }
19072 }
19073
19074 impl std::fmt::Display for State {
19075 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19076 wkt::internal::display_enum(f, self.name(), self.value())
19077 }
19078 }
19079
19080 impl std::convert::From<i32> for State {
19081 fn from(value: i32) -> Self {
19082 match value {
19083 0 => Self::Unspecified,
19084 1 => Self::Creating,
19085 2 => Self::Active,
19086 3 => Self::Terminating,
19087 4 => Self::Terminated,
19088 5 => Self::Failed,
19089 _ => Self::UnknownValue(state::UnknownValue(
19090 wkt::internal::UnknownEnumValue::Integer(value),
19091 )),
19092 }
19093 }
19094 }
19095
19096 impl std::convert::From<&str> for State {
19097 fn from(value: &str) -> Self {
19098 use std::string::ToString;
19099 match value {
19100 "STATE_UNSPECIFIED" => Self::Unspecified,
19101 "CREATING" => Self::Creating,
19102 "ACTIVE" => Self::Active,
19103 "TERMINATING" => Self::Terminating,
19104 "TERMINATED" => Self::Terminated,
19105 "FAILED" => Self::Failed,
19106 _ => Self::UnknownValue(state::UnknownValue(
19107 wkt::internal::UnknownEnumValue::String(value.to_string()),
19108 )),
19109 }
19110 }
19111 }
19112
19113 impl serde::ser::Serialize for State {
19114 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19115 where
19116 S: serde::Serializer,
19117 {
19118 match self {
19119 Self::Unspecified => serializer.serialize_i32(0),
19120 Self::Creating => serializer.serialize_i32(1),
19121 Self::Active => serializer.serialize_i32(2),
19122 Self::Terminating => serializer.serialize_i32(3),
19123 Self::Terminated => serializer.serialize_i32(4),
19124 Self::Failed => serializer.serialize_i32(5),
19125 Self::UnknownValue(u) => u.0.serialize(serializer),
19126 }
19127 }
19128 }
19129
19130 impl<'de> serde::de::Deserialize<'de> for State {
19131 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19132 where
19133 D: serde::Deserializer<'de>,
19134 {
19135 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19136 ".google.cloud.dataproc.v1.Session.State",
19137 ))
19138 }
19139 }
19140
19141 /// The session configuration.
19142 #[derive(Clone, Debug, PartialEq)]
19143 #[non_exhaustive]
19144 pub enum SessionConfig {
19145 /// Optional. Jupyter session config.
19146 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
19147 /// Optional. Spark Connect session config.
19148 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
19149 }
19150}
19151
19152/// Jupyter configuration for an interactive session.
19153#[derive(Clone, Default, PartialEq)]
19154#[non_exhaustive]
19155pub struct JupyterConfig {
19156 /// Optional. Kernel
19157 pub kernel: crate::model::jupyter_config::Kernel,
19158
19159 /// Optional. Display name, shown in the Jupyter kernelspec card.
19160 pub display_name: std::string::String,
19161
19162 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19163}
19164
19165impl JupyterConfig {
19166 pub fn new() -> Self {
19167 std::default::Default::default()
19168 }
19169
19170 /// Sets the value of [kernel][crate::model::JupyterConfig::kernel].
19171 ///
19172 /// # Example
19173 /// ```ignore,no_run
19174 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19175 /// use google_cloud_dataproc_v1::model::jupyter_config::Kernel;
19176 /// let x0 = JupyterConfig::new().set_kernel(Kernel::Python);
19177 /// let x1 = JupyterConfig::new().set_kernel(Kernel::Scala);
19178 /// ```
19179 pub fn set_kernel<T: std::convert::Into<crate::model::jupyter_config::Kernel>>(
19180 mut self,
19181 v: T,
19182 ) -> Self {
19183 self.kernel = v.into();
19184 self
19185 }
19186
19187 /// Sets the value of [display_name][crate::model::JupyterConfig::display_name].
19188 ///
19189 /// # Example
19190 /// ```ignore,no_run
19191 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19192 /// let x = JupyterConfig::new().set_display_name("example");
19193 /// ```
19194 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19195 self.display_name = v.into();
19196 self
19197 }
19198}
19199
19200impl wkt::message::Message for JupyterConfig {
19201 fn typename() -> &'static str {
19202 "type.googleapis.com/google.cloud.dataproc.v1.JupyterConfig"
19203 }
19204}
19205
19206/// Defines additional types related to [JupyterConfig].
19207pub mod jupyter_config {
19208 #[allow(unused_imports)]
19209 use super::*;
19210
19211 /// Jupyter kernel types.
19212 ///
19213 /// # Working with unknown values
19214 ///
19215 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19216 /// additional enum variants at any time. Adding new variants is not considered
19217 /// a breaking change. Applications should write their code in anticipation of:
19218 ///
19219 /// - New values appearing in future releases of the client library, **and**
19220 /// - New values received dynamically, without application changes.
19221 ///
19222 /// Please consult the [Working with enums] section in the user guide for some
19223 /// guidelines.
19224 ///
19225 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19226 #[derive(Clone, Debug, PartialEq)]
19227 #[non_exhaustive]
19228 pub enum Kernel {
19229 /// The kernel is unknown.
19230 Unspecified,
19231 /// Python kernel.
19232 Python,
19233 /// Scala kernel.
19234 Scala,
19235 /// If set, the enum was initialized with an unknown value.
19236 ///
19237 /// Applications can examine the value using [Kernel::value] or
19238 /// [Kernel::name].
19239 UnknownValue(kernel::UnknownValue),
19240 }
19241
19242 #[doc(hidden)]
19243 pub mod kernel {
19244 #[allow(unused_imports)]
19245 use super::*;
19246 #[derive(Clone, Debug, PartialEq)]
19247 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19248 }
19249
19250 impl Kernel {
19251 /// Gets the enum value.
19252 ///
19253 /// Returns `None` if the enum contains an unknown value deserialized from
19254 /// the string representation of enums.
19255 pub fn value(&self) -> std::option::Option<i32> {
19256 match self {
19257 Self::Unspecified => std::option::Option::Some(0),
19258 Self::Python => std::option::Option::Some(1),
19259 Self::Scala => std::option::Option::Some(2),
19260 Self::UnknownValue(u) => u.0.value(),
19261 }
19262 }
19263
19264 /// Gets the enum value as a string.
19265 ///
19266 /// Returns `None` if the enum contains an unknown value deserialized from
19267 /// the integer representation of enums.
19268 pub fn name(&self) -> std::option::Option<&str> {
19269 match self {
19270 Self::Unspecified => std::option::Option::Some("KERNEL_UNSPECIFIED"),
19271 Self::Python => std::option::Option::Some("PYTHON"),
19272 Self::Scala => std::option::Option::Some("SCALA"),
19273 Self::UnknownValue(u) => u.0.name(),
19274 }
19275 }
19276 }
19277
19278 impl std::default::Default for Kernel {
19279 fn default() -> Self {
19280 use std::convert::From;
19281 Self::from(0)
19282 }
19283 }
19284
19285 impl std::fmt::Display for Kernel {
19286 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19287 wkt::internal::display_enum(f, self.name(), self.value())
19288 }
19289 }
19290
19291 impl std::convert::From<i32> for Kernel {
19292 fn from(value: i32) -> Self {
19293 match value {
19294 0 => Self::Unspecified,
19295 1 => Self::Python,
19296 2 => Self::Scala,
19297 _ => Self::UnknownValue(kernel::UnknownValue(
19298 wkt::internal::UnknownEnumValue::Integer(value),
19299 )),
19300 }
19301 }
19302 }
19303
19304 impl std::convert::From<&str> for Kernel {
19305 fn from(value: &str) -> Self {
19306 use std::string::ToString;
19307 match value {
19308 "KERNEL_UNSPECIFIED" => Self::Unspecified,
19309 "PYTHON" => Self::Python,
19310 "SCALA" => Self::Scala,
19311 _ => Self::UnknownValue(kernel::UnknownValue(
19312 wkt::internal::UnknownEnumValue::String(value.to_string()),
19313 )),
19314 }
19315 }
19316 }
19317
19318 impl serde::ser::Serialize for Kernel {
19319 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19320 where
19321 S: serde::Serializer,
19322 {
19323 match self {
19324 Self::Unspecified => serializer.serialize_i32(0),
19325 Self::Python => serializer.serialize_i32(1),
19326 Self::Scala => serializer.serialize_i32(2),
19327 Self::UnknownValue(u) => u.0.serialize(serializer),
19328 }
19329 }
19330 }
19331
19332 impl<'de> serde::de::Deserialize<'de> for Kernel {
19333 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19334 where
19335 D: serde::Deserializer<'de>,
19336 {
19337 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kernel>::new(
19338 ".google.cloud.dataproc.v1.JupyterConfig.Kernel",
19339 ))
19340 }
19341 }
19342}
19343
19344/// Spark Connect configuration for an interactive session.
19345#[derive(Clone, Default, PartialEq)]
19346#[non_exhaustive]
19347pub struct SparkConnectConfig {
19348 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19349}
19350
19351impl SparkConnectConfig {
19352 pub fn new() -> Self {
19353 std::default::Default::default()
19354 }
19355}
19356
19357impl wkt::message::Message for SparkConnectConfig {
19358 fn typename() -> &'static str {
19359 "type.googleapis.com/google.cloud.dataproc.v1.SparkConnectConfig"
19360 }
19361}
19362
19363/// Runtime configuration for a workload.
19364#[derive(Clone, Default, PartialEq)]
19365#[non_exhaustive]
19366pub struct RuntimeConfig {
19367 /// Optional. Version of the batch runtime.
19368 pub version: std::string::String,
19369
19370 /// Optional. Optional custom container image for the job runtime environment.
19371 /// If not specified, a default container image will be used.
19372 pub container_image: std::string::String,
19373
19374 /// Optional. A mapping of property names to values, which are used to
19375 /// configure workload execution.
19376 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
19377
19378 /// Optional. Dependency repository configuration.
19379 pub repository_config: std::option::Option<crate::model::RepositoryConfig>,
19380
19381 /// Optional. Autotuning configuration of the workload.
19382 pub autotuning_config: std::option::Option<crate::model::AutotuningConfig>,
19383
19384 /// Optional. Cohort identifier. Identifies families of the workloads having
19385 /// the same shape, e.g. daily ETL jobs.
19386 pub cohort: std::string::String,
19387
19388 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19389}
19390
19391impl RuntimeConfig {
19392 pub fn new() -> Self {
19393 std::default::Default::default()
19394 }
19395
19396 /// Sets the value of [version][crate::model::RuntimeConfig::version].
19397 ///
19398 /// # Example
19399 /// ```ignore,no_run
19400 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19401 /// let x = RuntimeConfig::new().set_version("example");
19402 /// ```
19403 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19404 self.version = v.into();
19405 self
19406 }
19407
19408 /// Sets the value of [container_image][crate::model::RuntimeConfig::container_image].
19409 ///
19410 /// # Example
19411 /// ```ignore,no_run
19412 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19413 /// let x = RuntimeConfig::new().set_container_image("example");
19414 /// ```
19415 pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19416 self.container_image = v.into();
19417 self
19418 }
19419
19420 /// Sets the value of [properties][crate::model::RuntimeConfig::properties].
19421 ///
19422 /// # Example
19423 /// ```ignore,no_run
19424 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19425 /// let x = RuntimeConfig::new().set_properties([
19426 /// ("key0", "abc"),
19427 /// ("key1", "xyz"),
19428 /// ]);
19429 /// ```
19430 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
19431 where
19432 T: std::iter::IntoIterator<Item = (K, V)>,
19433 K: std::convert::Into<std::string::String>,
19434 V: std::convert::Into<std::string::String>,
19435 {
19436 use std::iter::Iterator;
19437 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
19438 self
19439 }
19440
19441 /// Sets the value of [repository_config][crate::model::RuntimeConfig::repository_config].
19442 ///
19443 /// # Example
19444 /// ```ignore,no_run
19445 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19446 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
19447 /// let x = RuntimeConfig::new().set_repository_config(RepositoryConfig::default()/* use setters */);
19448 /// ```
19449 pub fn set_repository_config<T>(mut self, v: T) -> Self
19450 where
19451 T: std::convert::Into<crate::model::RepositoryConfig>,
19452 {
19453 self.repository_config = std::option::Option::Some(v.into());
19454 self
19455 }
19456
19457 /// Sets or clears the value of [repository_config][crate::model::RuntimeConfig::repository_config].
19458 ///
19459 /// # Example
19460 /// ```ignore,no_run
19461 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19462 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
19463 /// let x = RuntimeConfig::new().set_or_clear_repository_config(Some(RepositoryConfig::default()/* use setters */));
19464 /// let x = RuntimeConfig::new().set_or_clear_repository_config(None::<RepositoryConfig>);
19465 /// ```
19466 pub fn set_or_clear_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
19467 where
19468 T: std::convert::Into<crate::model::RepositoryConfig>,
19469 {
19470 self.repository_config = v.map(|x| x.into());
19471 self
19472 }
19473
19474 /// Sets the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
19475 ///
19476 /// # Example
19477 /// ```ignore,no_run
19478 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19479 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
19480 /// let x = RuntimeConfig::new().set_autotuning_config(AutotuningConfig::default()/* use setters */);
19481 /// ```
19482 pub fn set_autotuning_config<T>(mut self, v: T) -> Self
19483 where
19484 T: std::convert::Into<crate::model::AutotuningConfig>,
19485 {
19486 self.autotuning_config = std::option::Option::Some(v.into());
19487 self
19488 }
19489
19490 /// Sets or clears the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
19491 ///
19492 /// # Example
19493 /// ```ignore,no_run
19494 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19495 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
19496 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(Some(AutotuningConfig::default()/* use setters */));
19497 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(None::<AutotuningConfig>);
19498 /// ```
19499 pub fn set_or_clear_autotuning_config<T>(mut self, v: std::option::Option<T>) -> Self
19500 where
19501 T: std::convert::Into<crate::model::AutotuningConfig>,
19502 {
19503 self.autotuning_config = v.map(|x| x.into());
19504 self
19505 }
19506
19507 /// Sets the value of [cohort][crate::model::RuntimeConfig::cohort].
19508 ///
19509 /// # Example
19510 /// ```ignore,no_run
19511 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19512 /// let x = RuntimeConfig::new().set_cohort("example");
19513 /// ```
19514 pub fn set_cohort<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19515 self.cohort = v.into();
19516 self
19517 }
19518}
19519
19520impl wkt::message::Message for RuntimeConfig {
19521 fn typename() -> &'static str {
19522 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeConfig"
19523 }
19524}
19525
19526/// Environment configuration for a workload.
19527#[derive(Clone, Default, PartialEq)]
19528#[non_exhaustive]
19529pub struct EnvironmentConfig {
19530 /// Optional. Execution configuration for a workload.
19531 pub execution_config: std::option::Option<crate::model::ExecutionConfig>,
19532
19533 /// Optional. Peripherals configuration that workload has access to.
19534 pub peripherals_config: std::option::Option<crate::model::PeripheralsConfig>,
19535
19536 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19537}
19538
19539impl EnvironmentConfig {
19540 pub fn new() -> Self {
19541 std::default::Default::default()
19542 }
19543
19544 /// Sets the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
19545 ///
19546 /// # Example
19547 /// ```ignore,no_run
19548 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19549 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
19550 /// let x = EnvironmentConfig::new().set_execution_config(ExecutionConfig::default()/* use setters */);
19551 /// ```
19552 pub fn set_execution_config<T>(mut self, v: T) -> Self
19553 where
19554 T: std::convert::Into<crate::model::ExecutionConfig>,
19555 {
19556 self.execution_config = std::option::Option::Some(v.into());
19557 self
19558 }
19559
19560 /// Sets or clears the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
19561 ///
19562 /// # Example
19563 /// ```ignore,no_run
19564 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19565 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
19566 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(Some(ExecutionConfig::default()/* use setters */));
19567 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(None::<ExecutionConfig>);
19568 /// ```
19569 pub fn set_or_clear_execution_config<T>(mut self, v: std::option::Option<T>) -> Self
19570 where
19571 T: std::convert::Into<crate::model::ExecutionConfig>,
19572 {
19573 self.execution_config = v.map(|x| x.into());
19574 self
19575 }
19576
19577 /// Sets the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
19578 ///
19579 /// # Example
19580 /// ```ignore,no_run
19581 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19582 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
19583 /// let x = EnvironmentConfig::new().set_peripherals_config(PeripheralsConfig::default()/* use setters */);
19584 /// ```
19585 pub fn set_peripherals_config<T>(mut self, v: T) -> Self
19586 where
19587 T: std::convert::Into<crate::model::PeripheralsConfig>,
19588 {
19589 self.peripherals_config = std::option::Option::Some(v.into());
19590 self
19591 }
19592
19593 /// Sets or clears the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
19594 ///
19595 /// # Example
19596 /// ```ignore,no_run
19597 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19598 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
19599 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(Some(PeripheralsConfig::default()/* use setters */));
19600 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(None::<PeripheralsConfig>);
19601 /// ```
19602 pub fn set_or_clear_peripherals_config<T>(mut self, v: std::option::Option<T>) -> Self
19603 where
19604 T: std::convert::Into<crate::model::PeripheralsConfig>,
19605 {
19606 self.peripherals_config = v.map(|x| x.into());
19607 self
19608 }
19609}
19610
19611impl wkt::message::Message for EnvironmentConfig {
19612 fn typename() -> &'static str {
19613 "type.googleapis.com/google.cloud.dataproc.v1.EnvironmentConfig"
19614 }
19615}
19616
19617/// Execution configuration for a workload.
19618#[derive(Clone, Default, PartialEq)]
19619#[non_exhaustive]
19620pub struct ExecutionConfig {
19621 /// Optional. Service account that used to execute workload.
19622 pub service_account: std::string::String,
19623
19624 /// Optional. Tags used for network traffic control.
19625 pub network_tags: std::vec::Vec<std::string::String>,
19626
19627 /// Optional. The Cloud KMS key to use for encryption.
19628 pub kms_key: std::string::String,
19629
19630 /// Optional. Applies to sessions only. The duration to keep the session alive
19631 /// while it's idling. Exceeding this threshold causes the session to
19632 /// terminate. This field cannot be set on a batch workload. Minimum value is
19633 /// 10 minutes; maximum value is 14 days (see JSON representation of
19634 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
19635 /// Defaults to 1 hour if not set.
19636 /// If both `ttl` and `idle_ttl` are specified for an interactive session,
19637 /// the conditions are treated as `OR` conditions: the workload will be
19638 /// terminated when it has been idle for `idle_ttl` or when `ttl` has been
19639 /// exceeded, whichever occurs first.
19640 pub idle_ttl: std::option::Option<wkt::Duration>,
19641
19642 /// Optional. The duration after which the workload will be terminated,
19643 /// specified as the JSON representation for
19644 /// [Duration](https://protobuf.dev/programming-guides/proto3/#json).
19645 /// When the workload exceeds this duration, it will be unconditionally
19646 /// terminated without waiting for ongoing work to finish. If `ttl` is not
19647 /// specified for a batch workload, the workload will be allowed to run until
19648 /// it exits naturally (or run forever without exiting). If `ttl` is not
19649 /// specified for an interactive session, it defaults to 24 hours. If `ttl` is
19650 /// not specified for a batch that uses 2.1+ runtime version, it defaults to 4
19651 /// hours. Minimum value is 10 minutes; maximum value is 14 days. If both `ttl`
19652 /// and `idle_ttl` are specified (for an interactive session), the conditions
19653 /// are treated as `OR` conditions: the workload will be terminated when it has
19654 /// been idle for `idle_ttl` or when `ttl` has been exceeded, whichever occurs
19655 /// first.
19656 pub ttl: std::option::Option<wkt::Duration>,
19657
19658 /// Optional. A Cloud Storage bucket used to stage workload dependencies,
19659 /// config files, and store workload output and other ephemeral data, such as
19660 /// Spark history files. If you do not specify a staging bucket, Cloud Dataproc
19661 /// will determine a Cloud Storage location according to the region where your
19662 /// workload is running, and then create and manage project-level, per-location
19663 /// staging and temporary buckets.
19664 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
19665 /// a Cloud Storage bucket.**
19666 pub staging_bucket: std::string::String,
19667
19668 /// Optional. Authentication configuration used to set the default identity for
19669 /// the workload execution. The config specifies the type of identity
19670 /// (service account or user) that will be used by workloads to access
19671 /// resources on the project(s).
19672 pub authentication_config: std::option::Option<crate::model::AuthenticationConfig>,
19673
19674 /// Network configuration for workload execution.
19675 pub network: std::option::Option<crate::model::execution_config::Network>,
19676
19677 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19678}
19679
19680impl ExecutionConfig {
19681 pub fn new() -> Self {
19682 std::default::Default::default()
19683 }
19684
19685 /// Sets the value of [service_account][crate::model::ExecutionConfig::service_account].
19686 ///
19687 /// # Example
19688 /// ```ignore,no_run
19689 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19690 /// let x = ExecutionConfig::new().set_service_account("example");
19691 /// ```
19692 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19693 self.service_account = v.into();
19694 self
19695 }
19696
19697 /// Sets the value of [network_tags][crate::model::ExecutionConfig::network_tags].
19698 ///
19699 /// # Example
19700 /// ```ignore,no_run
19701 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19702 /// let x = ExecutionConfig::new().set_network_tags(["a", "b", "c"]);
19703 /// ```
19704 pub fn set_network_tags<T, V>(mut self, v: T) -> Self
19705 where
19706 T: std::iter::IntoIterator<Item = V>,
19707 V: std::convert::Into<std::string::String>,
19708 {
19709 use std::iter::Iterator;
19710 self.network_tags = v.into_iter().map(|i| i.into()).collect();
19711 self
19712 }
19713
19714 /// Sets the value of [kms_key][crate::model::ExecutionConfig::kms_key].
19715 ///
19716 /// # Example
19717 /// ```ignore,no_run
19718 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19719 /// let x = ExecutionConfig::new().set_kms_key("example");
19720 /// ```
19721 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19722 self.kms_key = v.into();
19723 self
19724 }
19725
19726 /// Sets the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
19727 ///
19728 /// # Example
19729 /// ```ignore,no_run
19730 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19731 /// use wkt::Duration;
19732 /// let x = ExecutionConfig::new().set_idle_ttl(Duration::default()/* use setters */);
19733 /// ```
19734 pub fn set_idle_ttl<T>(mut self, v: T) -> Self
19735 where
19736 T: std::convert::Into<wkt::Duration>,
19737 {
19738 self.idle_ttl = std::option::Option::Some(v.into());
19739 self
19740 }
19741
19742 /// Sets or clears the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
19743 ///
19744 /// # Example
19745 /// ```ignore,no_run
19746 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19747 /// use wkt::Duration;
19748 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(Some(Duration::default()/* use setters */));
19749 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(None::<Duration>);
19750 /// ```
19751 pub fn set_or_clear_idle_ttl<T>(mut self, v: std::option::Option<T>) -> Self
19752 where
19753 T: std::convert::Into<wkt::Duration>,
19754 {
19755 self.idle_ttl = v.map(|x| x.into());
19756 self
19757 }
19758
19759 /// Sets the value of [ttl][crate::model::ExecutionConfig::ttl].
19760 ///
19761 /// # Example
19762 /// ```ignore,no_run
19763 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19764 /// use wkt::Duration;
19765 /// let x = ExecutionConfig::new().set_ttl(Duration::default()/* use setters */);
19766 /// ```
19767 pub fn set_ttl<T>(mut self, v: T) -> Self
19768 where
19769 T: std::convert::Into<wkt::Duration>,
19770 {
19771 self.ttl = std::option::Option::Some(v.into());
19772 self
19773 }
19774
19775 /// Sets or clears the value of [ttl][crate::model::ExecutionConfig::ttl].
19776 ///
19777 /// # Example
19778 /// ```ignore,no_run
19779 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19780 /// use wkt::Duration;
19781 /// let x = ExecutionConfig::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
19782 /// let x = ExecutionConfig::new().set_or_clear_ttl(None::<Duration>);
19783 /// ```
19784 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
19785 where
19786 T: std::convert::Into<wkt::Duration>,
19787 {
19788 self.ttl = v.map(|x| x.into());
19789 self
19790 }
19791
19792 /// Sets the value of [staging_bucket][crate::model::ExecutionConfig::staging_bucket].
19793 ///
19794 /// # Example
19795 /// ```ignore,no_run
19796 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19797 /// let x = ExecutionConfig::new().set_staging_bucket("example");
19798 /// ```
19799 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19800 self.staging_bucket = v.into();
19801 self
19802 }
19803
19804 /// Sets the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
19805 ///
19806 /// # Example
19807 /// ```ignore,no_run
19808 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19809 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
19810 /// let x = ExecutionConfig::new().set_authentication_config(AuthenticationConfig::default()/* use setters */);
19811 /// ```
19812 pub fn set_authentication_config<T>(mut self, v: T) -> Self
19813 where
19814 T: std::convert::Into<crate::model::AuthenticationConfig>,
19815 {
19816 self.authentication_config = std::option::Option::Some(v.into());
19817 self
19818 }
19819
19820 /// Sets or clears the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
19821 ///
19822 /// # Example
19823 /// ```ignore,no_run
19824 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19825 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
19826 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(Some(AuthenticationConfig::default()/* use setters */));
19827 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(None::<AuthenticationConfig>);
19828 /// ```
19829 pub fn set_or_clear_authentication_config<T>(mut self, v: std::option::Option<T>) -> Self
19830 where
19831 T: std::convert::Into<crate::model::AuthenticationConfig>,
19832 {
19833 self.authentication_config = v.map(|x| x.into());
19834 self
19835 }
19836
19837 /// Sets the value of [network][crate::model::ExecutionConfig::network].
19838 ///
19839 /// Note that all the setters affecting `network` are mutually
19840 /// exclusive.
19841 ///
19842 /// # Example
19843 /// ```ignore,no_run
19844 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19845 /// use google_cloud_dataproc_v1::model::execution_config::Network;
19846 /// let x = ExecutionConfig::new().set_network(Some(Network::NetworkUri("example".to_string())));
19847 /// ```
19848 pub fn set_network<
19849 T: std::convert::Into<std::option::Option<crate::model::execution_config::Network>>,
19850 >(
19851 mut self,
19852 v: T,
19853 ) -> Self {
19854 self.network = v.into();
19855 self
19856 }
19857
19858 /// The value of [network][crate::model::ExecutionConfig::network]
19859 /// if it holds a `NetworkUri`, `None` if the field is not set or
19860 /// holds a different branch.
19861 pub fn network_uri(&self) -> std::option::Option<&std::string::String> {
19862 #[allow(unreachable_patterns)]
19863 self.network.as_ref().and_then(|v| match v {
19864 crate::model::execution_config::Network::NetworkUri(v) => std::option::Option::Some(v),
19865 _ => std::option::Option::None,
19866 })
19867 }
19868
19869 /// Sets the value of [network][crate::model::ExecutionConfig::network]
19870 /// to hold a `NetworkUri`.
19871 ///
19872 /// Note that all the setters affecting `network` are
19873 /// mutually exclusive.
19874 ///
19875 /// # Example
19876 /// ```ignore,no_run
19877 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19878 /// let x = ExecutionConfig::new().set_network_uri("example");
19879 /// assert!(x.network_uri().is_some());
19880 /// assert!(x.subnetwork_uri().is_none());
19881 /// ```
19882 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19883 self.network = std::option::Option::Some(
19884 crate::model::execution_config::Network::NetworkUri(v.into()),
19885 );
19886 self
19887 }
19888
19889 /// The value of [network][crate::model::ExecutionConfig::network]
19890 /// if it holds a `SubnetworkUri`, `None` if the field is not set or
19891 /// holds a different branch.
19892 pub fn subnetwork_uri(&self) -> std::option::Option<&std::string::String> {
19893 #[allow(unreachable_patterns)]
19894 self.network.as_ref().and_then(|v| match v {
19895 crate::model::execution_config::Network::SubnetworkUri(v) => {
19896 std::option::Option::Some(v)
19897 }
19898 _ => std::option::Option::None,
19899 })
19900 }
19901
19902 /// Sets the value of [network][crate::model::ExecutionConfig::network]
19903 /// to hold a `SubnetworkUri`.
19904 ///
19905 /// Note that all the setters affecting `network` are
19906 /// mutually exclusive.
19907 ///
19908 /// # Example
19909 /// ```ignore,no_run
19910 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19911 /// let x = ExecutionConfig::new().set_subnetwork_uri("example");
19912 /// assert!(x.subnetwork_uri().is_some());
19913 /// assert!(x.network_uri().is_none());
19914 /// ```
19915 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19916 self.network = std::option::Option::Some(
19917 crate::model::execution_config::Network::SubnetworkUri(v.into()),
19918 );
19919 self
19920 }
19921}
19922
19923impl wkt::message::Message for ExecutionConfig {
19924 fn typename() -> &'static str {
19925 "type.googleapis.com/google.cloud.dataproc.v1.ExecutionConfig"
19926 }
19927}
19928
19929/// Defines additional types related to [ExecutionConfig].
19930pub mod execution_config {
19931 #[allow(unused_imports)]
19932 use super::*;
19933
19934 /// Network configuration for workload execution.
19935 #[derive(Clone, Debug, PartialEq)]
19936 #[non_exhaustive]
19937 pub enum Network {
19938 /// Optional. Network URI to connect workload to.
19939 NetworkUri(std::string::String),
19940 /// Optional. Subnetwork URI to connect workload to.
19941 SubnetworkUri(std::string::String),
19942 }
19943}
19944
19945/// Spark History Server configuration for the workload.
19946#[derive(Clone, Default, PartialEq)]
19947#[non_exhaustive]
19948pub struct SparkHistoryServerConfig {
19949 /// Optional. Resource name of an existing Dataproc Cluster to act as a Spark
19950 /// History Server for the workload.
19951 ///
19952 /// Example:
19953 ///
19954 /// * `projects/[project_id]/regions/[region]/clusters/[cluster_name]`
19955 pub dataproc_cluster: std::string::String,
19956
19957 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19958}
19959
19960impl SparkHistoryServerConfig {
19961 pub fn new() -> Self {
19962 std::default::Default::default()
19963 }
19964
19965 /// Sets the value of [dataproc_cluster][crate::model::SparkHistoryServerConfig::dataproc_cluster].
19966 ///
19967 /// # Example
19968 /// ```ignore,no_run
19969 /// # use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
19970 /// let x = SparkHistoryServerConfig::new().set_dataproc_cluster("example");
19971 /// ```
19972 pub fn set_dataproc_cluster<T: std::convert::Into<std::string::String>>(
19973 mut self,
19974 v: T,
19975 ) -> Self {
19976 self.dataproc_cluster = v.into();
19977 self
19978 }
19979}
19980
19981impl wkt::message::Message for SparkHistoryServerConfig {
19982 fn typename() -> &'static str {
19983 "type.googleapis.com/google.cloud.dataproc.v1.SparkHistoryServerConfig"
19984 }
19985}
19986
19987/// Auxiliary services configuration for a workload.
19988#[derive(Clone, Default, PartialEq)]
19989#[non_exhaustive]
19990pub struct PeripheralsConfig {
19991 /// Optional. Resource name of an existing Dataproc Metastore service.
19992 ///
19993 /// Example:
19994 ///
19995 /// * `projects/[project_id]/locations/[region]/services/[service_id]`
19996 pub metastore_service: std::string::String,
19997
19998 /// Optional. The Spark History Server configuration for the workload.
19999 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
20000
20001 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20002}
20003
20004impl PeripheralsConfig {
20005 pub fn new() -> Self {
20006 std::default::Default::default()
20007 }
20008
20009 /// Sets the value of [metastore_service][crate::model::PeripheralsConfig::metastore_service].
20010 ///
20011 /// # Example
20012 /// ```ignore,no_run
20013 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20014 /// let x = PeripheralsConfig::new().set_metastore_service("example");
20015 /// ```
20016 pub fn set_metastore_service<T: std::convert::Into<std::string::String>>(
20017 mut self,
20018 v: T,
20019 ) -> Self {
20020 self.metastore_service = v.into();
20021 self
20022 }
20023
20024 /// Sets the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20025 ///
20026 /// # Example
20027 /// ```ignore,no_run
20028 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20029 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20030 /// let x = PeripheralsConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
20031 /// ```
20032 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
20033 where
20034 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20035 {
20036 self.spark_history_server_config = std::option::Option::Some(v.into());
20037 self
20038 }
20039
20040 /// Sets or clears the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20041 ///
20042 /// # Example
20043 /// ```ignore,no_run
20044 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20045 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20046 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
20047 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
20048 /// ```
20049 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
20050 where
20051 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20052 {
20053 self.spark_history_server_config = v.map(|x| x.into());
20054 self
20055 }
20056}
20057
20058impl wkt::message::Message for PeripheralsConfig {
20059 fn typename() -> &'static str {
20060 "type.googleapis.com/google.cloud.dataproc.v1.PeripheralsConfig"
20061 }
20062}
20063
20064/// Runtime information about workload execution.
20065#[derive(Clone, Default, PartialEq)]
20066#[non_exhaustive]
20067pub struct RuntimeInfo {
20068 /// Output only. Map of remote access endpoints (such as web interfaces and
20069 /// APIs) to their URIs.
20070 pub endpoints: std::collections::HashMap<std::string::String, std::string::String>,
20071
20072 /// Output only. A URI pointing to the location of the stdout and stderr of the
20073 /// workload.
20074 pub output_uri: std::string::String,
20075
20076 /// Output only. A URI pointing to the location of the diagnostics tarball.
20077 pub diagnostic_output_uri: std::string::String,
20078
20079 /// Output only. Approximate workload resource usage, calculated when
20080 /// the workload completes (see [Dataproc Serverless pricing]
20081 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20082 ///
20083 /// **Note:** This metric calculation may change in the future, for
20084 /// example, to capture cumulative workload resource
20085 /// consumption during workload execution (see the
20086 /// [Dataproc Serverless release notes]
20087 /// (<https://cloud.google.com/dataproc-serverless/docs/release-notes>)
20088 /// for announcements, changes, fixes
20089 /// and other Dataproc developments).
20090 pub approximate_usage: std::option::Option<crate::model::UsageMetrics>,
20091
20092 /// Output only. Snapshot of current workload resource usage.
20093 pub current_usage: std::option::Option<crate::model::UsageSnapshot>,
20094
20095 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20096}
20097
20098impl RuntimeInfo {
20099 pub fn new() -> Self {
20100 std::default::Default::default()
20101 }
20102
20103 /// Sets the value of [endpoints][crate::model::RuntimeInfo::endpoints].
20104 ///
20105 /// # Example
20106 /// ```ignore,no_run
20107 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20108 /// let x = RuntimeInfo::new().set_endpoints([
20109 /// ("key0", "abc"),
20110 /// ("key1", "xyz"),
20111 /// ]);
20112 /// ```
20113 pub fn set_endpoints<T, K, V>(mut self, v: T) -> Self
20114 where
20115 T: std::iter::IntoIterator<Item = (K, V)>,
20116 K: std::convert::Into<std::string::String>,
20117 V: std::convert::Into<std::string::String>,
20118 {
20119 use std::iter::Iterator;
20120 self.endpoints = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20121 self
20122 }
20123
20124 /// Sets the value of [output_uri][crate::model::RuntimeInfo::output_uri].
20125 ///
20126 /// # Example
20127 /// ```ignore,no_run
20128 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20129 /// let x = RuntimeInfo::new().set_output_uri("example");
20130 /// ```
20131 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20132 self.output_uri = v.into();
20133 self
20134 }
20135
20136 /// Sets the value of [diagnostic_output_uri][crate::model::RuntimeInfo::diagnostic_output_uri].
20137 ///
20138 /// # Example
20139 /// ```ignore,no_run
20140 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20141 /// let x = RuntimeInfo::new().set_diagnostic_output_uri("example");
20142 /// ```
20143 pub fn set_diagnostic_output_uri<T: std::convert::Into<std::string::String>>(
20144 mut self,
20145 v: T,
20146 ) -> Self {
20147 self.diagnostic_output_uri = v.into();
20148 self
20149 }
20150
20151 /// Sets the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20152 ///
20153 /// # Example
20154 /// ```ignore,no_run
20155 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20156 /// use google_cloud_dataproc_v1::model::UsageMetrics;
20157 /// let x = RuntimeInfo::new().set_approximate_usage(UsageMetrics::default()/* use setters */);
20158 /// ```
20159 pub fn set_approximate_usage<T>(mut self, v: T) -> Self
20160 where
20161 T: std::convert::Into<crate::model::UsageMetrics>,
20162 {
20163 self.approximate_usage = std::option::Option::Some(v.into());
20164 self
20165 }
20166
20167 /// Sets or clears the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20168 ///
20169 /// # Example
20170 /// ```ignore,no_run
20171 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20172 /// use google_cloud_dataproc_v1::model::UsageMetrics;
20173 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(Some(UsageMetrics::default()/* use setters */));
20174 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(None::<UsageMetrics>);
20175 /// ```
20176 pub fn set_or_clear_approximate_usage<T>(mut self, v: std::option::Option<T>) -> Self
20177 where
20178 T: std::convert::Into<crate::model::UsageMetrics>,
20179 {
20180 self.approximate_usage = v.map(|x| x.into());
20181 self
20182 }
20183
20184 /// Sets the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20185 ///
20186 /// # Example
20187 /// ```ignore,no_run
20188 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20189 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20190 /// let x = RuntimeInfo::new().set_current_usage(UsageSnapshot::default()/* use setters */);
20191 /// ```
20192 pub fn set_current_usage<T>(mut self, v: T) -> Self
20193 where
20194 T: std::convert::Into<crate::model::UsageSnapshot>,
20195 {
20196 self.current_usage = std::option::Option::Some(v.into());
20197 self
20198 }
20199
20200 /// Sets or clears the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20201 ///
20202 /// # Example
20203 /// ```ignore,no_run
20204 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20205 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20206 /// let x = RuntimeInfo::new().set_or_clear_current_usage(Some(UsageSnapshot::default()/* use setters */));
20207 /// let x = RuntimeInfo::new().set_or_clear_current_usage(None::<UsageSnapshot>);
20208 /// ```
20209 pub fn set_or_clear_current_usage<T>(mut self, v: std::option::Option<T>) -> Self
20210 where
20211 T: std::convert::Into<crate::model::UsageSnapshot>,
20212 {
20213 self.current_usage = v.map(|x| x.into());
20214 self
20215 }
20216}
20217
20218impl wkt::message::Message for RuntimeInfo {
20219 fn typename() -> &'static str {
20220 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeInfo"
20221 }
20222}
20223
20224/// Usage metrics represent approximate total resources consumed by a workload.
20225#[derive(Clone, Default, PartialEq)]
20226#[non_exhaustive]
20227pub struct UsageMetrics {
20228 /// Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`)
20229 /// (see [Dataproc Serverless pricing]
20230 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20231 pub milli_dcu_seconds: i64,
20232
20233 /// Optional. Shuffle storage usage in (`GB` x `seconds`) (see
20234 /// [Dataproc Serverless pricing]
20235 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20236 pub shuffle_storage_gb_seconds: i64,
20237
20238 /// Optional. Accelerator usage in (`milliAccelerator` x `seconds`) (see
20239 /// [Dataproc Serverless pricing]
20240 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20241 pub milli_accelerator_seconds: i64,
20242
20243 /// Optional. Accelerator type being used, if any
20244 pub accelerator_type: std::string::String,
20245
20246 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20247}
20248
20249impl UsageMetrics {
20250 pub fn new() -> Self {
20251 std::default::Default::default()
20252 }
20253
20254 /// Sets the value of [milli_dcu_seconds][crate::model::UsageMetrics::milli_dcu_seconds].
20255 ///
20256 /// # Example
20257 /// ```ignore,no_run
20258 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20259 /// let x = UsageMetrics::new().set_milli_dcu_seconds(42);
20260 /// ```
20261 pub fn set_milli_dcu_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20262 self.milli_dcu_seconds = v.into();
20263 self
20264 }
20265
20266 /// Sets the value of [shuffle_storage_gb_seconds][crate::model::UsageMetrics::shuffle_storage_gb_seconds].
20267 ///
20268 /// # Example
20269 /// ```ignore,no_run
20270 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20271 /// let x = UsageMetrics::new().set_shuffle_storage_gb_seconds(42);
20272 /// ```
20273 pub fn set_shuffle_storage_gb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20274 self.shuffle_storage_gb_seconds = v.into();
20275 self
20276 }
20277
20278 /// Sets the value of [milli_accelerator_seconds][crate::model::UsageMetrics::milli_accelerator_seconds].
20279 ///
20280 /// # Example
20281 /// ```ignore,no_run
20282 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20283 /// let x = UsageMetrics::new().set_milli_accelerator_seconds(42);
20284 /// ```
20285 pub fn set_milli_accelerator_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20286 self.milli_accelerator_seconds = v.into();
20287 self
20288 }
20289
20290 /// Sets the value of [accelerator_type][crate::model::UsageMetrics::accelerator_type].
20291 ///
20292 /// # Example
20293 /// ```ignore,no_run
20294 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20295 /// let x = UsageMetrics::new().set_accelerator_type("example");
20296 /// ```
20297 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
20298 mut self,
20299 v: T,
20300 ) -> Self {
20301 self.accelerator_type = v.into();
20302 self
20303 }
20304}
20305
20306impl wkt::message::Message for UsageMetrics {
20307 fn typename() -> &'static str {
20308 "type.googleapis.com/google.cloud.dataproc.v1.UsageMetrics"
20309 }
20310}
20311
20312/// The usage snapshot represents the resources consumed by a workload at a
20313/// specified time.
20314#[derive(Clone, Default, PartialEq)]
20315#[non_exhaustive]
20316pub struct UsageSnapshot {
20317 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see
20318 /// [Dataproc Serverless pricing]
20319 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20320 pub milli_dcu: i64,
20321
20322 /// Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless
20323 /// pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
20324 pub shuffle_storage_gb: i64,
20325
20326 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at
20327 /// premium tier (see [Dataproc Serverless pricing]
20328 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20329 pub milli_dcu_premium: i64,
20330
20331 /// Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see
20332 /// [Dataproc Serverless pricing]
20333 /// (<https://cloud.google.com/dataproc-serverless/pricing>))
20334 pub shuffle_storage_gb_premium: i64,
20335
20336 /// Optional. Milli (one-thousandth) accelerator. (see [Dataproc
20337 /// Serverless pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
20338 pub milli_accelerator: i64,
20339
20340 /// Optional. Accelerator type being used, if any
20341 pub accelerator_type: std::string::String,
20342
20343 /// Optional. The timestamp of the usage snapshot.
20344 pub snapshot_time: std::option::Option<wkt::Timestamp>,
20345
20346 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20347}
20348
20349impl UsageSnapshot {
20350 pub fn new() -> Self {
20351 std::default::Default::default()
20352 }
20353
20354 /// Sets the value of [milli_dcu][crate::model::UsageSnapshot::milli_dcu].
20355 ///
20356 /// # Example
20357 /// ```ignore,no_run
20358 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20359 /// let x = UsageSnapshot::new().set_milli_dcu(42);
20360 /// ```
20361 pub fn set_milli_dcu<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20362 self.milli_dcu = v.into();
20363 self
20364 }
20365
20366 /// Sets the value of [shuffle_storage_gb][crate::model::UsageSnapshot::shuffle_storage_gb].
20367 ///
20368 /// # Example
20369 /// ```ignore,no_run
20370 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20371 /// let x = UsageSnapshot::new().set_shuffle_storage_gb(42);
20372 /// ```
20373 pub fn set_shuffle_storage_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20374 self.shuffle_storage_gb = v.into();
20375 self
20376 }
20377
20378 /// Sets the value of [milli_dcu_premium][crate::model::UsageSnapshot::milli_dcu_premium].
20379 ///
20380 /// # Example
20381 /// ```ignore,no_run
20382 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20383 /// let x = UsageSnapshot::new().set_milli_dcu_premium(42);
20384 /// ```
20385 pub fn set_milli_dcu_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20386 self.milli_dcu_premium = v.into();
20387 self
20388 }
20389
20390 /// Sets the value of [shuffle_storage_gb_premium][crate::model::UsageSnapshot::shuffle_storage_gb_premium].
20391 ///
20392 /// # Example
20393 /// ```ignore,no_run
20394 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20395 /// let x = UsageSnapshot::new().set_shuffle_storage_gb_premium(42);
20396 /// ```
20397 pub fn set_shuffle_storage_gb_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20398 self.shuffle_storage_gb_premium = v.into();
20399 self
20400 }
20401
20402 /// Sets the value of [milli_accelerator][crate::model::UsageSnapshot::milli_accelerator].
20403 ///
20404 /// # Example
20405 /// ```ignore,no_run
20406 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20407 /// let x = UsageSnapshot::new().set_milli_accelerator(42);
20408 /// ```
20409 pub fn set_milli_accelerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20410 self.milli_accelerator = v.into();
20411 self
20412 }
20413
20414 /// Sets the value of [accelerator_type][crate::model::UsageSnapshot::accelerator_type].
20415 ///
20416 /// # Example
20417 /// ```ignore,no_run
20418 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20419 /// let x = UsageSnapshot::new().set_accelerator_type("example");
20420 /// ```
20421 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
20422 mut self,
20423 v: T,
20424 ) -> Self {
20425 self.accelerator_type = v.into();
20426 self
20427 }
20428
20429 /// Sets the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
20430 ///
20431 /// # Example
20432 /// ```ignore,no_run
20433 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20434 /// use wkt::Timestamp;
20435 /// let x = UsageSnapshot::new().set_snapshot_time(Timestamp::default()/* use setters */);
20436 /// ```
20437 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
20438 where
20439 T: std::convert::Into<wkt::Timestamp>,
20440 {
20441 self.snapshot_time = std::option::Option::Some(v.into());
20442 self
20443 }
20444
20445 /// Sets or clears the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
20446 ///
20447 /// # Example
20448 /// ```ignore,no_run
20449 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20450 /// use wkt::Timestamp;
20451 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
20452 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(None::<Timestamp>);
20453 /// ```
20454 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
20455 where
20456 T: std::convert::Into<wkt::Timestamp>,
20457 {
20458 self.snapshot_time = v.map(|x| x.into());
20459 self
20460 }
20461}
20462
20463impl wkt::message::Message for UsageSnapshot {
20464 fn typename() -> &'static str {
20465 "type.googleapis.com/google.cloud.dataproc.v1.UsageSnapshot"
20466 }
20467}
20468
20469/// The cluster's GKE config.
20470#[derive(Clone, Default, PartialEq)]
20471#[non_exhaustive]
20472pub struct GkeClusterConfig {
20473 /// Optional. A target GKE cluster to deploy to. It must be in the same project
20474 /// and region as the Dataproc cluster (the GKE cluster can be zonal or
20475 /// regional). Format:
20476 /// 'projects/{project}/locations/{location}/clusters/{cluster_id}'
20477 pub gke_cluster_target: std::string::String,
20478
20479 /// Optional. GKE node pools where workloads will be scheduled. At least one
20480 /// node pool must be assigned the `DEFAULT`
20481 /// [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role].
20482 /// If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT`
20483 /// `GkeNodePoolTarget`. Each role can be given to only one
20484 /// `GkeNodePoolTarget`. All node pools must have the same location settings.
20485 ///
20486 /// [google.cloud.dataproc.v1.GkeNodePoolTarget.Role]: crate::model::gke_node_pool_target::Role
20487 pub node_pool_target: std::vec::Vec<crate::model::GkeNodePoolTarget>,
20488
20489 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20490}
20491
20492impl GkeClusterConfig {
20493 pub fn new() -> Self {
20494 std::default::Default::default()
20495 }
20496
20497 /// Sets the value of [gke_cluster_target][crate::model::GkeClusterConfig::gke_cluster_target].
20498 ///
20499 /// # Example
20500 /// ```ignore,no_run
20501 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
20502 /// let x = GkeClusterConfig::new().set_gke_cluster_target("example");
20503 /// ```
20504 pub fn set_gke_cluster_target<T: std::convert::Into<std::string::String>>(
20505 mut self,
20506 v: T,
20507 ) -> Self {
20508 self.gke_cluster_target = v.into();
20509 self
20510 }
20511
20512 /// Sets the value of [node_pool_target][crate::model::GkeClusterConfig::node_pool_target].
20513 ///
20514 /// # Example
20515 /// ```ignore,no_run
20516 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
20517 /// use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20518 /// let x = GkeClusterConfig::new()
20519 /// .set_node_pool_target([
20520 /// GkeNodePoolTarget::default()/* use setters */,
20521 /// GkeNodePoolTarget::default()/* use (different) setters */,
20522 /// ]);
20523 /// ```
20524 pub fn set_node_pool_target<T, V>(mut self, v: T) -> Self
20525 where
20526 T: std::iter::IntoIterator<Item = V>,
20527 V: std::convert::Into<crate::model::GkeNodePoolTarget>,
20528 {
20529 use std::iter::Iterator;
20530 self.node_pool_target = v.into_iter().map(|i| i.into()).collect();
20531 self
20532 }
20533}
20534
20535impl wkt::message::Message for GkeClusterConfig {
20536 fn typename() -> &'static str {
20537 "type.googleapis.com/google.cloud.dataproc.v1.GkeClusterConfig"
20538 }
20539}
20540
20541/// The configuration for running the Dataproc cluster on Kubernetes.
20542#[derive(Clone, Default, PartialEq)]
20543#[non_exhaustive]
20544pub struct KubernetesClusterConfig {
20545 /// Optional. A namespace within the Kubernetes cluster to deploy into. If this
20546 /// namespace does not exist, it is created. If it exists, Dataproc verifies
20547 /// that another Dataproc VirtualCluster is not installed into it. If not
20548 /// specified, the name of the Dataproc Cluster is used.
20549 pub kubernetes_namespace: std::string::String,
20550
20551 /// Optional. The software configuration for this Dataproc cluster running on
20552 /// Kubernetes.
20553 pub kubernetes_software_config: std::option::Option<crate::model::KubernetesSoftwareConfig>,
20554
20555 pub config: std::option::Option<crate::model::kubernetes_cluster_config::Config>,
20556
20557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20558}
20559
20560impl KubernetesClusterConfig {
20561 pub fn new() -> Self {
20562 std::default::Default::default()
20563 }
20564
20565 /// Sets the value of [kubernetes_namespace][crate::model::KubernetesClusterConfig::kubernetes_namespace].
20566 ///
20567 /// # Example
20568 /// ```ignore,no_run
20569 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20570 /// let x = KubernetesClusterConfig::new().set_kubernetes_namespace("example");
20571 /// ```
20572 pub fn set_kubernetes_namespace<T: std::convert::Into<std::string::String>>(
20573 mut self,
20574 v: T,
20575 ) -> Self {
20576 self.kubernetes_namespace = v.into();
20577 self
20578 }
20579
20580 /// Sets the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
20581 ///
20582 /// # Example
20583 /// ```ignore,no_run
20584 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20585 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20586 /// let x = KubernetesClusterConfig::new().set_kubernetes_software_config(KubernetesSoftwareConfig::default()/* use setters */);
20587 /// ```
20588 pub fn set_kubernetes_software_config<T>(mut self, v: T) -> Self
20589 where
20590 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
20591 {
20592 self.kubernetes_software_config = std::option::Option::Some(v.into());
20593 self
20594 }
20595
20596 /// Sets or clears the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
20597 ///
20598 /// # Example
20599 /// ```ignore,no_run
20600 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20601 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20602 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(Some(KubernetesSoftwareConfig::default()/* use setters */));
20603 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(None::<KubernetesSoftwareConfig>);
20604 /// ```
20605 pub fn set_or_clear_kubernetes_software_config<T>(mut self, v: std::option::Option<T>) -> Self
20606 where
20607 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
20608 {
20609 self.kubernetes_software_config = v.map(|x| x.into());
20610 self
20611 }
20612
20613 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config].
20614 ///
20615 /// Note that all the setters affecting `config` are mutually
20616 /// exclusive.
20617 ///
20618 /// # Example
20619 /// ```ignore,no_run
20620 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20621 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
20622 /// let x = KubernetesClusterConfig::new().set_config(Some(
20623 /// google_cloud_dataproc_v1::model::kubernetes_cluster_config::Config::GkeClusterConfig(GkeClusterConfig::default().into())));
20624 /// ```
20625 pub fn set_config<
20626 T: std::convert::Into<std::option::Option<crate::model::kubernetes_cluster_config::Config>>,
20627 >(
20628 mut self,
20629 v: T,
20630 ) -> Self {
20631 self.config = v.into();
20632 self
20633 }
20634
20635 /// The value of [config][crate::model::KubernetesClusterConfig::config]
20636 /// if it holds a `GkeClusterConfig`, `None` if the field is not set or
20637 /// holds a different branch.
20638 pub fn gke_cluster_config(
20639 &self,
20640 ) -> std::option::Option<&std::boxed::Box<crate::model::GkeClusterConfig>> {
20641 #[allow(unreachable_patterns)]
20642 self.config.as_ref().and_then(|v| match v {
20643 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v) => {
20644 std::option::Option::Some(v)
20645 }
20646 _ => std::option::Option::None,
20647 })
20648 }
20649
20650 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config]
20651 /// to hold a `GkeClusterConfig`.
20652 ///
20653 /// Note that all the setters affecting `config` are
20654 /// mutually exclusive.
20655 ///
20656 /// # Example
20657 /// ```ignore,no_run
20658 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20659 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
20660 /// let x = KubernetesClusterConfig::new().set_gke_cluster_config(GkeClusterConfig::default()/* use setters */);
20661 /// assert!(x.gke_cluster_config().is_some());
20662 /// ```
20663 pub fn set_gke_cluster_config<
20664 T: std::convert::Into<std::boxed::Box<crate::model::GkeClusterConfig>>,
20665 >(
20666 mut self,
20667 v: T,
20668 ) -> Self {
20669 self.config = std::option::Option::Some(
20670 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v.into()),
20671 );
20672 self
20673 }
20674}
20675
20676impl wkt::message::Message for KubernetesClusterConfig {
20677 fn typename() -> &'static str {
20678 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesClusterConfig"
20679 }
20680}
20681
20682/// Defines additional types related to [KubernetesClusterConfig].
20683pub mod kubernetes_cluster_config {
20684 #[allow(unused_imports)]
20685 use super::*;
20686
20687 #[derive(Clone, Debug, PartialEq)]
20688 #[non_exhaustive]
20689 pub enum Config {
20690 /// Required. The configuration for running the Dataproc cluster on GKE.
20691 GkeClusterConfig(std::boxed::Box<crate::model::GkeClusterConfig>),
20692 }
20693}
20694
20695/// The software configuration for this Dataproc cluster running on Kubernetes.
20696#[derive(Clone, Default, PartialEq)]
20697#[non_exhaustive]
20698pub struct KubernetesSoftwareConfig {
20699 /// The components that should be installed in this Dataproc cluster. The key
20700 /// must be a string from the KubernetesComponent enumeration. The value is
20701 /// the version of the software to be installed.
20702 /// At least one entry must be specified.
20703 pub component_version: std::collections::HashMap<std::string::String, std::string::String>,
20704
20705 /// The properties to set on daemon config files.
20706 ///
20707 /// Property keys are specified in `prefix:property` format, for example
20708 /// `spark:spark.kubernetes.container.image`. The following are supported
20709 /// prefixes and their mappings:
20710 ///
20711 /// * spark: `spark-defaults.conf`
20712 ///
20713 /// For more information, see [Cluster
20714 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
20715 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
20716
20717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20718}
20719
20720impl KubernetesSoftwareConfig {
20721 pub fn new() -> Self {
20722 std::default::Default::default()
20723 }
20724
20725 /// Sets the value of [component_version][crate::model::KubernetesSoftwareConfig::component_version].
20726 ///
20727 /// # Example
20728 /// ```ignore,no_run
20729 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20730 /// let x = KubernetesSoftwareConfig::new().set_component_version([
20731 /// ("key0", "abc"),
20732 /// ("key1", "xyz"),
20733 /// ]);
20734 /// ```
20735 pub fn set_component_version<T, K, V>(mut self, v: T) -> Self
20736 where
20737 T: std::iter::IntoIterator<Item = (K, V)>,
20738 K: std::convert::Into<std::string::String>,
20739 V: std::convert::Into<std::string::String>,
20740 {
20741 use std::iter::Iterator;
20742 self.component_version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20743 self
20744 }
20745
20746 /// Sets the value of [properties][crate::model::KubernetesSoftwareConfig::properties].
20747 ///
20748 /// # Example
20749 /// ```ignore,no_run
20750 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20751 /// let x = KubernetesSoftwareConfig::new().set_properties([
20752 /// ("key0", "abc"),
20753 /// ("key1", "xyz"),
20754 /// ]);
20755 /// ```
20756 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
20757 where
20758 T: std::iter::IntoIterator<Item = (K, V)>,
20759 K: std::convert::Into<std::string::String>,
20760 V: std::convert::Into<std::string::String>,
20761 {
20762 use std::iter::Iterator;
20763 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20764 self
20765 }
20766}
20767
20768impl wkt::message::Message for KubernetesSoftwareConfig {
20769 fn typename() -> &'static str {
20770 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesSoftwareConfig"
20771 }
20772}
20773
20774/// GKE node pools that Dataproc workloads run on.
20775#[derive(Clone, Default, PartialEq)]
20776#[non_exhaustive]
20777pub struct GkeNodePoolTarget {
20778 /// Required. The target GKE node pool.
20779 /// Format:
20780 /// 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}'
20781 pub node_pool: std::string::String,
20782
20783 /// Required. The roles associated with the GKE node pool.
20784 pub roles: std::vec::Vec<crate::model::gke_node_pool_target::Role>,
20785
20786 /// Input only. The configuration for the GKE node pool.
20787 ///
20788 /// If specified, Dataproc attempts to create a node pool with the
20789 /// specified shape. If one with the same name already exists, it is
20790 /// verified against all specified fields. If a field differs, the
20791 /// virtual cluster creation will fail.
20792 ///
20793 /// If omitted, any node pool with the specified name is used. If a
20794 /// node pool with the specified name does not exist, Dataproc create a
20795 /// node pool with default values.
20796 ///
20797 /// This is an input only field. It will not be returned by the API.
20798 pub node_pool_config: std::option::Option<crate::model::GkeNodePoolConfig>,
20799
20800 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20801}
20802
20803impl GkeNodePoolTarget {
20804 pub fn new() -> Self {
20805 std::default::Default::default()
20806 }
20807
20808 /// Sets the value of [node_pool][crate::model::GkeNodePoolTarget::node_pool].
20809 ///
20810 /// # Example
20811 /// ```ignore,no_run
20812 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20813 /// let x = GkeNodePoolTarget::new().set_node_pool("example");
20814 /// ```
20815 pub fn set_node_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20816 self.node_pool = v.into();
20817 self
20818 }
20819
20820 /// Sets the value of [roles][crate::model::GkeNodePoolTarget::roles].
20821 ///
20822 /// # Example
20823 /// ```ignore,no_run
20824 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20825 /// use google_cloud_dataproc_v1::model::gke_node_pool_target::Role;
20826 /// let x = GkeNodePoolTarget::new().set_roles([
20827 /// Role::Default,
20828 /// Role::Controller,
20829 /// Role::SparkDriver,
20830 /// ]);
20831 /// ```
20832 pub fn set_roles<T, V>(mut self, v: T) -> Self
20833 where
20834 T: std::iter::IntoIterator<Item = V>,
20835 V: std::convert::Into<crate::model::gke_node_pool_target::Role>,
20836 {
20837 use std::iter::Iterator;
20838 self.roles = v.into_iter().map(|i| i.into()).collect();
20839 self
20840 }
20841
20842 /// Sets the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
20843 ///
20844 /// # Example
20845 /// ```ignore,no_run
20846 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20847 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
20848 /// let x = GkeNodePoolTarget::new().set_node_pool_config(GkeNodePoolConfig::default()/* use setters */);
20849 /// ```
20850 pub fn set_node_pool_config<T>(mut self, v: T) -> Self
20851 where
20852 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
20853 {
20854 self.node_pool_config = std::option::Option::Some(v.into());
20855 self
20856 }
20857
20858 /// Sets or clears the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
20859 ///
20860 /// # Example
20861 /// ```ignore,no_run
20862 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20863 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
20864 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(Some(GkeNodePoolConfig::default()/* use setters */));
20865 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(None::<GkeNodePoolConfig>);
20866 /// ```
20867 pub fn set_or_clear_node_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
20868 where
20869 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
20870 {
20871 self.node_pool_config = v.map(|x| x.into());
20872 self
20873 }
20874}
20875
20876impl wkt::message::Message for GkeNodePoolTarget {
20877 fn typename() -> &'static str {
20878 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolTarget"
20879 }
20880}
20881
20882/// Defines additional types related to [GkeNodePoolTarget].
20883pub mod gke_node_pool_target {
20884 #[allow(unused_imports)]
20885 use super::*;
20886
20887 /// `Role` specifies the tasks that will run on the node pool. Roles can be
20888 /// specific to workloads. Exactly one
20889 /// [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the
20890 /// virtual cluster must have the `DEFAULT` role, which is used to run all
20891 /// workloads that are not associated with a node pool.
20892 ///
20893 /// [google.cloud.dataproc.v1.GkeNodePoolTarget]: crate::model::GkeNodePoolTarget
20894 ///
20895 /// # Working with unknown values
20896 ///
20897 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20898 /// additional enum variants at any time. Adding new variants is not considered
20899 /// a breaking change. Applications should write their code in anticipation of:
20900 ///
20901 /// - New values appearing in future releases of the client library, **and**
20902 /// - New values received dynamically, without application changes.
20903 ///
20904 /// Please consult the [Working with enums] section in the user guide for some
20905 /// guidelines.
20906 ///
20907 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20908 #[derive(Clone, Debug, PartialEq)]
20909 #[non_exhaustive]
20910 pub enum Role {
20911 /// Role is unspecified.
20912 Unspecified,
20913 /// At least one node pool must have the `DEFAULT` role.
20914 /// Work assigned to a role that is not associated with a node pool
20915 /// is assigned to the node pool with the `DEFAULT` role. For example,
20916 /// work assigned to the `CONTROLLER` role will be assigned to the node pool
20917 /// with the `DEFAULT` role if no node pool has the `CONTROLLER` role.
20918 Default,
20919 /// Run work associated with the Dataproc control plane (for example,
20920 /// controllers and webhooks). Very low resource requirements.
20921 Controller,
20922 /// Run work associated with a Spark driver of a job.
20923 SparkDriver,
20924 /// Run work associated with a Spark executor of a job.
20925 SparkExecutor,
20926 /// If set, the enum was initialized with an unknown value.
20927 ///
20928 /// Applications can examine the value using [Role::value] or
20929 /// [Role::name].
20930 UnknownValue(role::UnknownValue),
20931 }
20932
20933 #[doc(hidden)]
20934 pub mod role {
20935 #[allow(unused_imports)]
20936 use super::*;
20937 #[derive(Clone, Debug, PartialEq)]
20938 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20939 }
20940
20941 impl Role {
20942 /// Gets the enum value.
20943 ///
20944 /// Returns `None` if the enum contains an unknown value deserialized from
20945 /// the string representation of enums.
20946 pub fn value(&self) -> std::option::Option<i32> {
20947 match self {
20948 Self::Unspecified => std::option::Option::Some(0),
20949 Self::Default => std::option::Option::Some(1),
20950 Self::Controller => std::option::Option::Some(2),
20951 Self::SparkDriver => std::option::Option::Some(3),
20952 Self::SparkExecutor => std::option::Option::Some(4),
20953 Self::UnknownValue(u) => u.0.value(),
20954 }
20955 }
20956
20957 /// Gets the enum value as a string.
20958 ///
20959 /// Returns `None` if the enum contains an unknown value deserialized from
20960 /// the integer representation of enums.
20961 pub fn name(&self) -> std::option::Option<&str> {
20962 match self {
20963 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
20964 Self::Default => std::option::Option::Some("DEFAULT"),
20965 Self::Controller => std::option::Option::Some("CONTROLLER"),
20966 Self::SparkDriver => std::option::Option::Some("SPARK_DRIVER"),
20967 Self::SparkExecutor => std::option::Option::Some("SPARK_EXECUTOR"),
20968 Self::UnknownValue(u) => u.0.name(),
20969 }
20970 }
20971 }
20972
20973 impl std::default::Default for Role {
20974 fn default() -> Self {
20975 use std::convert::From;
20976 Self::from(0)
20977 }
20978 }
20979
20980 impl std::fmt::Display for Role {
20981 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20982 wkt::internal::display_enum(f, self.name(), self.value())
20983 }
20984 }
20985
20986 impl std::convert::From<i32> for Role {
20987 fn from(value: i32) -> Self {
20988 match value {
20989 0 => Self::Unspecified,
20990 1 => Self::Default,
20991 2 => Self::Controller,
20992 3 => Self::SparkDriver,
20993 4 => Self::SparkExecutor,
20994 _ => Self::UnknownValue(role::UnknownValue(
20995 wkt::internal::UnknownEnumValue::Integer(value),
20996 )),
20997 }
20998 }
20999 }
21000
21001 impl std::convert::From<&str> for Role {
21002 fn from(value: &str) -> Self {
21003 use std::string::ToString;
21004 match value {
21005 "ROLE_UNSPECIFIED" => Self::Unspecified,
21006 "DEFAULT" => Self::Default,
21007 "CONTROLLER" => Self::Controller,
21008 "SPARK_DRIVER" => Self::SparkDriver,
21009 "SPARK_EXECUTOR" => Self::SparkExecutor,
21010 _ => Self::UnknownValue(role::UnknownValue(
21011 wkt::internal::UnknownEnumValue::String(value.to_string()),
21012 )),
21013 }
21014 }
21015 }
21016
21017 impl serde::ser::Serialize for Role {
21018 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21019 where
21020 S: serde::Serializer,
21021 {
21022 match self {
21023 Self::Unspecified => serializer.serialize_i32(0),
21024 Self::Default => serializer.serialize_i32(1),
21025 Self::Controller => serializer.serialize_i32(2),
21026 Self::SparkDriver => serializer.serialize_i32(3),
21027 Self::SparkExecutor => serializer.serialize_i32(4),
21028 Self::UnknownValue(u) => u.0.serialize(serializer),
21029 }
21030 }
21031 }
21032
21033 impl<'de> serde::de::Deserialize<'de> for Role {
21034 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21035 where
21036 D: serde::Deserializer<'de>,
21037 {
21038 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
21039 ".google.cloud.dataproc.v1.GkeNodePoolTarget.Role",
21040 ))
21041 }
21042 }
21043}
21044
21045/// The configuration of a GKE node pool used by a [Dataproc-on-GKE
21046/// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster).
21047#[derive(Clone, Default, PartialEq)]
21048#[non_exhaustive]
21049pub struct GkeNodePoolConfig {
21050 /// Optional. The node pool configuration.
21051 pub config: std::option::Option<crate::model::gke_node_pool_config::GkeNodeConfig>,
21052
21053 /// Optional. The list of Compute Engine
21054 /// [zones](https://cloud.google.com/compute/docs/zones#available) where
21055 /// node pool nodes associated with a Dataproc on GKE virtual cluster
21056 /// will be located.
21057 ///
21058 /// **Note:** All node pools associated with a virtual cluster
21059 /// must be located in the same region as the virtual cluster, and they must
21060 /// be located in the same zone within that region.
21061 ///
21062 /// If a location is not specified during node pool creation, Dataproc on GKE
21063 /// will choose the zone.
21064 pub locations: std::vec::Vec<std::string::String>,
21065
21066 /// Optional. The autoscaler configuration for this node pool. The autoscaler
21067 /// is enabled only when a valid configuration is present.
21068 pub autoscaling:
21069 std::option::Option<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21070
21071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21072}
21073
21074impl GkeNodePoolConfig {
21075 pub fn new() -> Self {
21076 std::default::Default::default()
21077 }
21078
21079 /// Sets the value of [config][crate::model::GkeNodePoolConfig::config].
21080 ///
21081 /// # Example
21082 /// ```ignore,no_run
21083 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21084 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21085 /// let x = GkeNodePoolConfig::new().set_config(GkeNodeConfig::default()/* use setters */);
21086 /// ```
21087 pub fn set_config<T>(mut self, v: T) -> Self
21088 where
21089 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21090 {
21091 self.config = std::option::Option::Some(v.into());
21092 self
21093 }
21094
21095 /// Sets or clears the value of [config][crate::model::GkeNodePoolConfig::config].
21096 ///
21097 /// # Example
21098 /// ```ignore,no_run
21099 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21100 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21101 /// let x = GkeNodePoolConfig::new().set_or_clear_config(Some(GkeNodeConfig::default()/* use setters */));
21102 /// let x = GkeNodePoolConfig::new().set_or_clear_config(None::<GkeNodeConfig>);
21103 /// ```
21104 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
21105 where
21106 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21107 {
21108 self.config = v.map(|x| x.into());
21109 self
21110 }
21111
21112 /// Sets the value of [locations][crate::model::GkeNodePoolConfig::locations].
21113 ///
21114 /// # Example
21115 /// ```ignore,no_run
21116 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21117 /// let x = GkeNodePoolConfig::new().set_locations(["a", "b", "c"]);
21118 /// ```
21119 pub fn set_locations<T, V>(mut self, v: T) -> Self
21120 where
21121 T: std::iter::IntoIterator<Item = V>,
21122 V: std::convert::Into<std::string::String>,
21123 {
21124 use std::iter::Iterator;
21125 self.locations = v.into_iter().map(|i| i.into()).collect();
21126 self
21127 }
21128
21129 /// Sets the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21130 ///
21131 /// # Example
21132 /// ```ignore,no_run
21133 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21134 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21135 /// let x = GkeNodePoolConfig::new().set_autoscaling(GkeNodePoolAutoscalingConfig::default()/* use setters */);
21136 /// ```
21137 pub fn set_autoscaling<T>(mut self, v: T) -> Self
21138 where
21139 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21140 {
21141 self.autoscaling = std::option::Option::Some(v.into());
21142 self
21143 }
21144
21145 /// Sets or clears the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21146 ///
21147 /// # Example
21148 /// ```ignore,no_run
21149 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21150 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21151 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(Some(GkeNodePoolAutoscalingConfig::default()/* use setters */));
21152 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(None::<GkeNodePoolAutoscalingConfig>);
21153 /// ```
21154 pub fn set_or_clear_autoscaling<T>(mut self, v: std::option::Option<T>) -> Self
21155 where
21156 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21157 {
21158 self.autoscaling = v.map(|x| x.into());
21159 self
21160 }
21161}
21162
21163impl wkt::message::Message for GkeNodePoolConfig {
21164 fn typename() -> &'static str {
21165 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig"
21166 }
21167}
21168
21169/// Defines additional types related to [GkeNodePoolConfig].
21170pub mod gke_node_pool_config {
21171 #[allow(unused_imports)]
21172 use super::*;
21173
21174 /// Parameters that describe cluster nodes.
21175 #[derive(Clone, Default, PartialEq)]
21176 #[non_exhaustive]
21177 pub struct GkeNodeConfig {
21178 /// Optional. The name of a Compute Engine [machine
21179 /// type](https://cloud.google.com/compute/docs/machine-types).
21180 pub machine_type: std::string::String,
21181
21182 /// Optional. The number of local SSD disks to attach to the node, which is
21183 /// limited by the maximum number of disks allowable per zone (see [Adding
21184 /// Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)).
21185 pub local_ssd_count: i32,
21186
21187 /// Optional. Whether the nodes are created as legacy [preemptible VM
21188 /// instances] (<https://cloud.google.com/compute/docs/instances/preemptible>).
21189 /// Also see
21190 /// [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]
21191 /// VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot
21192 /// preemptible nodes cannot be used in a node pool with the `CONTROLLER`
21193 /// [role]
21194 /// (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21195 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21196 /// DEFAULT node pool will assume the CONTROLLER role).
21197 ///
21198 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]: crate::model::gke_node_pool_config::GkeNodeConfig::spot
21199 pub preemptible: bool,
21200
21201 /// Optional. A list of [hardware
21202 /// accelerators](https://cloud.google.com/compute/docs/gpus) to attach to
21203 /// each node.
21204 pub accelerators:
21205 std::vec::Vec<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21206
21207 /// Optional. [Minimum CPU
21208 /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
21209 /// to be used by this instance. The instance may be scheduled on the
21210 /// specified or a newer CPU platform. Specify the friendly names of CPU
21211 /// platforms, such as "Intel Haswell"` or Intel Sandy Bridge".
21212 pub min_cpu_platform: std::string::String,
21213
21214 /// Optional. The [Customer Managed Encryption Key (CMEK)]
21215 /// (<https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek>)
21216 /// used to encrypt the boot disk attached to each node in the node pool.
21217 /// Specify the key using the following format:
21218 /// \<code\>projects/\<var\>KEY_PROJECT_ID\</var\>/locations/\<var\>LOCATION\</var\>/keyRings/\<var\>RING_NAME\</var\>/cryptoKeys/\<var\>KEY_NAME\</var\>\</code\>.
21219 pub boot_disk_kms_key: std::string::String,
21220
21221 /// Optional. Whether the nodes are created as [Spot VM instances]
21222 /// (<https://cloud.google.com/compute/docs/instances/spot>).
21223 /// Spot VMs are the latest update to legacy
21224 /// [preemptible
21225 /// VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible].
21226 /// Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible
21227 /// nodes cannot be used in a node pool with the `CONTROLLER`
21228 /// [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21229 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21230 /// DEFAULT node pool will assume the CONTROLLER role).
21231 ///
21232 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]: crate::model::gke_node_pool_config::GkeNodeConfig::preemptible
21233 pub spot: bool,
21234
21235 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21236 }
21237
21238 impl GkeNodeConfig {
21239 pub fn new() -> Self {
21240 std::default::Default::default()
21241 }
21242
21243 /// Sets the value of [machine_type][crate::model::gke_node_pool_config::GkeNodeConfig::machine_type].
21244 ///
21245 /// # Example
21246 /// ```ignore,no_run
21247 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21248 /// let x = GkeNodeConfig::new().set_machine_type("example");
21249 /// ```
21250 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
21251 mut self,
21252 v: T,
21253 ) -> Self {
21254 self.machine_type = v.into();
21255 self
21256 }
21257
21258 /// Sets the value of [local_ssd_count][crate::model::gke_node_pool_config::GkeNodeConfig::local_ssd_count].
21259 ///
21260 /// # Example
21261 /// ```ignore,no_run
21262 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21263 /// let x = GkeNodeConfig::new().set_local_ssd_count(42);
21264 /// ```
21265 pub fn set_local_ssd_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21266 self.local_ssd_count = v.into();
21267 self
21268 }
21269
21270 /// Sets the value of [preemptible][crate::model::gke_node_pool_config::GkeNodeConfig::preemptible].
21271 ///
21272 /// # Example
21273 /// ```ignore,no_run
21274 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21275 /// let x = GkeNodeConfig::new().set_preemptible(true);
21276 /// ```
21277 pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21278 self.preemptible = v.into();
21279 self
21280 }
21281
21282 /// Sets the value of [accelerators][crate::model::gke_node_pool_config::GkeNodeConfig::accelerators].
21283 ///
21284 /// # Example
21285 /// ```ignore,no_run
21286 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21287 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21288 /// let x = GkeNodeConfig::new()
21289 /// .set_accelerators([
21290 /// GkeNodePoolAcceleratorConfig::default()/* use setters */,
21291 /// GkeNodePoolAcceleratorConfig::default()/* use (different) setters */,
21292 /// ]);
21293 /// ```
21294 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
21295 where
21296 T: std::iter::IntoIterator<Item = V>,
21297 V: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21298 {
21299 use std::iter::Iterator;
21300 self.accelerators = v.into_iter().map(|i| i.into()).collect();
21301 self
21302 }
21303
21304 /// Sets the value of [min_cpu_platform][crate::model::gke_node_pool_config::GkeNodeConfig::min_cpu_platform].
21305 ///
21306 /// # Example
21307 /// ```ignore,no_run
21308 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21309 /// let x = GkeNodeConfig::new().set_min_cpu_platform("example");
21310 /// ```
21311 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
21312 mut self,
21313 v: T,
21314 ) -> Self {
21315 self.min_cpu_platform = v.into();
21316 self
21317 }
21318
21319 /// Sets the value of [boot_disk_kms_key][crate::model::gke_node_pool_config::GkeNodeConfig::boot_disk_kms_key].
21320 ///
21321 /// # Example
21322 /// ```ignore,no_run
21323 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21324 /// let x = GkeNodeConfig::new().set_boot_disk_kms_key("example");
21325 /// ```
21326 pub fn set_boot_disk_kms_key<T: std::convert::Into<std::string::String>>(
21327 mut self,
21328 v: T,
21329 ) -> Self {
21330 self.boot_disk_kms_key = v.into();
21331 self
21332 }
21333
21334 /// Sets the value of [spot][crate::model::gke_node_pool_config::GkeNodeConfig::spot].
21335 ///
21336 /// # Example
21337 /// ```ignore,no_run
21338 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21339 /// let x = GkeNodeConfig::new().set_spot(true);
21340 /// ```
21341 pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21342 self.spot = v.into();
21343 self
21344 }
21345 }
21346
21347 impl wkt::message::Message for GkeNodeConfig {
21348 fn typename() -> &'static str {
21349 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig"
21350 }
21351 }
21352
21353 /// A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request
21354 /// for a node pool.
21355 #[derive(Clone, Default, PartialEq)]
21356 #[non_exhaustive]
21357 pub struct GkeNodePoolAcceleratorConfig {
21358 /// The number of accelerator cards exposed to an instance.
21359 pub accelerator_count: i64,
21360
21361 /// The accelerator type resource namename (see GPUs on Compute Engine).
21362 pub accelerator_type: std::string::String,
21363
21364 /// Size of partitions to create on the GPU. Valid values are described in
21365 /// the NVIDIA [mig user
21366 /// guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
21367 pub gpu_partition_size: std::string::String,
21368
21369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21370 }
21371
21372 impl GkeNodePoolAcceleratorConfig {
21373 pub fn new() -> Self {
21374 std::default::Default::default()
21375 }
21376
21377 /// Sets the value of [accelerator_count][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_count].
21378 ///
21379 /// # Example
21380 /// ```ignore,no_run
21381 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21382 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_count(42);
21383 /// ```
21384 pub fn set_accelerator_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21385 self.accelerator_count = v.into();
21386 self
21387 }
21388
21389 /// Sets the value of [accelerator_type][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_type].
21390 ///
21391 /// # Example
21392 /// ```ignore,no_run
21393 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21394 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_type("example");
21395 /// ```
21396 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21397 mut self,
21398 v: T,
21399 ) -> Self {
21400 self.accelerator_type = v.into();
21401 self
21402 }
21403
21404 /// Sets the value of [gpu_partition_size][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::gpu_partition_size].
21405 ///
21406 /// # Example
21407 /// ```ignore,no_run
21408 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21409 /// let x = GkeNodePoolAcceleratorConfig::new().set_gpu_partition_size("example");
21410 /// ```
21411 pub fn set_gpu_partition_size<T: std::convert::Into<std::string::String>>(
21412 mut self,
21413 v: T,
21414 ) -> Self {
21415 self.gpu_partition_size = v.into();
21416 self
21417 }
21418 }
21419
21420 impl wkt::message::Message for GkeNodePoolAcceleratorConfig {
21421 fn typename() -> &'static str {
21422 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAcceleratorConfig"
21423 }
21424 }
21425
21426 /// GkeNodePoolAutoscaling contains information the cluster autoscaler needs to
21427 /// adjust the size of the node pool to the current cluster usage.
21428 #[derive(Clone, Default, PartialEq)]
21429 #[non_exhaustive]
21430 pub struct GkeNodePoolAutoscalingConfig {
21431 /// The minimum number of nodes in the node pool. Must be >= 0 and <=
21432 /// max_node_count.
21433 pub min_node_count: i32,
21434
21435 /// The maximum number of nodes in the node pool. Must be >= min_node_count,
21436 /// and must be > 0.
21437 /// **Note:** Quota must be sufficient to scale up the cluster.
21438 pub max_node_count: i32,
21439
21440 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21441 }
21442
21443 impl GkeNodePoolAutoscalingConfig {
21444 pub fn new() -> Self {
21445 std::default::Default::default()
21446 }
21447
21448 /// Sets the value of [min_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::min_node_count].
21449 ///
21450 /// # Example
21451 /// ```ignore,no_run
21452 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21453 /// let x = GkeNodePoolAutoscalingConfig::new().set_min_node_count(42);
21454 /// ```
21455 pub fn set_min_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21456 self.min_node_count = v.into();
21457 self
21458 }
21459
21460 /// Sets the value of [max_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::max_node_count].
21461 ///
21462 /// # Example
21463 /// ```ignore,no_run
21464 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21465 /// let x = GkeNodePoolAutoscalingConfig::new().set_max_node_count(42);
21466 /// ```
21467 pub fn set_max_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21468 self.max_node_count = v.into();
21469 self
21470 }
21471 }
21472
21473 impl wkt::message::Message for GkeNodePoolAutoscalingConfig {
21474 fn typename() -> &'static str {
21475 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAutoscalingConfig"
21476 }
21477 }
21478}
21479
21480/// Authentication configuration for a workload is used to set the default
21481/// identity for the workload execution.
21482/// The config specifies the type of identity (service account or user) that
21483/// will be used by workloads to access resources on the project(s).
21484#[derive(Clone, Default, PartialEq)]
21485#[non_exhaustive]
21486pub struct AuthenticationConfig {
21487 /// Optional. Authentication type for the user workload running in containers.
21488 pub user_workload_authentication_type: crate::model::authentication_config::AuthenticationType,
21489
21490 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21491}
21492
21493impl AuthenticationConfig {
21494 pub fn new() -> Self {
21495 std::default::Default::default()
21496 }
21497
21498 /// Sets the value of [user_workload_authentication_type][crate::model::AuthenticationConfig::user_workload_authentication_type].
21499 ///
21500 /// # Example
21501 /// ```ignore,no_run
21502 /// # use google_cloud_dataproc_v1::model::AuthenticationConfig;
21503 /// use google_cloud_dataproc_v1::model::authentication_config::AuthenticationType;
21504 /// let x0 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::ServiceAccount);
21505 /// let x1 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::EndUserCredentials);
21506 /// ```
21507 pub fn set_user_workload_authentication_type<
21508 T: std::convert::Into<crate::model::authentication_config::AuthenticationType>,
21509 >(
21510 mut self,
21511 v: T,
21512 ) -> Self {
21513 self.user_workload_authentication_type = v.into();
21514 self
21515 }
21516}
21517
21518impl wkt::message::Message for AuthenticationConfig {
21519 fn typename() -> &'static str {
21520 "type.googleapis.com/google.cloud.dataproc.v1.AuthenticationConfig"
21521 }
21522}
21523
21524/// Defines additional types related to [AuthenticationConfig].
21525pub mod authentication_config {
21526 #[allow(unused_imports)]
21527 use super::*;
21528
21529 /// Authentication types for workload execution.
21530 ///
21531 /// # Working with unknown values
21532 ///
21533 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21534 /// additional enum variants at any time. Adding new variants is not considered
21535 /// a breaking change. Applications should write their code in anticipation of:
21536 ///
21537 /// - New values appearing in future releases of the client library, **and**
21538 /// - New values received dynamically, without application changes.
21539 ///
21540 /// Please consult the [Working with enums] section in the user guide for some
21541 /// guidelines.
21542 ///
21543 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21544 #[derive(Clone, Debug, PartialEq)]
21545 #[non_exhaustive]
21546 pub enum AuthenticationType {
21547 /// If AuthenticationType is unspecified then END_USER_CREDENTIALS is used
21548 /// for 3.0 and newer runtimes, and SERVICE_ACCOUNT is used for older
21549 /// runtimes.
21550 Unspecified,
21551 /// Use service account credentials for authenticating to other services.
21552 ServiceAccount,
21553 /// Use OAuth credentials associated with the workload creator/user for
21554 /// authenticating to other services.
21555 EndUserCredentials,
21556 /// If set, the enum was initialized with an unknown value.
21557 ///
21558 /// Applications can examine the value using [AuthenticationType::value] or
21559 /// [AuthenticationType::name].
21560 UnknownValue(authentication_type::UnknownValue),
21561 }
21562
21563 #[doc(hidden)]
21564 pub mod authentication_type {
21565 #[allow(unused_imports)]
21566 use super::*;
21567 #[derive(Clone, Debug, PartialEq)]
21568 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21569 }
21570
21571 impl AuthenticationType {
21572 /// Gets the enum value.
21573 ///
21574 /// Returns `None` if the enum contains an unknown value deserialized from
21575 /// the string representation of enums.
21576 pub fn value(&self) -> std::option::Option<i32> {
21577 match self {
21578 Self::Unspecified => std::option::Option::Some(0),
21579 Self::ServiceAccount => std::option::Option::Some(1),
21580 Self::EndUserCredentials => std::option::Option::Some(2),
21581 Self::UnknownValue(u) => u.0.value(),
21582 }
21583 }
21584
21585 /// Gets the enum value as a string.
21586 ///
21587 /// Returns `None` if the enum contains an unknown value deserialized from
21588 /// the integer representation of enums.
21589 pub fn name(&self) -> std::option::Option<&str> {
21590 match self {
21591 Self::Unspecified => std::option::Option::Some("AUTHENTICATION_TYPE_UNSPECIFIED"),
21592 Self::ServiceAccount => std::option::Option::Some("SERVICE_ACCOUNT"),
21593 Self::EndUserCredentials => std::option::Option::Some("END_USER_CREDENTIALS"),
21594 Self::UnknownValue(u) => u.0.name(),
21595 }
21596 }
21597 }
21598
21599 impl std::default::Default for AuthenticationType {
21600 fn default() -> Self {
21601 use std::convert::From;
21602 Self::from(0)
21603 }
21604 }
21605
21606 impl std::fmt::Display for AuthenticationType {
21607 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21608 wkt::internal::display_enum(f, self.name(), self.value())
21609 }
21610 }
21611
21612 impl std::convert::From<i32> for AuthenticationType {
21613 fn from(value: i32) -> Self {
21614 match value {
21615 0 => Self::Unspecified,
21616 1 => Self::ServiceAccount,
21617 2 => Self::EndUserCredentials,
21618 _ => Self::UnknownValue(authentication_type::UnknownValue(
21619 wkt::internal::UnknownEnumValue::Integer(value),
21620 )),
21621 }
21622 }
21623 }
21624
21625 impl std::convert::From<&str> for AuthenticationType {
21626 fn from(value: &str) -> Self {
21627 use std::string::ToString;
21628 match value {
21629 "AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
21630 "SERVICE_ACCOUNT" => Self::ServiceAccount,
21631 "END_USER_CREDENTIALS" => Self::EndUserCredentials,
21632 _ => Self::UnknownValue(authentication_type::UnknownValue(
21633 wkt::internal::UnknownEnumValue::String(value.to_string()),
21634 )),
21635 }
21636 }
21637 }
21638
21639 impl serde::ser::Serialize for AuthenticationType {
21640 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21641 where
21642 S: serde::Serializer,
21643 {
21644 match self {
21645 Self::Unspecified => serializer.serialize_i32(0),
21646 Self::ServiceAccount => serializer.serialize_i32(1),
21647 Self::EndUserCredentials => serializer.serialize_i32(2),
21648 Self::UnknownValue(u) => u.0.serialize(serializer),
21649 }
21650 }
21651 }
21652
21653 impl<'de> serde::de::Deserialize<'de> for AuthenticationType {
21654 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21655 where
21656 D: serde::Deserializer<'de>,
21657 {
21658 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthenticationType>::new(
21659 ".google.cloud.dataproc.v1.AuthenticationConfig.AuthenticationType",
21660 ))
21661 }
21662 }
21663}
21664
21665/// Autotuning configuration of the workload.
21666#[derive(Clone, Default, PartialEq)]
21667#[non_exhaustive]
21668pub struct AutotuningConfig {
21669 /// Optional. Scenarios for which tunings are applied.
21670 pub scenarios: std::vec::Vec<crate::model::autotuning_config::Scenario>,
21671
21672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21673}
21674
21675impl AutotuningConfig {
21676 pub fn new() -> Self {
21677 std::default::Default::default()
21678 }
21679
21680 /// Sets the value of [scenarios][crate::model::AutotuningConfig::scenarios].
21681 ///
21682 /// # Example
21683 /// ```ignore,no_run
21684 /// # use google_cloud_dataproc_v1::model::AutotuningConfig;
21685 /// use google_cloud_dataproc_v1::model::autotuning_config::Scenario;
21686 /// let x = AutotuningConfig::new().set_scenarios([
21687 /// Scenario::Scaling,
21688 /// Scenario::BroadcastHashJoin,
21689 /// Scenario::Memory,
21690 /// ]);
21691 /// ```
21692 pub fn set_scenarios<T, V>(mut self, v: T) -> Self
21693 where
21694 T: std::iter::IntoIterator<Item = V>,
21695 V: std::convert::Into<crate::model::autotuning_config::Scenario>,
21696 {
21697 use std::iter::Iterator;
21698 self.scenarios = v.into_iter().map(|i| i.into()).collect();
21699 self
21700 }
21701}
21702
21703impl wkt::message::Message for AutotuningConfig {
21704 fn typename() -> &'static str {
21705 "type.googleapis.com/google.cloud.dataproc.v1.AutotuningConfig"
21706 }
21707}
21708
21709/// Defines additional types related to [AutotuningConfig].
21710pub mod autotuning_config {
21711 #[allow(unused_imports)]
21712 use super::*;
21713
21714 /// Scenario represents a specific goal that autotuning will attempt to achieve
21715 /// by modifying workloads.
21716 ///
21717 /// # Working with unknown values
21718 ///
21719 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21720 /// additional enum variants at any time. Adding new variants is not considered
21721 /// a breaking change. Applications should write their code in anticipation of:
21722 ///
21723 /// - New values appearing in future releases of the client library, **and**
21724 /// - New values received dynamically, without application changes.
21725 ///
21726 /// Please consult the [Working with enums] section in the user guide for some
21727 /// guidelines.
21728 ///
21729 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21730 #[derive(Clone, Debug, PartialEq)]
21731 #[non_exhaustive]
21732 pub enum Scenario {
21733 /// Default value.
21734 Unspecified,
21735 /// Scaling recommendations such as initialExecutors.
21736 Scaling,
21737 /// Adding hints for potential relation broadcasts.
21738 BroadcastHashJoin,
21739 /// Memory management for workloads.
21740 Memory,
21741 /// No autotuning.
21742 None,
21743 /// Automatic selection of scenarios.
21744 Auto,
21745 /// If set, the enum was initialized with an unknown value.
21746 ///
21747 /// Applications can examine the value using [Scenario::value] or
21748 /// [Scenario::name].
21749 UnknownValue(scenario::UnknownValue),
21750 }
21751
21752 #[doc(hidden)]
21753 pub mod scenario {
21754 #[allow(unused_imports)]
21755 use super::*;
21756 #[derive(Clone, Debug, PartialEq)]
21757 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21758 }
21759
21760 impl Scenario {
21761 /// Gets the enum value.
21762 ///
21763 /// Returns `None` if the enum contains an unknown value deserialized from
21764 /// the string representation of enums.
21765 pub fn value(&self) -> std::option::Option<i32> {
21766 match self {
21767 Self::Unspecified => std::option::Option::Some(0),
21768 Self::Scaling => std::option::Option::Some(2),
21769 Self::BroadcastHashJoin => std::option::Option::Some(3),
21770 Self::Memory => std::option::Option::Some(4),
21771 Self::None => std::option::Option::Some(5),
21772 Self::Auto => std::option::Option::Some(6),
21773 Self::UnknownValue(u) => u.0.value(),
21774 }
21775 }
21776
21777 /// Gets the enum value as a string.
21778 ///
21779 /// Returns `None` if the enum contains an unknown value deserialized from
21780 /// the integer representation of enums.
21781 pub fn name(&self) -> std::option::Option<&str> {
21782 match self {
21783 Self::Unspecified => std::option::Option::Some("SCENARIO_UNSPECIFIED"),
21784 Self::Scaling => std::option::Option::Some("SCALING"),
21785 Self::BroadcastHashJoin => std::option::Option::Some("BROADCAST_HASH_JOIN"),
21786 Self::Memory => std::option::Option::Some("MEMORY"),
21787 Self::None => std::option::Option::Some("NONE"),
21788 Self::Auto => std::option::Option::Some("AUTO"),
21789 Self::UnknownValue(u) => u.0.name(),
21790 }
21791 }
21792 }
21793
21794 impl std::default::Default for Scenario {
21795 fn default() -> Self {
21796 use std::convert::From;
21797 Self::from(0)
21798 }
21799 }
21800
21801 impl std::fmt::Display for Scenario {
21802 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21803 wkt::internal::display_enum(f, self.name(), self.value())
21804 }
21805 }
21806
21807 impl std::convert::From<i32> for Scenario {
21808 fn from(value: i32) -> Self {
21809 match value {
21810 0 => Self::Unspecified,
21811 2 => Self::Scaling,
21812 3 => Self::BroadcastHashJoin,
21813 4 => Self::Memory,
21814 5 => Self::None,
21815 6 => Self::Auto,
21816 _ => Self::UnknownValue(scenario::UnknownValue(
21817 wkt::internal::UnknownEnumValue::Integer(value),
21818 )),
21819 }
21820 }
21821 }
21822
21823 impl std::convert::From<&str> for Scenario {
21824 fn from(value: &str) -> Self {
21825 use std::string::ToString;
21826 match value {
21827 "SCENARIO_UNSPECIFIED" => Self::Unspecified,
21828 "SCALING" => Self::Scaling,
21829 "BROADCAST_HASH_JOIN" => Self::BroadcastHashJoin,
21830 "MEMORY" => Self::Memory,
21831 "NONE" => Self::None,
21832 "AUTO" => Self::Auto,
21833 _ => Self::UnknownValue(scenario::UnknownValue(
21834 wkt::internal::UnknownEnumValue::String(value.to_string()),
21835 )),
21836 }
21837 }
21838 }
21839
21840 impl serde::ser::Serialize for Scenario {
21841 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21842 where
21843 S: serde::Serializer,
21844 {
21845 match self {
21846 Self::Unspecified => serializer.serialize_i32(0),
21847 Self::Scaling => serializer.serialize_i32(2),
21848 Self::BroadcastHashJoin => serializer.serialize_i32(3),
21849 Self::Memory => serializer.serialize_i32(4),
21850 Self::None => serializer.serialize_i32(5),
21851 Self::Auto => serializer.serialize_i32(6),
21852 Self::UnknownValue(u) => u.0.serialize(serializer),
21853 }
21854 }
21855 }
21856
21857 impl<'de> serde::de::Deserialize<'de> for Scenario {
21858 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21859 where
21860 D: serde::Deserializer<'de>,
21861 {
21862 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scenario>::new(
21863 ".google.cloud.dataproc.v1.AutotuningConfig.Scenario",
21864 ))
21865 }
21866 }
21867}
21868
21869/// Configuration for dependency repositories
21870#[derive(Clone, Default, PartialEq)]
21871#[non_exhaustive]
21872pub struct RepositoryConfig {
21873 /// Optional. Configuration for PyPi repository.
21874 pub pypi_repository_config: std::option::Option<crate::model::PyPiRepositoryConfig>,
21875
21876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21877}
21878
21879impl RepositoryConfig {
21880 pub fn new() -> Self {
21881 std::default::Default::default()
21882 }
21883
21884 /// Sets the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
21885 ///
21886 /// # Example
21887 /// ```ignore,no_run
21888 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
21889 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
21890 /// let x = RepositoryConfig::new().set_pypi_repository_config(PyPiRepositoryConfig::default()/* use setters */);
21891 /// ```
21892 pub fn set_pypi_repository_config<T>(mut self, v: T) -> Self
21893 where
21894 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
21895 {
21896 self.pypi_repository_config = std::option::Option::Some(v.into());
21897 self
21898 }
21899
21900 /// Sets or clears the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
21901 ///
21902 /// # Example
21903 /// ```ignore,no_run
21904 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
21905 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
21906 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(Some(PyPiRepositoryConfig::default()/* use setters */));
21907 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(None::<PyPiRepositoryConfig>);
21908 /// ```
21909 pub fn set_or_clear_pypi_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
21910 where
21911 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
21912 {
21913 self.pypi_repository_config = v.map(|x| x.into());
21914 self
21915 }
21916}
21917
21918impl wkt::message::Message for RepositoryConfig {
21919 fn typename() -> &'static str {
21920 "type.googleapis.com/google.cloud.dataproc.v1.RepositoryConfig"
21921 }
21922}
21923
21924/// Configuration for PyPi repository
21925#[derive(Clone, Default, PartialEq)]
21926#[non_exhaustive]
21927pub struct PyPiRepositoryConfig {
21928 /// Optional. PyPi repository address
21929 pub pypi_repository: std::string::String,
21930
21931 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21932}
21933
21934impl PyPiRepositoryConfig {
21935 pub fn new() -> Self {
21936 std::default::Default::default()
21937 }
21938
21939 /// Sets the value of [pypi_repository][crate::model::PyPiRepositoryConfig::pypi_repository].
21940 ///
21941 /// # Example
21942 /// ```ignore,no_run
21943 /// # use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
21944 /// let x = PyPiRepositoryConfig::new().set_pypi_repository("example");
21945 /// ```
21946 pub fn set_pypi_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21947 self.pypi_repository = v.into();
21948 self
21949 }
21950}
21951
21952impl wkt::message::Message for PyPiRepositoryConfig {
21953 fn typename() -> &'static str {
21954 "type.googleapis.com/google.cloud.dataproc.v1.PyPiRepositoryConfig"
21955 }
21956}
21957
21958/// A Dataproc workflow template resource.
21959#[derive(Clone, Default, PartialEq)]
21960#[non_exhaustive]
21961pub struct WorkflowTemplate {
21962 pub id: std::string::String,
21963
21964 /// Output only. The resource name of the workflow template, as described
21965 /// in <https://cloud.google.com/apis/design/resource_names>.
21966 ///
21967 /// * For `projects.regions.workflowTemplates`, the resource name of the
21968 /// template has the following format:
21969 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
21970 ///
21971 /// * For `projects.locations.workflowTemplates`, the resource name of the
21972 /// template has the following format:
21973 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
21974 ///
21975 pub name: std::string::String,
21976
21977 /// Optional. Used to perform a consistent read-modify-write.
21978 ///
21979 /// This field should be left blank for a `CreateWorkflowTemplate` request. It
21980 /// is required for an `UpdateWorkflowTemplate` request, and must match the
21981 /// current server version. A typical update template flow would fetch the
21982 /// current template with a `GetWorkflowTemplate` request, which will return
21983 /// the current template with the `version` field filled in with the
21984 /// current server version. The user updates other fields in the template,
21985 /// then returns it as part of the `UpdateWorkflowTemplate` request.
21986 pub version: i32,
21987
21988 /// Output only. The time template was created.
21989 pub create_time: std::option::Option<wkt::Timestamp>,
21990
21991 /// Output only. The time template was last updated.
21992 pub update_time: std::option::Option<wkt::Timestamp>,
21993
21994 /// Optional. The labels to associate with this template. These labels
21995 /// will be propagated to all jobs and clusters created by the workflow
21996 /// instance.
21997 ///
21998 /// Label **keys** must contain 1 to 63 characters, and must conform to
21999 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22000 ///
22001 /// Label **values** may be empty, but, if present, must contain 1 to 63
22002 /// characters, and must conform to
22003 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22004 ///
22005 /// No more than 32 labels can be associated with a template.
22006 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22007
22008 /// Required. WorkflowTemplate scheduling information.
22009 pub placement: std::option::Option<crate::model::WorkflowTemplatePlacement>,
22010
22011 /// Required. The Directed Acyclic Graph of Jobs to submit.
22012 pub jobs: std::vec::Vec<crate::model::OrderedJob>,
22013
22014 /// Optional. Template parameters whose values are substituted into the
22015 /// template. Values for parameters must be provided when the template is
22016 /// instantiated.
22017 pub parameters: std::vec::Vec<crate::model::TemplateParameter>,
22018
22019 /// Optional. Timeout duration for the DAG of jobs, expressed in seconds (see
22020 /// [JSON representation of
22021 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
22022 /// The timeout duration must be from 10 minutes ("600s") to 24 hours
22023 /// ("86400s"). The timer begins when the first job is submitted. If the
22024 /// workflow is running at the end of the timeout period, any remaining jobs
22025 /// are cancelled, the workflow is ended, and if the workflow was running on a
22026 /// [managed
22027 /// cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster),
22028 /// the cluster is deleted.
22029 pub dag_timeout: std::option::Option<wkt::Duration>,
22030
22031 /// Optional. Encryption settings for encrypting workflow template job
22032 /// arguments.
22033 pub encryption_config: std::option::Option<crate::model::workflow_template::EncryptionConfig>,
22034
22035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22036}
22037
22038impl WorkflowTemplate {
22039 pub fn new() -> Self {
22040 std::default::Default::default()
22041 }
22042
22043 /// Sets the value of [id][crate::model::WorkflowTemplate::id].
22044 ///
22045 /// # Example
22046 /// ```ignore,no_run
22047 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22048 /// let x = WorkflowTemplate::new().set_id("example");
22049 /// ```
22050 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22051 self.id = v.into();
22052 self
22053 }
22054
22055 /// Sets the value of [name][crate::model::WorkflowTemplate::name].
22056 ///
22057 /// # Example
22058 /// ```ignore,no_run
22059 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22060 /// let x = WorkflowTemplate::new().set_name("example");
22061 /// ```
22062 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22063 self.name = v.into();
22064 self
22065 }
22066
22067 /// Sets the value of [version][crate::model::WorkflowTemplate::version].
22068 ///
22069 /// # Example
22070 /// ```ignore,no_run
22071 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22072 /// let x = WorkflowTemplate::new().set_version(42);
22073 /// ```
22074 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22075 self.version = v.into();
22076 self
22077 }
22078
22079 /// Sets the value of [create_time][crate::model::WorkflowTemplate::create_time].
22080 ///
22081 /// # Example
22082 /// ```ignore,no_run
22083 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22084 /// use wkt::Timestamp;
22085 /// let x = WorkflowTemplate::new().set_create_time(Timestamp::default()/* use setters */);
22086 /// ```
22087 pub fn set_create_time<T>(mut self, v: T) -> Self
22088 where
22089 T: std::convert::Into<wkt::Timestamp>,
22090 {
22091 self.create_time = std::option::Option::Some(v.into());
22092 self
22093 }
22094
22095 /// Sets or clears the value of [create_time][crate::model::WorkflowTemplate::create_time].
22096 ///
22097 /// # Example
22098 /// ```ignore,no_run
22099 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22100 /// use wkt::Timestamp;
22101 /// let x = WorkflowTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
22102 /// let x = WorkflowTemplate::new().set_or_clear_create_time(None::<Timestamp>);
22103 /// ```
22104 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
22105 where
22106 T: std::convert::Into<wkt::Timestamp>,
22107 {
22108 self.create_time = v.map(|x| x.into());
22109 self
22110 }
22111
22112 /// Sets the value of [update_time][crate::model::WorkflowTemplate::update_time].
22113 ///
22114 /// # Example
22115 /// ```ignore,no_run
22116 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22117 /// use wkt::Timestamp;
22118 /// let x = WorkflowTemplate::new().set_update_time(Timestamp::default()/* use setters */);
22119 /// ```
22120 pub fn set_update_time<T>(mut self, v: T) -> Self
22121 where
22122 T: std::convert::Into<wkt::Timestamp>,
22123 {
22124 self.update_time = std::option::Option::Some(v.into());
22125 self
22126 }
22127
22128 /// Sets or clears the value of [update_time][crate::model::WorkflowTemplate::update_time].
22129 ///
22130 /// # Example
22131 /// ```ignore,no_run
22132 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22133 /// use wkt::Timestamp;
22134 /// let x = WorkflowTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
22135 /// let x = WorkflowTemplate::new().set_or_clear_update_time(None::<Timestamp>);
22136 /// ```
22137 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
22138 where
22139 T: std::convert::Into<wkt::Timestamp>,
22140 {
22141 self.update_time = v.map(|x| x.into());
22142 self
22143 }
22144
22145 /// Sets the value of [labels][crate::model::WorkflowTemplate::labels].
22146 ///
22147 /// # Example
22148 /// ```ignore,no_run
22149 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22150 /// let x = WorkflowTemplate::new().set_labels([
22151 /// ("key0", "abc"),
22152 /// ("key1", "xyz"),
22153 /// ]);
22154 /// ```
22155 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22156 where
22157 T: std::iter::IntoIterator<Item = (K, V)>,
22158 K: std::convert::Into<std::string::String>,
22159 V: std::convert::Into<std::string::String>,
22160 {
22161 use std::iter::Iterator;
22162 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22163 self
22164 }
22165
22166 /// Sets the value of [placement][crate::model::WorkflowTemplate::placement].
22167 ///
22168 /// # Example
22169 /// ```ignore,no_run
22170 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22171 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22172 /// let x = WorkflowTemplate::new().set_placement(WorkflowTemplatePlacement::default()/* use setters */);
22173 /// ```
22174 pub fn set_placement<T>(mut self, v: T) -> Self
22175 where
22176 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22177 {
22178 self.placement = std::option::Option::Some(v.into());
22179 self
22180 }
22181
22182 /// Sets or clears the value of [placement][crate::model::WorkflowTemplate::placement].
22183 ///
22184 /// # Example
22185 /// ```ignore,no_run
22186 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22187 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22188 /// let x = WorkflowTemplate::new().set_or_clear_placement(Some(WorkflowTemplatePlacement::default()/* use setters */));
22189 /// let x = WorkflowTemplate::new().set_or_clear_placement(None::<WorkflowTemplatePlacement>);
22190 /// ```
22191 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
22192 where
22193 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22194 {
22195 self.placement = v.map(|x| x.into());
22196 self
22197 }
22198
22199 /// Sets the value of [jobs][crate::model::WorkflowTemplate::jobs].
22200 ///
22201 /// # Example
22202 /// ```ignore,no_run
22203 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22204 /// use google_cloud_dataproc_v1::model::OrderedJob;
22205 /// let x = WorkflowTemplate::new()
22206 /// .set_jobs([
22207 /// OrderedJob::default()/* use setters */,
22208 /// OrderedJob::default()/* use (different) setters */,
22209 /// ]);
22210 /// ```
22211 pub fn set_jobs<T, V>(mut self, v: T) -> Self
22212 where
22213 T: std::iter::IntoIterator<Item = V>,
22214 V: std::convert::Into<crate::model::OrderedJob>,
22215 {
22216 use std::iter::Iterator;
22217 self.jobs = v.into_iter().map(|i| i.into()).collect();
22218 self
22219 }
22220
22221 /// Sets the value of [parameters][crate::model::WorkflowTemplate::parameters].
22222 ///
22223 /// # Example
22224 /// ```ignore,no_run
22225 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22226 /// use google_cloud_dataproc_v1::model::TemplateParameter;
22227 /// let x = WorkflowTemplate::new()
22228 /// .set_parameters([
22229 /// TemplateParameter::default()/* use setters */,
22230 /// TemplateParameter::default()/* use (different) setters */,
22231 /// ]);
22232 /// ```
22233 pub fn set_parameters<T, V>(mut self, v: T) -> Self
22234 where
22235 T: std::iter::IntoIterator<Item = V>,
22236 V: std::convert::Into<crate::model::TemplateParameter>,
22237 {
22238 use std::iter::Iterator;
22239 self.parameters = v.into_iter().map(|i| i.into()).collect();
22240 self
22241 }
22242
22243 /// Sets the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
22244 ///
22245 /// # Example
22246 /// ```ignore,no_run
22247 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22248 /// use wkt::Duration;
22249 /// let x = WorkflowTemplate::new().set_dag_timeout(Duration::default()/* use setters */);
22250 /// ```
22251 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
22252 where
22253 T: std::convert::Into<wkt::Duration>,
22254 {
22255 self.dag_timeout = std::option::Option::Some(v.into());
22256 self
22257 }
22258
22259 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
22260 ///
22261 /// # Example
22262 /// ```ignore,no_run
22263 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22264 /// use wkt::Duration;
22265 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
22266 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(None::<Duration>);
22267 /// ```
22268 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
22269 where
22270 T: std::convert::Into<wkt::Duration>,
22271 {
22272 self.dag_timeout = v.map(|x| x.into());
22273 self
22274 }
22275
22276 /// Sets the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
22277 ///
22278 /// # Example
22279 /// ```ignore,no_run
22280 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22281 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22282 /// let x = WorkflowTemplate::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
22283 /// ```
22284 pub fn set_encryption_config<T>(mut self, v: T) -> Self
22285 where
22286 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
22287 {
22288 self.encryption_config = std::option::Option::Some(v.into());
22289 self
22290 }
22291
22292 /// Sets or clears the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
22293 ///
22294 /// # Example
22295 /// ```ignore,no_run
22296 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22297 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22298 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
22299 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
22300 /// ```
22301 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
22302 where
22303 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
22304 {
22305 self.encryption_config = v.map(|x| x.into());
22306 self
22307 }
22308}
22309
22310impl wkt::message::Message for WorkflowTemplate {
22311 fn typename() -> &'static str {
22312 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate"
22313 }
22314}
22315
22316/// Defines additional types related to [WorkflowTemplate].
22317pub mod workflow_template {
22318 #[allow(unused_imports)]
22319 use super::*;
22320
22321 /// Encryption settings for encrypting workflow template job arguments.
22322 #[derive(Clone, Default, PartialEq)]
22323 #[non_exhaustive]
22324 pub struct EncryptionConfig {
22325 /// Optional. The Cloud KMS key name to use for encrypting
22326 /// workflow template job arguments.
22327 ///
22328 /// When this this key is provided, the following workflow template
22329 /// [job arguments]
22330 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows#adding_jobs_to_a_template>),
22331 /// if present, are
22332 /// [CMEK
22333 /// encrypted](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_workflow_template_data):
22334 ///
22335 /// * [FlinkJob
22336 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
22337 /// * [HadoopJob
22338 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
22339 /// * [SparkJob
22340 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
22341 /// * [SparkRJob
22342 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
22343 /// * [PySparkJob
22344 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
22345 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
22346 /// scriptVariables and queryList.queries
22347 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
22348 /// scriptVariables and queryList.queries
22349 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
22350 /// scriptVariables and queryList.queries
22351 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
22352 /// scriptVariables and queryList.queries
22353 pub kms_key: std::string::String,
22354
22355 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22356 }
22357
22358 impl EncryptionConfig {
22359 pub fn new() -> Self {
22360 std::default::Default::default()
22361 }
22362
22363 /// Sets the value of [kms_key][crate::model::workflow_template::EncryptionConfig::kms_key].
22364 ///
22365 /// # Example
22366 /// ```ignore,no_run
22367 /// # use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22368 /// let x = EncryptionConfig::new().set_kms_key("example");
22369 /// ```
22370 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22371 self.kms_key = v.into();
22372 self
22373 }
22374 }
22375
22376 impl wkt::message::Message for EncryptionConfig {
22377 fn typename() -> &'static str {
22378 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate.EncryptionConfig"
22379 }
22380 }
22381}
22382
22383/// Specifies workflow execution target.
22384///
22385/// Either `managed_cluster` or `cluster_selector` is required.
22386#[derive(Clone, Default, PartialEq)]
22387#[non_exhaustive]
22388pub struct WorkflowTemplatePlacement {
22389 /// Required. Specifies where workflow executes; either on a managed
22390 /// cluster or an existing cluster chosen by labels.
22391 pub placement: std::option::Option<crate::model::workflow_template_placement::Placement>,
22392
22393 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22394}
22395
22396impl WorkflowTemplatePlacement {
22397 pub fn new() -> Self {
22398 std::default::Default::default()
22399 }
22400
22401 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement].
22402 ///
22403 /// Note that all the setters affecting `placement` are mutually
22404 /// exclusive.
22405 ///
22406 /// # Example
22407 /// ```ignore,no_run
22408 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22409 /// use google_cloud_dataproc_v1::model::ManagedCluster;
22410 /// let x = WorkflowTemplatePlacement::new().set_placement(Some(
22411 /// google_cloud_dataproc_v1::model::workflow_template_placement::Placement::ManagedCluster(ManagedCluster::default().into())));
22412 /// ```
22413 pub fn set_placement<
22414 T: std::convert::Into<
22415 std::option::Option<crate::model::workflow_template_placement::Placement>,
22416 >,
22417 >(
22418 mut self,
22419 v: T,
22420 ) -> Self {
22421 self.placement = v.into();
22422 self
22423 }
22424
22425 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22426 /// if it holds a `ManagedCluster`, `None` if the field is not set or
22427 /// holds a different branch.
22428 pub fn managed_cluster(
22429 &self,
22430 ) -> std::option::Option<&std::boxed::Box<crate::model::ManagedCluster>> {
22431 #[allow(unreachable_patterns)]
22432 self.placement.as_ref().and_then(|v| match v {
22433 crate::model::workflow_template_placement::Placement::ManagedCluster(v) => {
22434 std::option::Option::Some(v)
22435 }
22436 _ => std::option::Option::None,
22437 })
22438 }
22439
22440 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22441 /// to hold a `ManagedCluster`.
22442 ///
22443 /// Note that all the setters affecting `placement` are
22444 /// mutually exclusive.
22445 ///
22446 /// # Example
22447 /// ```ignore,no_run
22448 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22449 /// use google_cloud_dataproc_v1::model::ManagedCluster;
22450 /// let x = WorkflowTemplatePlacement::new().set_managed_cluster(ManagedCluster::default()/* use setters */);
22451 /// assert!(x.managed_cluster().is_some());
22452 /// assert!(x.cluster_selector().is_none());
22453 /// ```
22454 pub fn set_managed_cluster<
22455 T: std::convert::Into<std::boxed::Box<crate::model::ManagedCluster>>,
22456 >(
22457 mut self,
22458 v: T,
22459 ) -> Self {
22460 self.placement = std::option::Option::Some(
22461 crate::model::workflow_template_placement::Placement::ManagedCluster(v.into()),
22462 );
22463 self
22464 }
22465
22466 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22467 /// if it holds a `ClusterSelector`, `None` if the field is not set or
22468 /// holds a different branch.
22469 pub fn cluster_selector(
22470 &self,
22471 ) -> std::option::Option<&std::boxed::Box<crate::model::ClusterSelector>> {
22472 #[allow(unreachable_patterns)]
22473 self.placement.as_ref().and_then(|v| match v {
22474 crate::model::workflow_template_placement::Placement::ClusterSelector(v) => {
22475 std::option::Option::Some(v)
22476 }
22477 _ => std::option::Option::None,
22478 })
22479 }
22480
22481 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22482 /// to hold a `ClusterSelector`.
22483 ///
22484 /// Note that all the setters affecting `placement` are
22485 /// mutually exclusive.
22486 ///
22487 /// # Example
22488 /// ```ignore,no_run
22489 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22490 /// use google_cloud_dataproc_v1::model::ClusterSelector;
22491 /// let x = WorkflowTemplatePlacement::new().set_cluster_selector(ClusterSelector::default()/* use setters */);
22492 /// assert!(x.cluster_selector().is_some());
22493 /// assert!(x.managed_cluster().is_none());
22494 /// ```
22495 pub fn set_cluster_selector<
22496 T: std::convert::Into<std::boxed::Box<crate::model::ClusterSelector>>,
22497 >(
22498 mut self,
22499 v: T,
22500 ) -> Self {
22501 self.placement = std::option::Option::Some(
22502 crate::model::workflow_template_placement::Placement::ClusterSelector(v.into()),
22503 );
22504 self
22505 }
22506}
22507
22508impl wkt::message::Message for WorkflowTemplatePlacement {
22509 fn typename() -> &'static str {
22510 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplatePlacement"
22511 }
22512}
22513
22514/// Defines additional types related to [WorkflowTemplatePlacement].
22515pub mod workflow_template_placement {
22516 #[allow(unused_imports)]
22517 use super::*;
22518
22519 /// Required. Specifies where workflow executes; either on a managed
22520 /// cluster or an existing cluster chosen by labels.
22521 #[derive(Clone, Debug, PartialEq)]
22522 #[non_exhaustive]
22523 pub enum Placement {
22524 /// A cluster that is managed by the workflow.
22525 ManagedCluster(std::boxed::Box<crate::model::ManagedCluster>),
22526 /// Optional. A selector that chooses target cluster for jobs based
22527 /// on metadata.
22528 ///
22529 /// The selector is evaluated at the time each job is submitted.
22530 ClusterSelector(std::boxed::Box<crate::model::ClusterSelector>),
22531 }
22532}
22533
22534/// Cluster that is managed by the workflow.
22535#[derive(Clone, Default, PartialEq)]
22536#[non_exhaustive]
22537pub struct ManagedCluster {
22538 /// Required. The cluster name prefix. A unique cluster name will be formed by
22539 /// appending a random suffix.
22540 ///
22541 /// The name must contain only lower-case letters (a-z), numbers (0-9),
22542 /// and hyphens (-). Must begin with a letter. Cannot begin or end with
22543 /// hyphen. Must consist of between 2 and 35 characters.
22544 pub cluster_name: std::string::String,
22545
22546 /// Required. The cluster configuration.
22547 pub config: std::option::Option<crate::model::ClusterConfig>,
22548
22549 /// Optional. The labels to associate with this cluster.
22550 ///
22551 /// Label keys must be between 1 and 63 characters long, and must conform to
22552 /// the following PCRE regular expression:
22553 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
22554 ///
22555 /// Label values must be between 1 and 63 characters long, and must conform to
22556 /// the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
22557 ///
22558 /// No more than 32 labels can be associated with a given cluster.
22559 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22560
22561 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22562}
22563
22564impl ManagedCluster {
22565 pub fn new() -> Self {
22566 std::default::Default::default()
22567 }
22568
22569 /// Sets the value of [cluster_name][crate::model::ManagedCluster::cluster_name].
22570 ///
22571 /// # Example
22572 /// ```ignore,no_run
22573 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22574 /// let x = ManagedCluster::new().set_cluster_name("example");
22575 /// ```
22576 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22577 self.cluster_name = v.into();
22578 self
22579 }
22580
22581 /// Sets the value of [config][crate::model::ManagedCluster::config].
22582 ///
22583 /// # Example
22584 /// ```ignore,no_run
22585 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22586 /// use google_cloud_dataproc_v1::model::ClusterConfig;
22587 /// let x = ManagedCluster::new().set_config(ClusterConfig::default()/* use setters */);
22588 /// ```
22589 pub fn set_config<T>(mut self, v: T) -> Self
22590 where
22591 T: std::convert::Into<crate::model::ClusterConfig>,
22592 {
22593 self.config = std::option::Option::Some(v.into());
22594 self
22595 }
22596
22597 /// Sets or clears the value of [config][crate::model::ManagedCluster::config].
22598 ///
22599 /// # Example
22600 /// ```ignore,no_run
22601 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22602 /// use google_cloud_dataproc_v1::model::ClusterConfig;
22603 /// let x = ManagedCluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
22604 /// let x = ManagedCluster::new().set_or_clear_config(None::<ClusterConfig>);
22605 /// ```
22606 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
22607 where
22608 T: std::convert::Into<crate::model::ClusterConfig>,
22609 {
22610 self.config = v.map(|x| x.into());
22611 self
22612 }
22613
22614 /// Sets the value of [labels][crate::model::ManagedCluster::labels].
22615 ///
22616 /// # Example
22617 /// ```ignore,no_run
22618 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22619 /// let x = ManagedCluster::new().set_labels([
22620 /// ("key0", "abc"),
22621 /// ("key1", "xyz"),
22622 /// ]);
22623 /// ```
22624 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22625 where
22626 T: std::iter::IntoIterator<Item = (K, V)>,
22627 K: std::convert::Into<std::string::String>,
22628 V: std::convert::Into<std::string::String>,
22629 {
22630 use std::iter::Iterator;
22631 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22632 self
22633 }
22634}
22635
22636impl wkt::message::Message for ManagedCluster {
22637 fn typename() -> &'static str {
22638 "type.googleapis.com/google.cloud.dataproc.v1.ManagedCluster"
22639 }
22640}
22641
22642/// A selector that chooses target cluster for jobs based on metadata.
22643#[derive(Clone, Default, PartialEq)]
22644#[non_exhaustive]
22645pub struct ClusterSelector {
22646 /// Optional. The zone where workflow process executes. This parameter does not
22647 /// affect the selection of the cluster.
22648 ///
22649 /// If unspecified, the zone of the first cluster matching the selector
22650 /// is used.
22651 pub zone: std::string::String,
22652
22653 /// Required. The cluster labels. Cluster must have all labels
22654 /// to match.
22655 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
22656
22657 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22658}
22659
22660impl ClusterSelector {
22661 pub fn new() -> Self {
22662 std::default::Default::default()
22663 }
22664
22665 /// Sets the value of [zone][crate::model::ClusterSelector::zone].
22666 ///
22667 /// # Example
22668 /// ```ignore,no_run
22669 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
22670 /// let x = ClusterSelector::new().set_zone("example");
22671 /// ```
22672 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22673 self.zone = v.into();
22674 self
22675 }
22676
22677 /// Sets the value of [cluster_labels][crate::model::ClusterSelector::cluster_labels].
22678 ///
22679 /// # Example
22680 /// ```ignore,no_run
22681 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
22682 /// let x = ClusterSelector::new().set_cluster_labels([
22683 /// ("key0", "abc"),
22684 /// ("key1", "xyz"),
22685 /// ]);
22686 /// ```
22687 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
22688 where
22689 T: std::iter::IntoIterator<Item = (K, V)>,
22690 K: std::convert::Into<std::string::String>,
22691 V: std::convert::Into<std::string::String>,
22692 {
22693 use std::iter::Iterator;
22694 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22695 self
22696 }
22697}
22698
22699impl wkt::message::Message for ClusterSelector {
22700 fn typename() -> &'static str {
22701 "type.googleapis.com/google.cloud.dataproc.v1.ClusterSelector"
22702 }
22703}
22704
22705/// A job executed by the workflow.
22706#[derive(Clone, Default, PartialEq)]
22707#[non_exhaustive]
22708pub struct OrderedJob {
22709 /// Required. The step id. The id must be unique among all jobs
22710 /// within the template.
22711 ///
22712 /// The step id is used as prefix for job id, as job
22713 /// `goog-dataproc-workflow-step-id` label, and in
22714 /// [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]
22715 /// field from other steps.
22716 ///
22717 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
22718 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
22719 /// or hyphen. Must consist of between 3 and 50 characters.
22720 ///
22721 /// [google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]: crate::model::OrderedJob::prerequisite_step_ids
22722 pub step_id: std::string::String,
22723
22724 /// Optional. The labels to associate with this job.
22725 ///
22726 /// Label keys must be between 1 and 63 characters long, and must conform to
22727 /// the following regular expression:
22728 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
22729 ///
22730 /// Label values must be between 1 and 63 characters long, and must conform to
22731 /// the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
22732 ///
22733 /// No more than 32 labels can be associated with a given job.
22734 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22735
22736 /// Optional. Job scheduling configuration.
22737 pub scheduling: std::option::Option<crate::model::JobScheduling>,
22738
22739 /// Optional. The optional list of prerequisite job step_ids.
22740 /// If not specified, the job will start at the beginning of workflow.
22741 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
22742
22743 /// Required. The job definition.
22744 pub job_type: std::option::Option<crate::model::ordered_job::JobType>,
22745
22746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22747}
22748
22749impl OrderedJob {
22750 pub fn new() -> Self {
22751 std::default::Default::default()
22752 }
22753
22754 /// Sets the value of [step_id][crate::model::OrderedJob::step_id].
22755 ///
22756 /// # Example
22757 /// ```ignore,no_run
22758 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22759 /// let x = OrderedJob::new().set_step_id("example");
22760 /// ```
22761 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22762 self.step_id = v.into();
22763 self
22764 }
22765
22766 /// Sets the value of [labels][crate::model::OrderedJob::labels].
22767 ///
22768 /// # Example
22769 /// ```ignore,no_run
22770 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22771 /// let x = OrderedJob::new().set_labels([
22772 /// ("key0", "abc"),
22773 /// ("key1", "xyz"),
22774 /// ]);
22775 /// ```
22776 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22777 where
22778 T: std::iter::IntoIterator<Item = (K, V)>,
22779 K: std::convert::Into<std::string::String>,
22780 V: std::convert::Into<std::string::String>,
22781 {
22782 use std::iter::Iterator;
22783 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22784 self
22785 }
22786
22787 /// Sets the value of [scheduling][crate::model::OrderedJob::scheduling].
22788 ///
22789 /// # Example
22790 /// ```ignore,no_run
22791 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22792 /// use google_cloud_dataproc_v1::model::JobScheduling;
22793 /// let x = OrderedJob::new().set_scheduling(JobScheduling::default()/* use setters */);
22794 /// ```
22795 pub fn set_scheduling<T>(mut self, v: T) -> Self
22796 where
22797 T: std::convert::Into<crate::model::JobScheduling>,
22798 {
22799 self.scheduling = std::option::Option::Some(v.into());
22800 self
22801 }
22802
22803 /// Sets or clears the value of [scheduling][crate::model::OrderedJob::scheduling].
22804 ///
22805 /// # Example
22806 /// ```ignore,no_run
22807 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22808 /// use google_cloud_dataproc_v1::model::JobScheduling;
22809 /// let x = OrderedJob::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
22810 /// let x = OrderedJob::new().set_or_clear_scheduling(None::<JobScheduling>);
22811 /// ```
22812 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
22813 where
22814 T: std::convert::Into<crate::model::JobScheduling>,
22815 {
22816 self.scheduling = v.map(|x| x.into());
22817 self
22818 }
22819
22820 /// Sets the value of [prerequisite_step_ids][crate::model::OrderedJob::prerequisite_step_ids].
22821 ///
22822 /// # Example
22823 /// ```ignore,no_run
22824 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22825 /// let x = OrderedJob::new().set_prerequisite_step_ids(["a", "b", "c"]);
22826 /// ```
22827 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
22828 where
22829 T: std::iter::IntoIterator<Item = V>,
22830 V: std::convert::Into<std::string::String>,
22831 {
22832 use std::iter::Iterator;
22833 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
22834 self
22835 }
22836
22837 /// Sets the value of [job_type][crate::model::OrderedJob::job_type].
22838 ///
22839 /// Note that all the setters affecting `job_type` are mutually
22840 /// exclusive.
22841 ///
22842 /// # Example
22843 /// ```ignore,no_run
22844 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22845 /// use google_cloud_dataproc_v1::model::HadoopJob;
22846 /// let x = OrderedJob::new().set_job_type(Some(
22847 /// google_cloud_dataproc_v1::model::ordered_job::JobType::HadoopJob(HadoopJob::default().into())));
22848 /// ```
22849 pub fn set_job_type<
22850 T: std::convert::Into<std::option::Option<crate::model::ordered_job::JobType>>,
22851 >(
22852 mut self,
22853 v: T,
22854 ) -> Self {
22855 self.job_type = v.into();
22856 self
22857 }
22858
22859 /// The value of [job_type][crate::model::OrderedJob::job_type]
22860 /// if it holds a `HadoopJob`, `None` if the field is not set or
22861 /// holds a different branch.
22862 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
22863 #[allow(unreachable_patterns)]
22864 self.job_type.as_ref().and_then(|v| match v {
22865 crate::model::ordered_job::JobType::HadoopJob(v) => std::option::Option::Some(v),
22866 _ => std::option::Option::None,
22867 })
22868 }
22869
22870 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
22871 /// to hold a `HadoopJob`.
22872 ///
22873 /// Note that all the setters affecting `job_type` are
22874 /// mutually exclusive.
22875 ///
22876 /// # Example
22877 /// ```ignore,no_run
22878 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22879 /// use google_cloud_dataproc_v1::model::HadoopJob;
22880 /// let x = OrderedJob::new().set_hadoop_job(HadoopJob::default()/* use setters */);
22881 /// assert!(x.hadoop_job().is_some());
22882 /// assert!(x.spark_job().is_none());
22883 /// assert!(x.pyspark_job().is_none());
22884 /// assert!(x.hive_job().is_none());
22885 /// assert!(x.pig_job().is_none());
22886 /// assert!(x.spark_r_job().is_none());
22887 /// assert!(x.spark_sql_job().is_none());
22888 /// assert!(x.presto_job().is_none());
22889 /// assert!(x.trino_job().is_none());
22890 /// assert!(x.flink_job().is_none());
22891 /// ```
22892 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
22893 mut self,
22894 v: T,
22895 ) -> Self {
22896 self.job_type =
22897 std::option::Option::Some(crate::model::ordered_job::JobType::HadoopJob(v.into()));
22898 self
22899 }
22900
22901 /// The value of [job_type][crate::model::OrderedJob::job_type]
22902 /// if it holds a `SparkJob`, `None` if the field is not set or
22903 /// holds a different branch.
22904 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
22905 #[allow(unreachable_patterns)]
22906 self.job_type.as_ref().and_then(|v| match v {
22907 crate::model::ordered_job::JobType::SparkJob(v) => std::option::Option::Some(v),
22908 _ => std::option::Option::None,
22909 })
22910 }
22911
22912 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
22913 /// to hold a `SparkJob`.
22914 ///
22915 /// Note that all the setters affecting `job_type` are
22916 /// mutually exclusive.
22917 ///
22918 /// # Example
22919 /// ```ignore,no_run
22920 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22921 /// use google_cloud_dataproc_v1::model::SparkJob;
22922 /// let x = OrderedJob::new().set_spark_job(SparkJob::default()/* use setters */);
22923 /// assert!(x.spark_job().is_some());
22924 /// assert!(x.hadoop_job().is_none());
22925 /// assert!(x.pyspark_job().is_none());
22926 /// assert!(x.hive_job().is_none());
22927 /// assert!(x.pig_job().is_none());
22928 /// assert!(x.spark_r_job().is_none());
22929 /// assert!(x.spark_sql_job().is_none());
22930 /// assert!(x.presto_job().is_none());
22931 /// assert!(x.trino_job().is_none());
22932 /// assert!(x.flink_job().is_none());
22933 /// ```
22934 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
22935 mut self,
22936 v: T,
22937 ) -> Self {
22938 self.job_type =
22939 std::option::Option::Some(crate::model::ordered_job::JobType::SparkJob(v.into()));
22940 self
22941 }
22942
22943 /// The value of [job_type][crate::model::OrderedJob::job_type]
22944 /// if it holds a `PysparkJob`, `None` if the field is not set or
22945 /// holds a different branch.
22946 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
22947 #[allow(unreachable_patterns)]
22948 self.job_type.as_ref().and_then(|v| match v {
22949 crate::model::ordered_job::JobType::PysparkJob(v) => std::option::Option::Some(v),
22950 _ => std::option::Option::None,
22951 })
22952 }
22953
22954 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
22955 /// to hold a `PysparkJob`.
22956 ///
22957 /// Note that all the setters affecting `job_type` are
22958 /// mutually exclusive.
22959 ///
22960 /// # Example
22961 /// ```ignore,no_run
22962 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22963 /// use google_cloud_dataproc_v1::model::PySparkJob;
22964 /// let x = OrderedJob::new().set_pyspark_job(PySparkJob::default()/* use setters */);
22965 /// assert!(x.pyspark_job().is_some());
22966 /// assert!(x.hadoop_job().is_none());
22967 /// assert!(x.spark_job().is_none());
22968 /// assert!(x.hive_job().is_none());
22969 /// assert!(x.pig_job().is_none());
22970 /// assert!(x.spark_r_job().is_none());
22971 /// assert!(x.spark_sql_job().is_none());
22972 /// assert!(x.presto_job().is_none());
22973 /// assert!(x.trino_job().is_none());
22974 /// assert!(x.flink_job().is_none());
22975 /// ```
22976 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
22977 mut self,
22978 v: T,
22979 ) -> Self {
22980 self.job_type =
22981 std::option::Option::Some(crate::model::ordered_job::JobType::PysparkJob(v.into()));
22982 self
22983 }
22984
22985 /// The value of [job_type][crate::model::OrderedJob::job_type]
22986 /// if it holds a `HiveJob`, `None` if the field is not set or
22987 /// holds a different branch.
22988 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
22989 #[allow(unreachable_patterns)]
22990 self.job_type.as_ref().and_then(|v| match v {
22991 crate::model::ordered_job::JobType::HiveJob(v) => std::option::Option::Some(v),
22992 _ => std::option::Option::None,
22993 })
22994 }
22995
22996 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
22997 /// to hold a `HiveJob`.
22998 ///
22999 /// Note that all the setters affecting `job_type` are
23000 /// mutually exclusive.
23001 ///
23002 /// # Example
23003 /// ```ignore,no_run
23004 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23005 /// use google_cloud_dataproc_v1::model::HiveJob;
23006 /// let x = OrderedJob::new().set_hive_job(HiveJob::default()/* use setters */);
23007 /// assert!(x.hive_job().is_some());
23008 /// assert!(x.hadoop_job().is_none());
23009 /// assert!(x.spark_job().is_none());
23010 /// assert!(x.pyspark_job().is_none());
23011 /// assert!(x.pig_job().is_none());
23012 /// assert!(x.spark_r_job().is_none());
23013 /// assert!(x.spark_sql_job().is_none());
23014 /// assert!(x.presto_job().is_none());
23015 /// assert!(x.trino_job().is_none());
23016 /// assert!(x.flink_job().is_none());
23017 /// ```
23018 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
23019 mut self,
23020 v: T,
23021 ) -> Self {
23022 self.job_type =
23023 std::option::Option::Some(crate::model::ordered_job::JobType::HiveJob(v.into()));
23024 self
23025 }
23026
23027 /// The value of [job_type][crate::model::OrderedJob::job_type]
23028 /// if it holds a `PigJob`, `None` if the field is not set or
23029 /// holds a different branch.
23030 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
23031 #[allow(unreachable_patterns)]
23032 self.job_type.as_ref().and_then(|v| match v {
23033 crate::model::ordered_job::JobType::PigJob(v) => std::option::Option::Some(v),
23034 _ => std::option::Option::None,
23035 })
23036 }
23037
23038 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23039 /// to hold a `PigJob`.
23040 ///
23041 /// Note that all the setters affecting `job_type` are
23042 /// mutually exclusive.
23043 ///
23044 /// # Example
23045 /// ```ignore,no_run
23046 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23047 /// use google_cloud_dataproc_v1::model::PigJob;
23048 /// let x = OrderedJob::new().set_pig_job(PigJob::default()/* use setters */);
23049 /// assert!(x.pig_job().is_some());
23050 /// assert!(x.hadoop_job().is_none());
23051 /// assert!(x.spark_job().is_none());
23052 /// assert!(x.pyspark_job().is_none());
23053 /// assert!(x.hive_job().is_none());
23054 /// assert!(x.spark_r_job().is_none());
23055 /// assert!(x.spark_sql_job().is_none());
23056 /// assert!(x.presto_job().is_none());
23057 /// assert!(x.trino_job().is_none());
23058 /// assert!(x.flink_job().is_none());
23059 /// ```
23060 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
23061 mut self,
23062 v: T,
23063 ) -> Self {
23064 self.job_type =
23065 std::option::Option::Some(crate::model::ordered_job::JobType::PigJob(v.into()));
23066 self
23067 }
23068
23069 /// The value of [job_type][crate::model::OrderedJob::job_type]
23070 /// if it holds a `SparkRJob`, `None` if the field is not set or
23071 /// holds a different branch.
23072 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
23073 #[allow(unreachable_patterns)]
23074 self.job_type.as_ref().and_then(|v| match v {
23075 crate::model::ordered_job::JobType::SparkRJob(v) => std::option::Option::Some(v),
23076 _ => std::option::Option::None,
23077 })
23078 }
23079
23080 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23081 /// to hold a `SparkRJob`.
23082 ///
23083 /// Note that all the setters affecting `job_type` are
23084 /// mutually exclusive.
23085 ///
23086 /// # Example
23087 /// ```ignore,no_run
23088 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23089 /// use google_cloud_dataproc_v1::model::SparkRJob;
23090 /// let x = OrderedJob::new().set_spark_r_job(SparkRJob::default()/* use setters */);
23091 /// assert!(x.spark_r_job().is_some());
23092 /// assert!(x.hadoop_job().is_none());
23093 /// assert!(x.spark_job().is_none());
23094 /// assert!(x.pyspark_job().is_none());
23095 /// assert!(x.hive_job().is_none());
23096 /// assert!(x.pig_job().is_none());
23097 /// assert!(x.spark_sql_job().is_none());
23098 /// assert!(x.presto_job().is_none());
23099 /// assert!(x.trino_job().is_none());
23100 /// assert!(x.flink_job().is_none());
23101 /// ```
23102 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
23103 mut self,
23104 v: T,
23105 ) -> Self {
23106 self.job_type =
23107 std::option::Option::Some(crate::model::ordered_job::JobType::SparkRJob(v.into()));
23108 self
23109 }
23110
23111 /// The value of [job_type][crate::model::OrderedJob::job_type]
23112 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
23113 /// holds a different branch.
23114 pub fn spark_sql_job(
23115 &self,
23116 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
23117 #[allow(unreachable_patterns)]
23118 self.job_type.as_ref().and_then(|v| match v {
23119 crate::model::ordered_job::JobType::SparkSqlJob(v) => std::option::Option::Some(v),
23120 _ => std::option::Option::None,
23121 })
23122 }
23123
23124 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23125 /// to hold a `SparkSqlJob`.
23126 ///
23127 /// Note that all the setters affecting `job_type` are
23128 /// mutually exclusive.
23129 ///
23130 /// # Example
23131 /// ```ignore,no_run
23132 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23133 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
23134 /// let x = OrderedJob::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
23135 /// assert!(x.spark_sql_job().is_some());
23136 /// assert!(x.hadoop_job().is_none());
23137 /// assert!(x.spark_job().is_none());
23138 /// assert!(x.pyspark_job().is_none());
23139 /// assert!(x.hive_job().is_none());
23140 /// assert!(x.pig_job().is_none());
23141 /// assert!(x.spark_r_job().is_none());
23142 /// assert!(x.presto_job().is_none());
23143 /// assert!(x.trino_job().is_none());
23144 /// assert!(x.flink_job().is_none());
23145 /// ```
23146 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
23147 mut self,
23148 v: T,
23149 ) -> Self {
23150 self.job_type =
23151 std::option::Option::Some(crate::model::ordered_job::JobType::SparkSqlJob(v.into()));
23152 self
23153 }
23154
23155 /// The value of [job_type][crate::model::OrderedJob::job_type]
23156 /// if it holds a `PrestoJob`, `None` if the field is not set or
23157 /// holds a different branch.
23158 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
23159 #[allow(unreachable_patterns)]
23160 self.job_type.as_ref().and_then(|v| match v {
23161 crate::model::ordered_job::JobType::PrestoJob(v) => std::option::Option::Some(v),
23162 _ => std::option::Option::None,
23163 })
23164 }
23165
23166 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23167 /// to hold a `PrestoJob`.
23168 ///
23169 /// Note that all the setters affecting `job_type` are
23170 /// mutually exclusive.
23171 ///
23172 /// # Example
23173 /// ```ignore,no_run
23174 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23175 /// use google_cloud_dataproc_v1::model::PrestoJob;
23176 /// let x = OrderedJob::new().set_presto_job(PrestoJob::default()/* use setters */);
23177 /// assert!(x.presto_job().is_some());
23178 /// assert!(x.hadoop_job().is_none());
23179 /// assert!(x.spark_job().is_none());
23180 /// assert!(x.pyspark_job().is_none());
23181 /// assert!(x.hive_job().is_none());
23182 /// assert!(x.pig_job().is_none());
23183 /// assert!(x.spark_r_job().is_none());
23184 /// assert!(x.spark_sql_job().is_none());
23185 /// assert!(x.trino_job().is_none());
23186 /// assert!(x.flink_job().is_none());
23187 /// ```
23188 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
23189 mut self,
23190 v: T,
23191 ) -> Self {
23192 self.job_type =
23193 std::option::Option::Some(crate::model::ordered_job::JobType::PrestoJob(v.into()));
23194 self
23195 }
23196
23197 /// The value of [job_type][crate::model::OrderedJob::job_type]
23198 /// if it holds a `TrinoJob`, `None` if the field is not set or
23199 /// holds a different branch.
23200 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
23201 #[allow(unreachable_patterns)]
23202 self.job_type.as_ref().and_then(|v| match v {
23203 crate::model::ordered_job::JobType::TrinoJob(v) => std::option::Option::Some(v),
23204 _ => std::option::Option::None,
23205 })
23206 }
23207
23208 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23209 /// to hold a `TrinoJob`.
23210 ///
23211 /// Note that all the setters affecting `job_type` are
23212 /// mutually exclusive.
23213 ///
23214 /// # Example
23215 /// ```ignore,no_run
23216 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23217 /// use google_cloud_dataproc_v1::model::TrinoJob;
23218 /// let x = OrderedJob::new().set_trino_job(TrinoJob::default()/* use setters */);
23219 /// assert!(x.trino_job().is_some());
23220 /// assert!(x.hadoop_job().is_none());
23221 /// assert!(x.spark_job().is_none());
23222 /// assert!(x.pyspark_job().is_none());
23223 /// assert!(x.hive_job().is_none());
23224 /// assert!(x.pig_job().is_none());
23225 /// assert!(x.spark_r_job().is_none());
23226 /// assert!(x.spark_sql_job().is_none());
23227 /// assert!(x.presto_job().is_none());
23228 /// assert!(x.flink_job().is_none());
23229 /// ```
23230 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
23231 mut self,
23232 v: T,
23233 ) -> Self {
23234 self.job_type =
23235 std::option::Option::Some(crate::model::ordered_job::JobType::TrinoJob(v.into()));
23236 self
23237 }
23238
23239 /// The value of [job_type][crate::model::OrderedJob::job_type]
23240 /// if it holds a `FlinkJob`, `None` if the field is not set or
23241 /// holds a different branch.
23242 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
23243 #[allow(unreachable_patterns)]
23244 self.job_type.as_ref().and_then(|v| match v {
23245 crate::model::ordered_job::JobType::FlinkJob(v) => std::option::Option::Some(v),
23246 _ => std::option::Option::None,
23247 })
23248 }
23249
23250 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23251 /// to hold a `FlinkJob`.
23252 ///
23253 /// Note that all the setters affecting `job_type` are
23254 /// mutually exclusive.
23255 ///
23256 /// # Example
23257 /// ```ignore,no_run
23258 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23259 /// use google_cloud_dataproc_v1::model::FlinkJob;
23260 /// let x = OrderedJob::new().set_flink_job(FlinkJob::default()/* use setters */);
23261 /// assert!(x.flink_job().is_some());
23262 /// assert!(x.hadoop_job().is_none());
23263 /// assert!(x.spark_job().is_none());
23264 /// assert!(x.pyspark_job().is_none());
23265 /// assert!(x.hive_job().is_none());
23266 /// assert!(x.pig_job().is_none());
23267 /// assert!(x.spark_r_job().is_none());
23268 /// assert!(x.spark_sql_job().is_none());
23269 /// assert!(x.presto_job().is_none());
23270 /// assert!(x.trino_job().is_none());
23271 /// ```
23272 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
23273 mut self,
23274 v: T,
23275 ) -> Self {
23276 self.job_type =
23277 std::option::Option::Some(crate::model::ordered_job::JobType::FlinkJob(v.into()));
23278 self
23279 }
23280}
23281
23282impl wkt::message::Message for OrderedJob {
23283 fn typename() -> &'static str {
23284 "type.googleapis.com/google.cloud.dataproc.v1.OrderedJob"
23285 }
23286}
23287
23288/// Defines additional types related to [OrderedJob].
23289pub mod ordered_job {
23290 #[allow(unused_imports)]
23291 use super::*;
23292
23293 /// Required. The job definition.
23294 #[derive(Clone, Debug, PartialEq)]
23295 #[non_exhaustive]
23296 pub enum JobType {
23297 /// Optional. Job is a Hadoop job.
23298 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
23299 /// Optional. Job is a Spark job.
23300 SparkJob(std::boxed::Box<crate::model::SparkJob>),
23301 /// Optional. Job is a PySpark job.
23302 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
23303 /// Optional. Job is a Hive job.
23304 HiveJob(std::boxed::Box<crate::model::HiveJob>),
23305 /// Optional. Job is a Pig job.
23306 PigJob(std::boxed::Box<crate::model::PigJob>),
23307 /// Optional. Job is a SparkR job.
23308 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
23309 /// Optional. Job is a SparkSql job.
23310 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
23311 /// Optional. Job is a Presto job.
23312 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
23313 /// Optional. Job is a Trino job.
23314 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
23315 /// Optional. Job is a Flink job.
23316 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
23317 }
23318}
23319
23320/// A configurable parameter that replaces one or more fields in the template.
23321/// Parameterizable fields:
23322///
23323/// - Labels
23324/// - File uris
23325/// - Job properties
23326/// - Job arguments
23327/// - Script variables
23328/// - Main class (in HadoopJob and SparkJob)
23329/// - Zone (in ClusterSelector)
23330#[derive(Clone, Default, PartialEq)]
23331#[non_exhaustive]
23332pub struct TemplateParameter {
23333 /// Required. Parameter name.
23334 /// The parameter name is used as the key, and paired with the
23335 /// parameter value, which are passed to the template when the template
23336 /// is instantiated.
23337 /// The name must contain only capital letters (A-Z), numbers (0-9), and
23338 /// underscores (_), and must not start with a number. The maximum length is
23339 /// 40 characters.
23340 pub name: std::string::String,
23341
23342 /// Required. Paths to all fields that the parameter replaces.
23343 /// A field is allowed to appear in at most one parameter's list of field
23344 /// paths.
23345 ///
23346 /// A field path is similar in syntax to a
23347 /// [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a
23348 /// field path that references the zone field of a workflow template's cluster
23349 /// selector would be specified as `placement.clusterSelector.zone`.
23350 ///
23351 /// Also, field paths can reference fields using the following syntax:
23352 ///
23353 /// * Values in maps can be referenced by key:
23354 ///
23355 /// * labels['key']
23356 /// * placement.clusterSelector.clusterLabels['key']
23357 /// * placement.managedCluster.labels['key']
23358 /// * placement.clusterSelector.clusterLabels['key']
23359 /// * jobs['step-id'].labels['key']
23360 /// * Jobs in the jobs list can be referenced by step-id:
23361 ///
23362 /// * jobs['step-id'].hadoopJob.mainJarFileUri
23363 /// * jobs['step-id'].hiveJob.queryFileUri
23364 /// * jobs['step-id'].pySparkJob.mainPythonFileUri
23365 /// * jobs['step-id'].hadoopJob.jarFileUris[0]
23366 /// * jobs['step-id'].hadoopJob.archiveUris[0]
23367 /// * jobs['step-id'].hadoopJob.fileUris[0]
23368 /// * jobs['step-id'].pySparkJob.pythonFileUris[0]
23369 /// * Items in repeated fields can be referenced by a zero-based index:
23370 ///
23371 /// * jobs['step-id'].sparkJob.args[0]
23372 /// * Other examples:
23373 ///
23374 /// * jobs['step-id'].hadoopJob.properties['key']
23375 /// * jobs['step-id'].hadoopJob.args[0]
23376 /// * jobs['step-id'].hiveJob.scriptVariables['key']
23377 /// * jobs['step-id'].hadoopJob.mainJarFileUri
23378 /// * placement.clusterSelector.zone
23379 ///
23380 /// It may not be possible to parameterize maps and repeated fields in their
23381 /// entirety since only individual map values and individual items in repeated
23382 /// fields can be referenced. For example, the following field paths are
23383 /// invalid:
23384 ///
23385 /// - placement.clusterSelector.clusterLabels
23386 /// - jobs['step-id'].sparkJob.args
23387 ///
23388 /// [google.protobuf.FieldMask]: wkt::FieldMask
23389 pub fields: std::vec::Vec<std::string::String>,
23390
23391 /// Optional. Brief description of the parameter.
23392 /// Must not exceed 1024 characters.
23393 pub description: std::string::String,
23394
23395 /// Optional. Validation rules to be applied to this parameter's value.
23396 pub validation: std::option::Option<crate::model::ParameterValidation>,
23397
23398 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23399}
23400
23401impl TemplateParameter {
23402 pub fn new() -> Self {
23403 std::default::Default::default()
23404 }
23405
23406 /// Sets the value of [name][crate::model::TemplateParameter::name].
23407 ///
23408 /// # Example
23409 /// ```ignore,no_run
23410 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23411 /// let x = TemplateParameter::new().set_name("example");
23412 /// ```
23413 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23414 self.name = v.into();
23415 self
23416 }
23417
23418 /// Sets the value of [fields][crate::model::TemplateParameter::fields].
23419 ///
23420 /// # Example
23421 /// ```ignore,no_run
23422 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23423 /// let x = TemplateParameter::new().set_fields(["a", "b", "c"]);
23424 /// ```
23425 pub fn set_fields<T, V>(mut self, v: T) -> Self
23426 where
23427 T: std::iter::IntoIterator<Item = V>,
23428 V: std::convert::Into<std::string::String>,
23429 {
23430 use std::iter::Iterator;
23431 self.fields = v.into_iter().map(|i| i.into()).collect();
23432 self
23433 }
23434
23435 /// Sets the value of [description][crate::model::TemplateParameter::description].
23436 ///
23437 /// # Example
23438 /// ```ignore,no_run
23439 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23440 /// let x = TemplateParameter::new().set_description("example");
23441 /// ```
23442 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23443 self.description = v.into();
23444 self
23445 }
23446
23447 /// Sets the value of [validation][crate::model::TemplateParameter::validation].
23448 ///
23449 /// # Example
23450 /// ```ignore,no_run
23451 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23452 /// use google_cloud_dataproc_v1::model::ParameterValidation;
23453 /// let x = TemplateParameter::new().set_validation(ParameterValidation::default()/* use setters */);
23454 /// ```
23455 pub fn set_validation<T>(mut self, v: T) -> Self
23456 where
23457 T: std::convert::Into<crate::model::ParameterValidation>,
23458 {
23459 self.validation = std::option::Option::Some(v.into());
23460 self
23461 }
23462
23463 /// Sets or clears the value of [validation][crate::model::TemplateParameter::validation].
23464 ///
23465 /// # Example
23466 /// ```ignore,no_run
23467 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23468 /// use google_cloud_dataproc_v1::model::ParameterValidation;
23469 /// let x = TemplateParameter::new().set_or_clear_validation(Some(ParameterValidation::default()/* use setters */));
23470 /// let x = TemplateParameter::new().set_or_clear_validation(None::<ParameterValidation>);
23471 /// ```
23472 pub fn set_or_clear_validation<T>(mut self, v: std::option::Option<T>) -> Self
23473 where
23474 T: std::convert::Into<crate::model::ParameterValidation>,
23475 {
23476 self.validation = v.map(|x| x.into());
23477 self
23478 }
23479}
23480
23481impl wkt::message::Message for TemplateParameter {
23482 fn typename() -> &'static str {
23483 "type.googleapis.com/google.cloud.dataproc.v1.TemplateParameter"
23484 }
23485}
23486
23487/// Configuration for parameter validation.
23488#[derive(Clone, Default, PartialEq)]
23489#[non_exhaustive]
23490pub struct ParameterValidation {
23491 /// Required. The type of validation to be performed.
23492 pub validation_type: std::option::Option<crate::model::parameter_validation::ValidationType>,
23493
23494 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23495}
23496
23497impl ParameterValidation {
23498 pub fn new() -> Self {
23499 std::default::Default::default()
23500 }
23501
23502 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type].
23503 ///
23504 /// Note that all the setters affecting `validation_type` are mutually
23505 /// exclusive.
23506 ///
23507 /// # Example
23508 /// ```ignore,no_run
23509 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23510 /// use google_cloud_dataproc_v1::model::RegexValidation;
23511 /// let x = ParameterValidation::new().set_validation_type(Some(
23512 /// google_cloud_dataproc_v1::model::parameter_validation::ValidationType::Regex(RegexValidation::default().into())));
23513 /// ```
23514 pub fn set_validation_type<
23515 T: std::convert::Into<std::option::Option<crate::model::parameter_validation::ValidationType>>,
23516 >(
23517 mut self,
23518 v: T,
23519 ) -> Self {
23520 self.validation_type = v.into();
23521 self
23522 }
23523
23524 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
23525 /// if it holds a `Regex`, `None` if the field is not set or
23526 /// holds a different branch.
23527 pub fn regex(&self) -> std::option::Option<&std::boxed::Box<crate::model::RegexValidation>> {
23528 #[allow(unreachable_patterns)]
23529 self.validation_type.as_ref().and_then(|v| match v {
23530 crate::model::parameter_validation::ValidationType::Regex(v) => {
23531 std::option::Option::Some(v)
23532 }
23533 _ => std::option::Option::None,
23534 })
23535 }
23536
23537 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
23538 /// to hold a `Regex`.
23539 ///
23540 /// Note that all the setters affecting `validation_type` are
23541 /// mutually exclusive.
23542 ///
23543 /// # Example
23544 /// ```ignore,no_run
23545 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23546 /// use google_cloud_dataproc_v1::model::RegexValidation;
23547 /// let x = ParameterValidation::new().set_regex(RegexValidation::default()/* use setters */);
23548 /// assert!(x.regex().is_some());
23549 /// assert!(x.values().is_none());
23550 /// ```
23551 pub fn set_regex<T: std::convert::Into<std::boxed::Box<crate::model::RegexValidation>>>(
23552 mut self,
23553 v: T,
23554 ) -> Self {
23555 self.validation_type = std::option::Option::Some(
23556 crate::model::parameter_validation::ValidationType::Regex(v.into()),
23557 );
23558 self
23559 }
23560
23561 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
23562 /// if it holds a `Values`, `None` if the field is not set or
23563 /// holds a different branch.
23564 pub fn values(&self) -> std::option::Option<&std::boxed::Box<crate::model::ValueValidation>> {
23565 #[allow(unreachable_patterns)]
23566 self.validation_type.as_ref().and_then(|v| match v {
23567 crate::model::parameter_validation::ValidationType::Values(v) => {
23568 std::option::Option::Some(v)
23569 }
23570 _ => std::option::Option::None,
23571 })
23572 }
23573
23574 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
23575 /// to hold a `Values`.
23576 ///
23577 /// Note that all the setters affecting `validation_type` are
23578 /// mutually exclusive.
23579 ///
23580 /// # Example
23581 /// ```ignore,no_run
23582 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23583 /// use google_cloud_dataproc_v1::model::ValueValidation;
23584 /// let x = ParameterValidation::new().set_values(ValueValidation::default()/* use setters */);
23585 /// assert!(x.values().is_some());
23586 /// assert!(x.regex().is_none());
23587 /// ```
23588 pub fn set_values<T: std::convert::Into<std::boxed::Box<crate::model::ValueValidation>>>(
23589 mut self,
23590 v: T,
23591 ) -> Self {
23592 self.validation_type = std::option::Option::Some(
23593 crate::model::parameter_validation::ValidationType::Values(v.into()),
23594 );
23595 self
23596 }
23597}
23598
23599impl wkt::message::Message for ParameterValidation {
23600 fn typename() -> &'static str {
23601 "type.googleapis.com/google.cloud.dataproc.v1.ParameterValidation"
23602 }
23603}
23604
23605/// Defines additional types related to [ParameterValidation].
23606pub mod parameter_validation {
23607 #[allow(unused_imports)]
23608 use super::*;
23609
23610 /// Required. The type of validation to be performed.
23611 #[derive(Clone, Debug, PartialEq)]
23612 #[non_exhaustive]
23613 pub enum ValidationType {
23614 /// Validation based on regular expressions.
23615 Regex(std::boxed::Box<crate::model::RegexValidation>),
23616 /// Validation based on a list of allowed values.
23617 Values(std::boxed::Box<crate::model::ValueValidation>),
23618 }
23619}
23620
23621/// Validation based on regular expressions.
23622#[derive(Clone, Default, PartialEq)]
23623#[non_exhaustive]
23624pub struct RegexValidation {
23625 /// Required. RE2 regular expressions used to validate the parameter's value.
23626 /// The value must match the regex in its entirety (substring
23627 /// matches are not sufficient).
23628 pub regexes: std::vec::Vec<std::string::String>,
23629
23630 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23631}
23632
23633impl RegexValidation {
23634 pub fn new() -> Self {
23635 std::default::Default::default()
23636 }
23637
23638 /// Sets the value of [regexes][crate::model::RegexValidation::regexes].
23639 ///
23640 /// # Example
23641 /// ```ignore,no_run
23642 /// # use google_cloud_dataproc_v1::model::RegexValidation;
23643 /// let x = RegexValidation::new().set_regexes(["a", "b", "c"]);
23644 /// ```
23645 pub fn set_regexes<T, V>(mut self, v: T) -> Self
23646 where
23647 T: std::iter::IntoIterator<Item = V>,
23648 V: std::convert::Into<std::string::String>,
23649 {
23650 use std::iter::Iterator;
23651 self.regexes = v.into_iter().map(|i| i.into()).collect();
23652 self
23653 }
23654}
23655
23656impl wkt::message::Message for RegexValidation {
23657 fn typename() -> &'static str {
23658 "type.googleapis.com/google.cloud.dataproc.v1.RegexValidation"
23659 }
23660}
23661
23662/// Validation based on a list of allowed values.
23663#[derive(Clone, Default, PartialEq)]
23664#[non_exhaustive]
23665pub struct ValueValidation {
23666 /// Required. List of allowed values for the parameter.
23667 pub values: std::vec::Vec<std::string::String>,
23668
23669 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23670}
23671
23672impl ValueValidation {
23673 pub fn new() -> Self {
23674 std::default::Default::default()
23675 }
23676
23677 /// Sets the value of [values][crate::model::ValueValidation::values].
23678 ///
23679 /// # Example
23680 /// ```ignore,no_run
23681 /// # use google_cloud_dataproc_v1::model::ValueValidation;
23682 /// let x = ValueValidation::new().set_values(["a", "b", "c"]);
23683 /// ```
23684 pub fn set_values<T, V>(mut self, v: T) -> Self
23685 where
23686 T: std::iter::IntoIterator<Item = V>,
23687 V: std::convert::Into<std::string::String>,
23688 {
23689 use std::iter::Iterator;
23690 self.values = v.into_iter().map(|i| i.into()).collect();
23691 self
23692 }
23693}
23694
23695impl wkt::message::Message for ValueValidation {
23696 fn typename() -> &'static str {
23697 "type.googleapis.com/google.cloud.dataproc.v1.ValueValidation"
23698 }
23699}
23700
23701/// A Dataproc workflow template resource.
23702#[derive(Clone, Default, PartialEq)]
23703#[non_exhaustive]
23704pub struct WorkflowMetadata {
23705 /// Output only. The resource name of the workflow template as described
23706 /// in <https://cloud.google.com/apis/design/resource_names>.
23707 ///
23708 /// * For `projects.regions.workflowTemplates`, the resource name of the
23709 /// template has the following format:
23710 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
23711 ///
23712 /// * For `projects.locations.workflowTemplates`, the resource name of the
23713 /// template has the following format:
23714 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
23715 ///
23716 pub template: std::string::String,
23717
23718 /// Output only. The version of template at the time of
23719 /// workflow instantiation.
23720 pub version: i32,
23721
23722 /// Output only. The create cluster operation metadata.
23723 pub create_cluster: std::option::Option<crate::model::ClusterOperation>,
23724
23725 /// Output only. The workflow graph.
23726 pub graph: std::option::Option<crate::model::WorkflowGraph>,
23727
23728 /// Output only. The delete cluster operation metadata.
23729 pub delete_cluster: std::option::Option<crate::model::ClusterOperation>,
23730
23731 /// Output only. The workflow state.
23732 pub state: crate::model::workflow_metadata::State,
23733
23734 /// Output only. The name of the target cluster.
23735 pub cluster_name: std::string::String,
23736
23737 /// Map from parameter names to values that were used for those parameters.
23738 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
23739
23740 /// Output only. Workflow start time.
23741 pub start_time: std::option::Option<wkt::Timestamp>,
23742
23743 /// Output only. Workflow end time.
23744 pub end_time: std::option::Option<wkt::Timestamp>,
23745
23746 /// Output only. The UUID of target cluster.
23747 pub cluster_uuid: std::string::String,
23748
23749 /// Output only. The timeout duration for the DAG of jobs, expressed in seconds
23750 /// (see [JSON representation of
23751 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
23752 pub dag_timeout: std::option::Option<wkt::Duration>,
23753
23754 /// Output only. DAG start time, only set for workflows with
23755 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
23756 /// DAG begins.
23757 ///
23758 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
23759 pub dag_start_time: std::option::Option<wkt::Timestamp>,
23760
23761 /// Output only. DAG end time, only set for workflows with
23762 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
23763 /// DAG ends.
23764 ///
23765 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
23766 pub dag_end_time: std::option::Option<wkt::Timestamp>,
23767
23768 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23769}
23770
23771impl WorkflowMetadata {
23772 pub fn new() -> Self {
23773 std::default::Default::default()
23774 }
23775
23776 /// Sets the value of [template][crate::model::WorkflowMetadata::template].
23777 ///
23778 /// # Example
23779 /// ```ignore,no_run
23780 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23781 /// let x = WorkflowMetadata::new().set_template("example");
23782 /// ```
23783 pub fn set_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23784 self.template = v.into();
23785 self
23786 }
23787
23788 /// Sets the value of [version][crate::model::WorkflowMetadata::version].
23789 ///
23790 /// # Example
23791 /// ```ignore,no_run
23792 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23793 /// let x = WorkflowMetadata::new().set_version(42);
23794 /// ```
23795 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23796 self.version = v.into();
23797 self
23798 }
23799
23800 /// Sets the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
23801 ///
23802 /// # Example
23803 /// ```ignore,no_run
23804 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23805 /// use google_cloud_dataproc_v1::model::ClusterOperation;
23806 /// let x = WorkflowMetadata::new().set_create_cluster(ClusterOperation::default()/* use setters */);
23807 /// ```
23808 pub fn set_create_cluster<T>(mut self, v: T) -> Self
23809 where
23810 T: std::convert::Into<crate::model::ClusterOperation>,
23811 {
23812 self.create_cluster = std::option::Option::Some(v.into());
23813 self
23814 }
23815
23816 /// Sets or clears the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
23817 ///
23818 /// # Example
23819 /// ```ignore,no_run
23820 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23821 /// use google_cloud_dataproc_v1::model::ClusterOperation;
23822 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(Some(ClusterOperation::default()/* use setters */));
23823 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(None::<ClusterOperation>);
23824 /// ```
23825 pub fn set_or_clear_create_cluster<T>(mut self, v: std::option::Option<T>) -> Self
23826 where
23827 T: std::convert::Into<crate::model::ClusterOperation>,
23828 {
23829 self.create_cluster = v.map(|x| x.into());
23830 self
23831 }
23832
23833 /// Sets the value of [graph][crate::model::WorkflowMetadata::graph].
23834 ///
23835 /// # Example
23836 /// ```ignore,no_run
23837 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23838 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
23839 /// let x = WorkflowMetadata::new().set_graph(WorkflowGraph::default()/* use setters */);
23840 /// ```
23841 pub fn set_graph<T>(mut self, v: T) -> Self
23842 where
23843 T: std::convert::Into<crate::model::WorkflowGraph>,
23844 {
23845 self.graph = std::option::Option::Some(v.into());
23846 self
23847 }
23848
23849 /// Sets or clears the value of [graph][crate::model::WorkflowMetadata::graph].
23850 ///
23851 /// # Example
23852 /// ```ignore,no_run
23853 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23854 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
23855 /// let x = WorkflowMetadata::new().set_or_clear_graph(Some(WorkflowGraph::default()/* use setters */));
23856 /// let x = WorkflowMetadata::new().set_or_clear_graph(None::<WorkflowGraph>);
23857 /// ```
23858 pub fn set_or_clear_graph<T>(mut self, v: std::option::Option<T>) -> Self
23859 where
23860 T: std::convert::Into<crate::model::WorkflowGraph>,
23861 {
23862 self.graph = v.map(|x| x.into());
23863 self
23864 }
23865
23866 /// Sets the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
23867 ///
23868 /// # Example
23869 /// ```ignore,no_run
23870 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23871 /// use google_cloud_dataproc_v1::model::ClusterOperation;
23872 /// let x = WorkflowMetadata::new().set_delete_cluster(ClusterOperation::default()/* use setters */);
23873 /// ```
23874 pub fn set_delete_cluster<T>(mut self, v: T) -> Self
23875 where
23876 T: std::convert::Into<crate::model::ClusterOperation>,
23877 {
23878 self.delete_cluster = std::option::Option::Some(v.into());
23879 self
23880 }
23881
23882 /// Sets or clears the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
23883 ///
23884 /// # Example
23885 /// ```ignore,no_run
23886 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23887 /// use google_cloud_dataproc_v1::model::ClusterOperation;
23888 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(Some(ClusterOperation::default()/* use setters */));
23889 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(None::<ClusterOperation>);
23890 /// ```
23891 pub fn set_or_clear_delete_cluster<T>(mut self, v: std::option::Option<T>) -> Self
23892 where
23893 T: std::convert::Into<crate::model::ClusterOperation>,
23894 {
23895 self.delete_cluster = v.map(|x| x.into());
23896 self
23897 }
23898
23899 /// Sets the value of [state][crate::model::WorkflowMetadata::state].
23900 ///
23901 /// # Example
23902 /// ```ignore,no_run
23903 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23904 /// use google_cloud_dataproc_v1::model::workflow_metadata::State;
23905 /// let x0 = WorkflowMetadata::new().set_state(State::Pending);
23906 /// let x1 = WorkflowMetadata::new().set_state(State::Running);
23907 /// let x2 = WorkflowMetadata::new().set_state(State::Done);
23908 /// ```
23909 pub fn set_state<T: std::convert::Into<crate::model::workflow_metadata::State>>(
23910 mut self,
23911 v: T,
23912 ) -> Self {
23913 self.state = v.into();
23914 self
23915 }
23916
23917 /// Sets the value of [cluster_name][crate::model::WorkflowMetadata::cluster_name].
23918 ///
23919 /// # Example
23920 /// ```ignore,no_run
23921 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23922 /// let x = WorkflowMetadata::new().set_cluster_name("example");
23923 /// ```
23924 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23925 self.cluster_name = v.into();
23926 self
23927 }
23928
23929 /// Sets the value of [parameters][crate::model::WorkflowMetadata::parameters].
23930 ///
23931 /// # Example
23932 /// ```ignore,no_run
23933 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23934 /// let x = WorkflowMetadata::new().set_parameters([
23935 /// ("key0", "abc"),
23936 /// ("key1", "xyz"),
23937 /// ]);
23938 /// ```
23939 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
23940 where
23941 T: std::iter::IntoIterator<Item = (K, V)>,
23942 K: std::convert::Into<std::string::String>,
23943 V: std::convert::Into<std::string::String>,
23944 {
23945 use std::iter::Iterator;
23946 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23947 self
23948 }
23949
23950 /// Sets the value of [start_time][crate::model::WorkflowMetadata::start_time].
23951 ///
23952 /// # Example
23953 /// ```ignore,no_run
23954 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23955 /// use wkt::Timestamp;
23956 /// let x = WorkflowMetadata::new().set_start_time(Timestamp::default()/* use setters */);
23957 /// ```
23958 pub fn set_start_time<T>(mut self, v: T) -> Self
23959 where
23960 T: std::convert::Into<wkt::Timestamp>,
23961 {
23962 self.start_time = std::option::Option::Some(v.into());
23963 self
23964 }
23965
23966 /// Sets or clears the value of [start_time][crate::model::WorkflowMetadata::start_time].
23967 ///
23968 /// # Example
23969 /// ```ignore,no_run
23970 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23971 /// use wkt::Timestamp;
23972 /// let x = WorkflowMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
23973 /// let x = WorkflowMetadata::new().set_or_clear_start_time(None::<Timestamp>);
23974 /// ```
23975 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
23976 where
23977 T: std::convert::Into<wkt::Timestamp>,
23978 {
23979 self.start_time = v.map(|x| x.into());
23980 self
23981 }
23982
23983 /// Sets the value of [end_time][crate::model::WorkflowMetadata::end_time].
23984 ///
23985 /// # Example
23986 /// ```ignore,no_run
23987 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23988 /// use wkt::Timestamp;
23989 /// let x = WorkflowMetadata::new().set_end_time(Timestamp::default()/* use setters */);
23990 /// ```
23991 pub fn set_end_time<T>(mut self, v: T) -> Self
23992 where
23993 T: std::convert::Into<wkt::Timestamp>,
23994 {
23995 self.end_time = std::option::Option::Some(v.into());
23996 self
23997 }
23998
23999 /// Sets or clears the value of [end_time][crate::model::WorkflowMetadata::end_time].
24000 ///
24001 /// # Example
24002 /// ```ignore,no_run
24003 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24004 /// use wkt::Timestamp;
24005 /// let x = WorkflowMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
24006 /// let x = WorkflowMetadata::new().set_or_clear_end_time(None::<Timestamp>);
24007 /// ```
24008 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24009 where
24010 T: std::convert::Into<wkt::Timestamp>,
24011 {
24012 self.end_time = v.map(|x| x.into());
24013 self
24014 }
24015
24016 /// Sets the value of [cluster_uuid][crate::model::WorkflowMetadata::cluster_uuid].
24017 ///
24018 /// # Example
24019 /// ```ignore,no_run
24020 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24021 /// let x = WorkflowMetadata::new().set_cluster_uuid("example");
24022 /// ```
24023 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24024 self.cluster_uuid = v.into();
24025 self
24026 }
24027
24028 /// Sets the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24029 ///
24030 /// # Example
24031 /// ```ignore,no_run
24032 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24033 /// use wkt::Duration;
24034 /// let x = WorkflowMetadata::new().set_dag_timeout(Duration::default()/* use setters */);
24035 /// ```
24036 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
24037 where
24038 T: std::convert::Into<wkt::Duration>,
24039 {
24040 self.dag_timeout = std::option::Option::Some(v.into());
24041 self
24042 }
24043
24044 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24045 ///
24046 /// # Example
24047 /// ```ignore,no_run
24048 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24049 /// use wkt::Duration;
24050 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
24051 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(None::<Duration>);
24052 /// ```
24053 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
24054 where
24055 T: std::convert::Into<wkt::Duration>,
24056 {
24057 self.dag_timeout = v.map(|x| x.into());
24058 self
24059 }
24060
24061 /// Sets the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24062 ///
24063 /// # Example
24064 /// ```ignore,no_run
24065 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24066 /// use wkt::Timestamp;
24067 /// let x = WorkflowMetadata::new().set_dag_start_time(Timestamp::default()/* use setters */);
24068 /// ```
24069 pub fn set_dag_start_time<T>(mut self, v: T) -> Self
24070 where
24071 T: std::convert::Into<wkt::Timestamp>,
24072 {
24073 self.dag_start_time = std::option::Option::Some(v.into());
24074 self
24075 }
24076
24077 /// Sets or clears the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24078 ///
24079 /// # Example
24080 /// ```ignore,no_run
24081 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24082 /// use wkt::Timestamp;
24083 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(Some(Timestamp::default()/* use setters */));
24084 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(None::<Timestamp>);
24085 /// ```
24086 pub fn set_or_clear_dag_start_time<T>(mut self, v: std::option::Option<T>) -> Self
24087 where
24088 T: std::convert::Into<wkt::Timestamp>,
24089 {
24090 self.dag_start_time = v.map(|x| x.into());
24091 self
24092 }
24093
24094 /// Sets the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24095 ///
24096 /// # Example
24097 /// ```ignore,no_run
24098 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24099 /// use wkt::Timestamp;
24100 /// let x = WorkflowMetadata::new().set_dag_end_time(Timestamp::default()/* use setters */);
24101 /// ```
24102 pub fn set_dag_end_time<T>(mut self, v: T) -> Self
24103 where
24104 T: std::convert::Into<wkt::Timestamp>,
24105 {
24106 self.dag_end_time = std::option::Option::Some(v.into());
24107 self
24108 }
24109
24110 /// Sets or clears the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24111 ///
24112 /// # Example
24113 /// ```ignore,no_run
24114 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24115 /// use wkt::Timestamp;
24116 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(Some(Timestamp::default()/* use setters */));
24117 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(None::<Timestamp>);
24118 /// ```
24119 pub fn set_or_clear_dag_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24120 where
24121 T: std::convert::Into<wkt::Timestamp>,
24122 {
24123 self.dag_end_time = v.map(|x| x.into());
24124 self
24125 }
24126}
24127
24128impl wkt::message::Message for WorkflowMetadata {
24129 fn typename() -> &'static str {
24130 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowMetadata"
24131 }
24132}
24133
24134/// Defines additional types related to [WorkflowMetadata].
24135pub mod workflow_metadata {
24136 #[allow(unused_imports)]
24137 use super::*;
24138
24139 /// The operation state.
24140 ///
24141 /// # Working with unknown values
24142 ///
24143 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24144 /// additional enum variants at any time. Adding new variants is not considered
24145 /// a breaking change. Applications should write their code in anticipation of:
24146 ///
24147 /// - New values appearing in future releases of the client library, **and**
24148 /// - New values received dynamically, without application changes.
24149 ///
24150 /// Please consult the [Working with enums] section in the user guide for some
24151 /// guidelines.
24152 ///
24153 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24154 #[derive(Clone, Debug, PartialEq)]
24155 #[non_exhaustive]
24156 pub enum State {
24157 /// Unused.
24158 Unknown,
24159 /// The operation has been created.
24160 Pending,
24161 /// The operation is running.
24162 Running,
24163 /// The operation is done; either cancelled or completed.
24164 Done,
24165 /// If set, the enum was initialized with an unknown value.
24166 ///
24167 /// Applications can examine the value using [State::value] or
24168 /// [State::name].
24169 UnknownValue(state::UnknownValue),
24170 }
24171
24172 #[doc(hidden)]
24173 pub mod state {
24174 #[allow(unused_imports)]
24175 use super::*;
24176 #[derive(Clone, Debug, PartialEq)]
24177 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24178 }
24179
24180 impl State {
24181 /// Gets the enum value.
24182 ///
24183 /// Returns `None` if the enum contains an unknown value deserialized from
24184 /// the string representation of enums.
24185 pub fn value(&self) -> std::option::Option<i32> {
24186 match self {
24187 Self::Unknown => std::option::Option::Some(0),
24188 Self::Pending => std::option::Option::Some(1),
24189 Self::Running => std::option::Option::Some(2),
24190 Self::Done => std::option::Option::Some(3),
24191 Self::UnknownValue(u) => u.0.value(),
24192 }
24193 }
24194
24195 /// Gets the enum value as a string.
24196 ///
24197 /// Returns `None` if the enum contains an unknown value deserialized from
24198 /// the integer representation of enums.
24199 pub fn name(&self) -> std::option::Option<&str> {
24200 match self {
24201 Self::Unknown => std::option::Option::Some("UNKNOWN"),
24202 Self::Pending => std::option::Option::Some("PENDING"),
24203 Self::Running => std::option::Option::Some("RUNNING"),
24204 Self::Done => std::option::Option::Some("DONE"),
24205 Self::UnknownValue(u) => u.0.name(),
24206 }
24207 }
24208 }
24209
24210 impl std::default::Default for State {
24211 fn default() -> Self {
24212 use std::convert::From;
24213 Self::from(0)
24214 }
24215 }
24216
24217 impl std::fmt::Display for State {
24218 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24219 wkt::internal::display_enum(f, self.name(), self.value())
24220 }
24221 }
24222
24223 impl std::convert::From<i32> for State {
24224 fn from(value: i32) -> Self {
24225 match value {
24226 0 => Self::Unknown,
24227 1 => Self::Pending,
24228 2 => Self::Running,
24229 3 => Self::Done,
24230 _ => Self::UnknownValue(state::UnknownValue(
24231 wkt::internal::UnknownEnumValue::Integer(value),
24232 )),
24233 }
24234 }
24235 }
24236
24237 impl std::convert::From<&str> for State {
24238 fn from(value: &str) -> Self {
24239 use std::string::ToString;
24240 match value {
24241 "UNKNOWN" => Self::Unknown,
24242 "PENDING" => Self::Pending,
24243 "RUNNING" => Self::Running,
24244 "DONE" => Self::Done,
24245 _ => Self::UnknownValue(state::UnknownValue(
24246 wkt::internal::UnknownEnumValue::String(value.to_string()),
24247 )),
24248 }
24249 }
24250 }
24251
24252 impl serde::ser::Serialize for State {
24253 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24254 where
24255 S: serde::Serializer,
24256 {
24257 match self {
24258 Self::Unknown => serializer.serialize_i32(0),
24259 Self::Pending => serializer.serialize_i32(1),
24260 Self::Running => serializer.serialize_i32(2),
24261 Self::Done => serializer.serialize_i32(3),
24262 Self::UnknownValue(u) => u.0.serialize(serializer),
24263 }
24264 }
24265 }
24266
24267 impl<'de> serde::de::Deserialize<'de> for State {
24268 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24269 where
24270 D: serde::Deserializer<'de>,
24271 {
24272 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
24273 ".google.cloud.dataproc.v1.WorkflowMetadata.State",
24274 ))
24275 }
24276 }
24277}
24278
24279/// The cluster operation triggered by a workflow.
24280#[derive(Clone, Default, PartialEq)]
24281#[non_exhaustive]
24282pub struct ClusterOperation {
24283 /// Output only. The id of the cluster operation.
24284 pub operation_id: std::string::String,
24285
24286 /// Output only. Error, if operation failed.
24287 pub error: std::string::String,
24288
24289 /// Output only. Indicates the operation is done.
24290 pub done: bool,
24291
24292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24293}
24294
24295impl ClusterOperation {
24296 pub fn new() -> Self {
24297 std::default::Default::default()
24298 }
24299
24300 /// Sets the value of [operation_id][crate::model::ClusterOperation::operation_id].
24301 ///
24302 /// # Example
24303 /// ```ignore,no_run
24304 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24305 /// let x = ClusterOperation::new().set_operation_id("example");
24306 /// ```
24307 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24308 self.operation_id = v.into();
24309 self
24310 }
24311
24312 /// Sets the value of [error][crate::model::ClusterOperation::error].
24313 ///
24314 /// # Example
24315 /// ```ignore,no_run
24316 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24317 /// let x = ClusterOperation::new().set_error("example");
24318 /// ```
24319 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24320 self.error = v.into();
24321 self
24322 }
24323
24324 /// Sets the value of [done][crate::model::ClusterOperation::done].
24325 ///
24326 /// # Example
24327 /// ```ignore,no_run
24328 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24329 /// let x = ClusterOperation::new().set_done(true);
24330 /// ```
24331 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24332 self.done = v.into();
24333 self
24334 }
24335}
24336
24337impl wkt::message::Message for ClusterOperation {
24338 fn typename() -> &'static str {
24339 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperation"
24340 }
24341}
24342
24343/// The workflow graph.
24344#[derive(Clone, Default, PartialEq)]
24345#[non_exhaustive]
24346pub struct WorkflowGraph {
24347 /// Output only. The workflow nodes.
24348 pub nodes: std::vec::Vec<crate::model::WorkflowNode>,
24349
24350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24351}
24352
24353impl WorkflowGraph {
24354 pub fn new() -> Self {
24355 std::default::Default::default()
24356 }
24357
24358 /// Sets the value of [nodes][crate::model::WorkflowGraph::nodes].
24359 ///
24360 /// # Example
24361 /// ```ignore,no_run
24362 /// # use google_cloud_dataproc_v1::model::WorkflowGraph;
24363 /// use google_cloud_dataproc_v1::model::WorkflowNode;
24364 /// let x = WorkflowGraph::new()
24365 /// .set_nodes([
24366 /// WorkflowNode::default()/* use setters */,
24367 /// WorkflowNode::default()/* use (different) setters */,
24368 /// ]);
24369 /// ```
24370 pub fn set_nodes<T, V>(mut self, v: T) -> Self
24371 where
24372 T: std::iter::IntoIterator<Item = V>,
24373 V: std::convert::Into<crate::model::WorkflowNode>,
24374 {
24375 use std::iter::Iterator;
24376 self.nodes = v.into_iter().map(|i| i.into()).collect();
24377 self
24378 }
24379}
24380
24381impl wkt::message::Message for WorkflowGraph {
24382 fn typename() -> &'static str {
24383 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowGraph"
24384 }
24385}
24386
24387/// The workflow node.
24388#[derive(Clone, Default, PartialEq)]
24389#[non_exhaustive]
24390pub struct WorkflowNode {
24391 /// Output only. The name of the node.
24392 pub step_id: std::string::String,
24393
24394 /// Output only. Node's prerequisite nodes.
24395 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
24396
24397 /// Output only. The job id; populated after the node enters RUNNING state.
24398 pub job_id: std::string::String,
24399
24400 /// Output only. The node state.
24401 pub state: crate::model::workflow_node::NodeState,
24402
24403 /// Output only. The error detail.
24404 pub error: std::string::String,
24405
24406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24407}
24408
24409impl WorkflowNode {
24410 pub fn new() -> Self {
24411 std::default::Default::default()
24412 }
24413
24414 /// Sets the value of [step_id][crate::model::WorkflowNode::step_id].
24415 ///
24416 /// # Example
24417 /// ```ignore,no_run
24418 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24419 /// let x = WorkflowNode::new().set_step_id("example");
24420 /// ```
24421 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24422 self.step_id = v.into();
24423 self
24424 }
24425
24426 /// Sets the value of [prerequisite_step_ids][crate::model::WorkflowNode::prerequisite_step_ids].
24427 ///
24428 /// # Example
24429 /// ```ignore,no_run
24430 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24431 /// let x = WorkflowNode::new().set_prerequisite_step_ids(["a", "b", "c"]);
24432 /// ```
24433 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
24434 where
24435 T: std::iter::IntoIterator<Item = V>,
24436 V: std::convert::Into<std::string::String>,
24437 {
24438 use std::iter::Iterator;
24439 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
24440 self
24441 }
24442
24443 /// Sets the value of [job_id][crate::model::WorkflowNode::job_id].
24444 ///
24445 /// # Example
24446 /// ```ignore,no_run
24447 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24448 /// let x = WorkflowNode::new().set_job_id("example");
24449 /// ```
24450 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24451 self.job_id = v.into();
24452 self
24453 }
24454
24455 /// Sets the value of [state][crate::model::WorkflowNode::state].
24456 ///
24457 /// # Example
24458 /// ```ignore,no_run
24459 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24460 /// use google_cloud_dataproc_v1::model::workflow_node::NodeState;
24461 /// let x0 = WorkflowNode::new().set_state(NodeState::Blocked);
24462 /// let x1 = WorkflowNode::new().set_state(NodeState::Runnable);
24463 /// let x2 = WorkflowNode::new().set_state(NodeState::Running);
24464 /// ```
24465 pub fn set_state<T: std::convert::Into<crate::model::workflow_node::NodeState>>(
24466 mut self,
24467 v: T,
24468 ) -> Self {
24469 self.state = v.into();
24470 self
24471 }
24472
24473 /// Sets the value of [error][crate::model::WorkflowNode::error].
24474 ///
24475 /// # Example
24476 /// ```ignore,no_run
24477 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24478 /// let x = WorkflowNode::new().set_error("example");
24479 /// ```
24480 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24481 self.error = v.into();
24482 self
24483 }
24484}
24485
24486impl wkt::message::Message for WorkflowNode {
24487 fn typename() -> &'static str {
24488 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowNode"
24489 }
24490}
24491
24492/// Defines additional types related to [WorkflowNode].
24493pub mod workflow_node {
24494 #[allow(unused_imports)]
24495 use super::*;
24496
24497 /// The workflow node state.
24498 ///
24499 /// # Working with unknown values
24500 ///
24501 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24502 /// additional enum variants at any time. Adding new variants is not considered
24503 /// a breaking change. Applications should write their code in anticipation of:
24504 ///
24505 /// - New values appearing in future releases of the client library, **and**
24506 /// - New values received dynamically, without application changes.
24507 ///
24508 /// Please consult the [Working with enums] section in the user guide for some
24509 /// guidelines.
24510 ///
24511 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24512 #[derive(Clone, Debug, PartialEq)]
24513 #[non_exhaustive]
24514 pub enum NodeState {
24515 /// State is unspecified.
24516 Unspecified,
24517 /// The node is awaiting prerequisite node to finish.
24518 Blocked,
24519 /// The node is runnable but not running.
24520 Runnable,
24521 /// The node is running.
24522 Running,
24523 /// The node completed successfully.
24524 Completed,
24525 /// The node failed. A node can be marked FAILED because
24526 /// its ancestor or peer failed.
24527 Failed,
24528 /// If set, the enum was initialized with an unknown value.
24529 ///
24530 /// Applications can examine the value using [NodeState::value] or
24531 /// [NodeState::name].
24532 UnknownValue(node_state::UnknownValue),
24533 }
24534
24535 #[doc(hidden)]
24536 pub mod node_state {
24537 #[allow(unused_imports)]
24538 use super::*;
24539 #[derive(Clone, Debug, PartialEq)]
24540 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24541 }
24542
24543 impl NodeState {
24544 /// Gets the enum value.
24545 ///
24546 /// Returns `None` if the enum contains an unknown value deserialized from
24547 /// the string representation of enums.
24548 pub fn value(&self) -> std::option::Option<i32> {
24549 match self {
24550 Self::Unspecified => std::option::Option::Some(0),
24551 Self::Blocked => std::option::Option::Some(1),
24552 Self::Runnable => std::option::Option::Some(2),
24553 Self::Running => std::option::Option::Some(3),
24554 Self::Completed => std::option::Option::Some(4),
24555 Self::Failed => std::option::Option::Some(5),
24556 Self::UnknownValue(u) => u.0.value(),
24557 }
24558 }
24559
24560 /// Gets the enum value as a string.
24561 ///
24562 /// Returns `None` if the enum contains an unknown value deserialized from
24563 /// the integer representation of enums.
24564 pub fn name(&self) -> std::option::Option<&str> {
24565 match self {
24566 Self::Unspecified => std::option::Option::Some("NODE_STATE_UNSPECIFIED"),
24567 Self::Blocked => std::option::Option::Some("BLOCKED"),
24568 Self::Runnable => std::option::Option::Some("RUNNABLE"),
24569 Self::Running => std::option::Option::Some("RUNNING"),
24570 Self::Completed => std::option::Option::Some("COMPLETED"),
24571 Self::Failed => std::option::Option::Some("FAILED"),
24572 Self::UnknownValue(u) => u.0.name(),
24573 }
24574 }
24575 }
24576
24577 impl std::default::Default for NodeState {
24578 fn default() -> Self {
24579 use std::convert::From;
24580 Self::from(0)
24581 }
24582 }
24583
24584 impl std::fmt::Display for NodeState {
24585 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24586 wkt::internal::display_enum(f, self.name(), self.value())
24587 }
24588 }
24589
24590 impl std::convert::From<i32> for NodeState {
24591 fn from(value: i32) -> Self {
24592 match value {
24593 0 => Self::Unspecified,
24594 1 => Self::Blocked,
24595 2 => Self::Runnable,
24596 3 => Self::Running,
24597 4 => Self::Completed,
24598 5 => Self::Failed,
24599 _ => Self::UnknownValue(node_state::UnknownValue(
24600 wkt::internal::UnknownEnumValue::Integer(value),
24601 )),
24602 }
24603 }
24604 }
24605
24606 impl std::convert::From<&str> for NodeState {
24607 fn from(value: &str) -> Self {
24608 use std::string::ToString;
24609 match value {
24610 "NODE_STATE_UNSPECIFIED" => Self::Unspecified,
24611 "BLOCKED" => Self::Blocked,
24612 "RUNNABLE" => Self::Runnable,
24613 "RUNNING" => Self::Running,
24614 "COMPLETED" => Self::Completed,
24615 "FAILED" => Self::Failed,
24616 _ => Self::UnknownValue(node_state::UnknownValue(
24617 wkt::internal::UnknownEnumValue::String(value.to_string()),
24618 )),
24619 }
24620 }
24621 }
24622
24623 impl serde::ser::Serialize for NodeState {
24624 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24625 where
24626 S: serde::Serializer,
24627 {
24628 match self {
24629 Self::Unspecified => serializer.serialize_i32(0),
24630 Self::Blocked => serializer.serialize_i32(1),
24631 Self::Runnable => serializer.serialize_i32(2),
24632 Self::Running => serializer.serialize_i32(3),
24633 Self::Completed => serializer.serialize_i32(4),
24634 Self::Failed => serializer.serialize_i32(5),
24635 Self::UnknownValue(u) => u.0.serialize(serializer),
24636 }
24637 }
24638 }
24639
24640 impl<'de> serde::de::Deserialize<'de> for NodeState {
24641 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24642 where
24643 D: serde::Deserializer<'de>,
24644 {
24645 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeState>::new(
24646 ".google.cloud.dataproc.v1.WorkflowNode.NodeState",
24647 ))
24648 }
24649 }
24650}
24651
24652/// A request to create a workflow template.
24653#[derive(Clone, Default, PartialEq)]
24654#[non_exhaustive]
24655pub struct CreateWorkflowTemplateRequest {
24656 /// Required. The resource name of the region or location, as described
24657 /// in <https://cloud.google.com/apis/design/resource_names>.
24658 ///
24659 /// * For `projects.regions.workflowTemplates.create`, the resource name of the
24660 /// region has the following format:
24661 /// `projects/{project_id}/regions/{region}`
24662 ///
24663 /// * For `projects.locations.workflowTemplates.create`, the resource name of
24664 /// the location has the following format:
24665 /// `projects/{project_id}/locations/{location}`
24666 ///
24667 pub parent: std::string::String,
24668
24669 /// Required. The Dataproc workflow template to create.
24670 pub template: std::option::Option<crate::model::WorkflowTemplate>,
24671
24672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24673}
24674
24675impl CreateWorkflowTemplateRequest {
24676 pub fn new() -> Self {
24677 std::default::Default::default()
24678 }
24679
24680 /// Sets the value of [parent][crate::model::CreateWorkflowTemplateRequest::parent].
24681 ///
24682 /// # Example
24683 /// ```ignore,no_run
24684 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
24685 /// let x = CreateWorkflowTemplateRequest::new().set_parent("example");
24686 /// ```
24687 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24688 self.parent = v.into();
24689 self
24690 }
24691
24692 /// Sets the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
24693 ///
24694 /// # Example
24695 /// ```ignore,no_run
24696 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
24697 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
24698 /// let x = CreateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
24699 /// ```
24700 pub fn set_template<T>(mut self, v: T) -> Self
24701 where
24702 T: std::convert::Into<crate::model::WorkflowTemplate>,
24703 {
24704 self.template = std::option::Option::Some(v.into());
24705 self
24706 }
24707
24708 /// Sets or clears the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
24709 ///
24710 /// # Example
24711 /// ```ignore,no_run
24712 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
24713 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
24714 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
24715 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
24716 /// ```
24717 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
24718 where
24719 T: std::convert::Into<crate::model::WorkflowTemplate>,
24720 {
24721 self.template = v.map(|x| x.into());
24722 self
24723 }
24724}
24725
24726impl wkt::message::Message for CreateWorkflowTemplateRequest {
24727 fn typename() -> &'static str {
24728 "type.googleapis.com/google.cloud.dataproc.v1.CreateWorkflowTemplateRequest"
24729 }
24730}
24731
24732/// A request to fetch a workflow template.
24733#[derive(Clone, Default, PartialEq)]
24734#[non_exhaustive]
24735pub struct GetWorkflowTemplateRequest {
24736 /// Required. The resource name of the workflow template, as described
24737 /// in <https://cloud.google.com/apis/design/resource_names>.
24738 ///
24739 /// * For `projects.regions.workflowTemplates.get`, the resource name of the
24740 /// template has the following format:
24741 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
24742 ///
24743 /// * For `projects.locations.workflowTemplates.get`, the resource name of the
24744 /// template has the following format:
24745 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
24746 ///
24747 pub name: std::string::String,
24748
24749 /// Optional. The version of workflow template to retrieve. Only previously
24750 /// instantiated versions can be retrieved.
24751 ///
24752 /// If unspecified, retrieves the current version.
24753 pub version: i32,
24754
24755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24756}
24757
24758impl GetWorkflowTemplateRequest {
24759 pub fn new() -> Self {
24760 std::default::Default::default()
24761 }
24762
24763 /// Sets the value of [name][crate::model::GetWorkflowTemplateRequest::name].
24764 ///
24765 /// # Example
24766 /// ```ignore,no_run
24767 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
24768 /// let x = GetWorkflowTemplateRequest::new().set_name("example");
24769 /// ```
24770 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24771 self.name = v.into();
24772 self
24773 }
24774
24775 /// Sets the value of [version][crate::model::GetWorkflowTemplateRequest::version].
24776 ///
24777 /// # Example
24778 /// ```ignore,no_run
24779 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
24780 /// let x = GetWorkflowTemplateRequest::new().set_version(42);
24781 /// ```
24782 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24783 self.version = v.into();
24784 self
24785 }
24786}
24787
24788impl wkt::message::Message for GetWorkflowTemplateRequest {
24789 fn typename() -> &'static str {
24790 "type.googleapis.com/google.cloud.dataproc.v1.GetWorkflowTemplateRequest"
24791 }
24792}
24793
24794/// A request to instantiate a workflow template.
24795#[derive(Clone, Default, PartialEq)]
24796#[non_exhaustive]
24797pub struct InstantiateWorkflowTemplateRequest {
24798 /// Required. The resource name of the workflow template, as described
24799 /// in <https://cloud.google.com/apis/design/resource_names>.
24800 ///
24801 /// * For `projects.regions.workflowTemplates.instantiate`, the resource name
24802 /// of the template has the following format:
24803 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
24804 ///
24805 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
24806 /// of the template has the following format:
24807 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
24808 ///
24809 pub name: std::string::String,
24810
24811 /// Optional. The version of workflow template to instantiate. If specified,
24812 /// the workflow will be instantiated only if the current version of
24813 /// the workflow template has the supplied version.
24814 ///
24815 /// This option cannot be used to instantiate a previous version of
24816 /// workflow template.
24817 pub version: i32,
24818
24819 /// Optional. A tag that prevents multiple concurrent workflow
24820 /// instances with the same tag from running. This mitigates risk of
24821 /// concurrent instances started due to retries.
24822 ///
24823 /// It is recommended to always set this value to a
24824 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
24825 ///
24826 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
24827 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
24828 pub request_id: std::string::String,
24829
24830 /// Optional. Map from parameter names to values that should be used for those
24831 /// parameters. Values may not exceed 1000 characters.
24832 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
24833
24834 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24835}
24836
24837impl InstantiateWorkflowTemplateRequest {
24838 pub fn new() -> Self {
24839 std::default::Default::default()
24840 }
24841
24842 /// Sets the value of [name][crate::model::InstantiateWorkflowTemplateRequest::name].
24843 ///
24844 /// # Example
24845 /// ```ignore,no_run
24846 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
24847 /// let x = InstantiateWorkflowTemplateRequest::new().set_name("example");
24848 /// ```
24849 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24850 self.name = v.into();
24851 self
24852 }
24853
24854 /// Sets the value of [version][crate::model::InstantiateWorkflowTemplateRequest::version].
24855 ///
24856 /// # Example
24857 /// ```ignore,no_run
24858 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
24859 /// let x = InstantiateWorkflowTemplateRequest::new().set_version(42);
24860 /// ```
24861 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24862 self.version = v.into();
24863 self
24864 }
24865
24866 /// Sets the value of [request_id][crate::model::InstantiateWorkflowTemplateRequest::request_id].
24867 ///
24868 /// # Example
24869 /// ```ignore,no_run
24870 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
24871 /// let x = InstantiateWorkflowTemplateRequest::new().set_request_id("example");
24872 /// ```
24873 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24874 self.request_id = v.into();
24875 self
24876 }
24877
24878 /// Sets the value of [parameters][crate::model::InstantiateWorkflowTemplateRequest::parameters].
24879 ///
24880 /// # Example
24881 /// ```ignore,no_run
24882 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
24883 /// let x = InstantiateWorkflowTemplateRequest::new().set_parameters([
24884 /// ("key0", "abc"),
24885 /// ("key1", "xyz"),
24886 /// ]);
24887 /// ```
24888 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
24889 where
24890 T: std::iter::IntoIterator<Item = (K, V)>,
24891 K: std::convert::Into<std::string::String>,
24892 V: std::convert::Into<std::string::String>,
24893 {
24894 use std::iter::Iterator;
24895 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24896 self
24897 }
24898}
24899
24900impl wkt::message::Message for InstantiateWorkflowTemplateRequest {
24901 fn typename() -> &'static str {
24902 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest"
24903 }
24904}
24905
24906/// A request to instantiate an inline workflow template.
24907#[derive(Clone, Default, PartialEq)]
24908#[non_exhaustive]
24909pub struct InstantiateInlineWorkflowTemplateRequest {
24910 /// Required. The resource name of the region or location, as described
24911 /// in <https://cloud.google.com/apis/design/resource_names>.
24912 ///
24913 /// * For `projects.regions.workflowTemplates,instantiateinline`, the resource
24914 /// name of the region has the following format:
24915 /// `projects/{project_id}/regions/{region}`
24916 ///
24917 /// * For `projects.locations.workflowTemplates.instantiateinline`, the
24918 /// resource name of the location has the following format:
24919 /// `projects/{project_id}/locations/{location}`
24920 ///
24921 pub parent: std::string::String,
24922
24923 /// Required. The workflow template to instantiate.
24924 pub template: std::option::Option<crate::model::WorkflowTemplate>,
24925
24926 /// Optional. A tag that prevents multiple concurrent workflow
24927 /// instances with the same tag from running. This mitigates risk of
24928 /// concurrent instances started due to retries.
24929 ///
24930 /// It is recommended to always set this value to a
24931 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
24932 ///
24933 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
24934 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
24935 pub request_id: std::string::String,
24936
24937 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24938}
24939
24940impl InstantiateInlineWorkflowTemplateRequest {
24941 pub fn new() -> Self {
24942 std::default::Default::default()
24943 }
24944
24945 /// Sets the value of [parent][crate::model::InstantiateInlineWorkflowTemplateRequest::parent].
24946 ///
24947 /// # Example
24948 /// ```ignore,no_run
24949 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
24950 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_parent("example");
24951 /// ```
24952 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24953 self.parent = v.into();
24954 self
24955 }
24956
24957 /// Sets the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
24958 ///
24959 /// # Example
24960 /// ```ignore,no_run
24961 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
24962 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
24963 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
24964 /// ```
24965 pub fn set_template<T>(mut self, v: T) -> Self
24966 where
24967 T: std::convert::Into<crate::model::WorkflowTemplate>,
24968 {
24969 self.template = std::option::Option::Some(v.into());
24970 self
24971 }
24972
24973 /// Sets or clears the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
24974 ///
24975 /// # Example
24976 /// ```ignore,no_run
24977 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
24978 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
24979 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
24980 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
24981 /// ```
24982 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
24983 where
24984 T: std::convert::Into<crate::model::WorkflowTemplate>,
24985 {
24986 self.template = v.map(|x| x.into());
24987 self
24988 }
24989
24990 /// Sets the value of [request_id][crate::model::InstantiateInlineWorkflowTemplateRequest::request_id].
24991 ///
24992 /// # Example
24993 /// ```ignore,no_run
24994 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
24995 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_request_id("example");
24996 /// ```
24997 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24998 self.request_id = v.into();
24999 self
25000 }
25001}
25002
25003impl wkt::message::Message for InstantiateInlineWorkflowTemplateRequest {
25004 fn typename() -> &'static str {
25005 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest"
25006 }
25007}
25008
25009/// A request to update a workflow template.
25010#[derive(Clone, Default, PartialEq)]
25011#[non_exhaustive]
25012pub struct UpdateWorkflowTemplateRequest {
25013 /// Required. The updated workflow template.
25014 ///
25015 /// The `template.version` field must match the current version.
25016 pub template: std::option::Option<crate::model::WorkflowTemplate>,
25017
25018 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25019}
25020
25021impl UpdateWorkflowTemplateRequest {
25022 pub fn new() -> Self {
25023 std::default::Default::default()
25024 }
25025
25026 /// Sets the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25027 ///
25028 /// # Example
25029 /// ```ignore,no_run
25030 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25031 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25032 /// let x = UpdateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25033 /// ```
25034 pub fn set_template<T>(mut self, v: T) -> Self
25035 where
25036 T: std::convert::Into<crate::model::WorkflowTemplate>,
25037 {
25038 self.template = std::option::Option::Some(v.into());
25039 self
25040 }
25041
25042 /// Sets or clears the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25043 ///
25044 /// # Example
25045 /// ```ignore,no_run
25046 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25047 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25048 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25049 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25050 /// ```
25051 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25052 where
25053 T: std::convert::Into<crate::model::WorkflowTemplate>,
25054 {
25055 self.template = v.map(|x| x.into());
25056 self
25057 }
25058}
25059
25060impl wkt::message::Message for UpdateWorkflowTemplateRequest {
25061 fn typename() -> &'static str {
25062 "type.googleapis.com/google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest"
25063 }
25064}
25065
25066/// A request to list workflow templates in a project.
25067#[derive(Clone, Default, PartialEq)]
25068#[non_exhaustive]
25069pub struct ListWorkflowTemplatesRequest {
25070 /// Required. The resource name of the region or location, as described
25071 /// in <https://cloud.google.com/apis/design/resource_names>.
25072 ///
25073 /// * For `projects.regions.workflowTemplates,list`, the resource
25074 /// name of the region has the following format:
25075 /// `projects/{project_id}/regions/{region}`
25076 ///
25077 /// * For `projects.locations.workflowTemplates.list`, the
25078 /// resource name of the location has the following format:
25079 /// `projects/{project_id}/locations/{location}`
25080 ///
25081 pub parent: std::string::String,
25082
25083 /// Optional. The maximum number of results to return in each response.
25084 pub page_size: i32,
25085
25086 /// Optional. The page token, returned by a previous call, to request the
25087 /// next page of results.
25088 pub page_token: std::string::String,
25089
25090 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25091}
25092
25093impl ListWorkflowTemplatesRequest {
25094 pub fn new() -> Self {
25095 std::default::Default::default()
25096 }
25097
25098 /// Sets the value of [parent][crate::model::ListWorkflowTemplatesRequest::parent].
25099 ///
25100 /// # Example
25101 /// ```ignore,no_run
25102 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25103 /// let x = ListWorkflowTemplatesRequest::new().set_parent("example");
25104 /// ```
25105 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25106 self.parent = v.into();
25107 self
25108 }
25109
25110 /// Sets the value of [page_size][crate::model::ListWorkflowTemplatesRequest::page_size].
25111 ///
25112 /// # Example
25113 /// ```ignore,no_run
25114 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25115 /// let x = ListWorkflowTemplatesRequest::new().set_page_size(42);
25116 /// ```
25117 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25118 self.page_size = v.into();
25119 self
25120 }
25121
25122 /// Sets the value of [page_token][crate::model::ListWorkflowTemplatesRequest::page_token].
25123 ///
25124 /// # Example
25125 /// ```ignore,no_run
25126 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25127 /// let x = ListWorkflowTemplatesRequest::new().set_page_token("example");
25128 /// ```
25129 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25130 self.page_token = v.into();
25131 self
25132 }
25133}
25134
25135impl wkt::message::Message for ListWorkflowTemplatesRequest {
25136 fn typename() -> &'static str {
25137 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesRequest"
25138 }
25139}
25140
25141/// A response to a request to list workflow templates in a project.
25142#[derive(Clone, Default, PartialEq)]
25143#[non_exhaustive]
25144pub struct ListWorkflowTemplatesResponse {
25145 /// Output only. WorkflowTemplates list.
25146 pub templates: std::vec::Vec<crate::model::WorkflowTemplate>,
25147
25148 /// Output only. This token is included in the response if there are more
25149 /// results to fetch. To fetch additional results, provide this value as the
25150 /// page_token in a subsequent \<code\>ListWorkflowTemplatesRequest\</code\>.
25151 pub next_page_token: std::string::String,
25152
25153 /// Output only. List of workflow templates that could not be included in the
25154 /// response. Attempting to get one of these resources may indicate why it was
25155 /// not included in the list response.
25156 pub unreachable: std::vec::Vec<std::string::String>,
25157
25158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25159}
25160
25161impl ListWorkflowTemplatesResponse {
25162 pub fn new() -> Self {
25163 std::default::Default::default()
25164 }
25165
25166 /// Sets the value of [templates][crate::model::ListWorkflowTemplatesResponse::templates].
25167 ///
25168 /// # Example
25169 /// ```ignore,no_run
25170 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25171 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25172 /// let x = ListWorkflowTemplatesResponse::new()
25173 /// .set_templates([
25174 /// WorkflowTemplate::default()/* use setters */,
25175 /// WorkflowTemplate::default()/* use (different) setters */,
25176 /// ]);
25177 /// ```
25178 pub fn set_templates<T, V>(mut self, v: T) -> Self
25179 where
25180 T: std::iter::IntoIterator<Item = V>,
25181 V: std::convert::Into<crate::model::WorkflowTemplate>,
25182 {
25183 use std::iter::Iterator;
25184 self.templates = v.into_iter().map(|i| i.into()).collect();
25185 self
25186 }
25187
25188 /// Sets the value of [next_page_token][crate::model::ListWorkflowTemplatesResponse::next_page_token].
25189 ///
25190 /// # Example
25191 /// ```ignore,no_run
25192 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25193 /// let x = ListWorkflowTemplatesResponse::new().set_next_page_token("example");
25194 /// ```
25195 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25196 self.next_page_token = v.into();
25197 self
25198 }
25199
25200 /// Sets the value of [unreachable][crate::model::ListWorkflowTemplatesResponse::unreachable].
25201 ///
25202 /// # Example
25203 /// ```ignore,no_run
25204 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25205 /// let x = ListWorkflowTemplatesResponse::new().set_unreachable(["a", "b", "c"]);
25206 /// ```
25207 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
25208 where
25209 T: std::iter::IntoIterator<Item = V>,
25210 V: std::convert::Into<std::string::String>,
25211 {
25212 use std::iter::Iterator;
25213 self.unreachable = v.into_iter().map(|i| i.into()).collect();
25214 self
25215 }
25216}
25217
25218impl wkt::message::Message for ListWorkflowTemplatesResponse {
25219 fn typename() -> &'static str {
25220 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesResponse"
25221 }
25222}
25223
25224#[doc(hidden)]
25225impl gax::paginator::internal::PageableResponse for ListWorkflowTemplatesResponse {
25226 type PageItem = crate::model::WorkflowTemplate;
25227
25228 fn items(self) -> std::vec::Vec<Self::PageItem> {
25229 self.templates
25230 }
25231
25232 fn next_page_token(&self) -> std::string::String {
25233 use std::clone::Clone;
25234 self.next_page_token.clone()
25235 }
25236}
25237
25238/// A request to delete a workflow template.
25239///
25240/// Currently started workflows will remain running.
25241#[derive(Clone, Default, PartialEq)]
25242#[non_exhaustive]
25243pub struct DeleteWorkflowTemplateRequest {
25244 /// Required. The resource name of the workflow template, as described
25245 /// in <https://cloud.google.com/apis/design/resource_names>.
25246 ///
25247 /// * For `projects.regions.workflowTemplates.delete`, the resource name
25248 /// of the template has the following format:
25249 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25250 ///
25251 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
25252 /// of the template has the following format:
25253 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25254 ///
25255 pub name: std::string::String,
25256
25257 /// Optional. The version of workflow template to delete. If specified,
25258 /// will only delete the template if the current server version matches
25259 /// specified version.
25260 pub version: i32,
25261
25262 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25263}
25264
25265impl DeleteWorkflowTemplateRequest {
25266 pub fn new() -> Self {
25267 std::default::Default::default()
25268 }
25269
25270 /// Sets the value of [name][crate::model::DeleteWorkflowTemplateRequest::name].
25271 ///
25272 /// # Example
25273 /// ```ignore,no_run
25274 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
25275 /// let x = DeleteWorkflowTemplateRequest::new().set_name("example");
25276 /// ```
25277 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25278 self.name = v.into();
25279 self
25280 }
25281
25282 /// Sets the value of [version][crate::model::DeleteWorkflowTemplateRequest::version].
25283 ///
25284 /// # Example
25285 /// ```ignore,no_run
25286 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
25287 /// let x = DeleteWorkflowTemplateRequest::new().set_version(42);
25288 /// ```
25289 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25290 self.version = v.into();
25291 self
25292 }
25293}
25294
25295impl wkt::message::Message for DeleteWorkflowTemplateRequest {
25296 fn typename() -> &'static str {
25297 "type.googleapis.com/google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest"
25298 }
25299}
25300
25301/// Cluster components that can be activated.
25302///
25303/// # Working with unknown values
25304///
25305/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25306/// additional enum variants at any time. Adding new variants is not considered
25307/// a breaking change. Applications should write their code in anticipation of:
25308///
25309/// - New values appearing in future releases of the client library, **and**
25310/// - New values received dynamically, without application changes.
25311///
25312/// Please consult the [Working with enums] section in the user guide for some
25313/// guidelines.
25314///
25315/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25316#[derive(Clone, Debug, PartialEq)]
25317#[non_exhaustive]
25318pub enum Component {
25319 /// Unspecified component. Specifying this will cause Cluster creation to fail.
25320 Unspecified,
25321 /// The Anaconda component is no longer supported or applicable to
25322 /// [supported Dataproc on Compute Engine image versions]
25323 /// (<https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-version-clusters#supported-dataproc-image-versions>).
25324 /// It cannot be activated on clusters created with supported Dataproc on
25325 /// Compute Engine image versions.
25326 Anaconda,
25327 /// Delta Lake.
25328 Delta,
25329 /// Docker
25330 Docker,
25331 /// The Druid query engine. (alpha)
25332 Druid,
25333 /// Flink
25334 Flink,
25335 /// HBase. (beta)
25336 Hbase,
25337 /// The Hive Web HCatalog (the REST service for accessing HCatalog).
25338 HiveWebhcat,
25339 /// Hudi.
25340 Hudi,
25341 /// Iceberg.
25342 Iceberg,
25343 /// The Jupyter Notebook.
25344 Jupyter,
25345 /// The Jupyter Kernel Gateway.
25346 JupyterKernelGateway,
25347 /// The Pig component.
25348 Pig,
25349 /// The Presto query engine.
25350 Presto,
25351 /// The Trino query engine.
25352 Trino,
25353 /// The Ranger service.
25354 Ranger,
25355 /// The Solr service.
25356 Solr,
25357 /// The Zeppelin notebook.
25358 Zeppelin,
25359 /// The Zookeeper service.
25360 Zookeeper,
25361 /// If set, the enum was initialized with an unknown value.
25362 ///
25363 /// Applications can examine the value using [Component::value] or
25364 /// [Component::name].
25365 UnknownValue(component::UnknownValue),
25366}
25367
25368#[doc(hidden)]
25369pub mod component {
25370 #[allow(unused_imports)]
25371 use super::*;
25372 #[derive(Clone, Debug, PartialEq)]
25373 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25374}
25375
25376impl Component {
25377 /// Gets the enum value.
25378 ///
25379 /// Returns `None` if the enum contains an unknown value deserialized from
25380 /// the string representation of enums.
25381 pub fn value(&self) -> std::option::Option<i32> {
25382 match self {
25383 Self::Unspecified => std::option::Option::Some(0),
25384 Self::Anaconda => std::option::Option::Some(5),
25385 Self::Delta => std::option::Option::Some(20),
25386 Self::Docker => std::option::Option::Some(13),
25387 Self::Druid => std::option::Option::Some(9),
25388 Self::Flink => std::option::Option::Some(14),
25389 Self::Hbase => std::option::Option::Some(11),
25390 Self::HiveWebhcat => std::option::Option::Some(3),
25391 Self::Hudi => std::option::Option::Some(18),
25392 Self::Iceberg => std::option::Option::Some(19),
25393 Self::Jupyter => std::option::Option::Some(1),
25394 Self::JupyterKernelGateway => std::option::Option::Some(22),
25395 Self::Pig => std::option::Option::Some(21),
25396 Self::Presto => std::option::Option::Some(6),
25397 Self::Trino => std::option::Option::Some(17),
25398 Self::Ranger => std::option::Option::Some(12),
25399 Self::Solr => std::option::Option::Some(10),
25400 Self::Zeppelin => std::option::Option::Some(4),
25401 Self::Zookeeper => std::option::Option::Some(8),
25402 Self::UnknownValue(u) => u.0.value(),
25403 }
25404 }
25405
25406 /// Gets the enum value as a string.
25407 ///
25408 /// Returns `None` if the enum contains an unknown value deserialized from
25409 /// the integer representation of enums.
25410 pub fn name(&self) -> std::option::Option<&str> {
25411 match self {
25412 Self::Unspecified => std::option::Option::Some("COMPONENT_UNSPECIFIED"),
25413 Self::Anaconda => std::option::Option::Some("ANACONDA"),
25414 Self::Delta => std::option::Option::Some("DELTA"),
25415 Self::Docker => std::option::Option::Some("DOCKER"),
25416 Self::Druid => std::option::Option::Some("DRUID"),
25417 Self::Flink => std::option::Option::Some("FLINK"),
25418 Self::Hbase => std::option::Option::Some("HBASE"),
25419 Self::HiveWebhcat => std::option::Option::Some("HIVE_WEBHCAT"),
25420 Self::Hudi => std::option::Option::Some("HUDI"),
25421 Self::Iceberg => std::option::Option::Some("ICEBERG"),
25422 Self::Jupyter => std::option::Option::Some("JUPYTER"),
25423 Self::JupyterKernelGateway => std::option::Option::Some("JUPYTER_KERNEL_GATEWAY"),
25424 Self::Pig => std::option::Option::Some("PIG"),
25425 Self::Presto => std::option::Option::Some("PRESTO"),
25426 Self::Trino => std::option::Option::Some("TRINO"),
25427 Self::Ranger => std::option::Option::Some("RANGER"),
25428 Self::Solr => std::option::Option::Some("SOLR"),
25429 Self::Zeppelin => std::option::Option::Some("ZEPPELIN"),
25430 Self::Zookeeper => std::option::Option::Some("ZOOKEEPER"),
25431 Self::UnknownValue(u) => u.0.name(),
25432 }
25433 }
25434}
25435
25436impl std::default::Default for Component {
25437 fn default() -> Self {
25438 use std::convert::From;
25439 Self::from(0)
25440 }
25441}
25442
25443impl std::fmt::Display for Component {
25444 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25445 wkt::internal::display_enum(f, self.name(), self.value())
25446 }
25447}
25448
25449impl std::convert::From<i32> for Component {
25450 fn from(value: i32) -> Self {
25451 match value {
25452 0 => Self::Unspecified,
25453 1 => Self::Jupyter,
25454 3 => Self::HiveWebhcat,
25455 4 => Self::Zeppelin,
25456 5 => Self::Anaconda,
25457 6 => Self::Presto,
25458 8 => Self::Zookeeper,
25459 9 => Self::Druid,
25460 10 => Self::Solr,
25461 11 => Self::Hbase,
25462 12 => Self::Ranger,
25463 13 => Self::Docker,
25464 14 => Self::Flink,
25465 17 => Self::Trino,
25466 18 => Self::Hudi,
25467 19 => Self::Iceberg,
25468 20 => Self::Delta,
25469 21 => Self::Pig,
25470 22 => Self::JupyterKernelGateway,
25471 _ => Self::UnknownValue(component::UnknownValue(
25472 wkt::internal::UnknownEnumValue::Integer(value),
25473 )),
25474 }
25475 }
25476}
25477
25478impl std::convert::From<&str> for Component {
25479 fn from(value: &str) -> Self {
25480 use std::string::ToString;
25481 match value {
25482 "COMPONENT_UNSPECIFIED" => Self::Unspecified,
25483 "ANACONDA" => Self::Anaconda,
25484 "DELTA" => Self::Delta,
25485 "DOCKER" => Self::Docker,
25486 "DRUID" => Self::Druid,
25487 "FLINK" => Self::Flink,
25488 "HBASE" => Self::Hbase,
25489 "HIVE_WEBHCAT" => Self::HiveWebhcat,
25490 "HUDI" => Self::Hudi,
25491 "ICEBERG" => Self::Iceberg,
25492 "JUPYTER" => Self::Jupyter,
25493 "JUPYTER_KERNEL_GATEWAY" => Self::JupyterKernelGateway,
25494 "PIG" => Self::Pig,
25495 "PRESTO" => Self::Presto,
25496 "TRINO" => Self::Trino,
25497 "RANGER" => Self::Ranger,
25498 "SOLR" => Self::Solr,
25499 "ZEPPELIN" => Self::Zeppelin,
25500 "ZOOKEEPER" => Self::Zookeeper,
25501 _ => Self::UnknownValue(component::UnknownValue(
25502 wkt::internal::UnknownEnumValue::String(value.to_string()),
25503 )),
25504 }
25505 }
25506}
25507
25508impl serde::ser::Serialize for Component {
25509 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25510 where
25511 S: serde::Serializer,
25512 {
25513 match self {
25514 Self::Unspecified => serializer.serialize_i32(0),
25515 Self::Anaconda => serializer.serialize_i32(5),
25516 Self::Delta => serializer.serialize_i32(20),
25517 Self::Docker => serializer.serialize_i32(13),
25518 Self::Druid => serializer.serialize_i32(9),
25519 Self::Flink => serializer.serialize_i32(14),
25520 Self::Hbase => serializer.serialize_i32(11),
25521 Self::HiveWebhcat => serializer.serialize_i32(3),
25522 Self::Hudi => serializer.serialize_i32(18),
25523 Self::Iceberg => serializer.serialize_i32(19),
25524 Self::Jupyter => serializer.serialize_i32(1),
25525 Self::JupyterKernelGateway => serializer.serialize_i32(22),
25526 Self::Pig => serializer.serialize_i32(21),
25527 Self::Presto => serializer.serialize_i32(6),
25528 Self::Trino => serializer.serialize_i32(17),
25529 Self::Ranger => serializer.serialize_i32(12),
25530 Self::Solr => serializer.serialize_i32(10),
25531 Self::Zeppelin => serializer.serialize_i32(4),
25532 Self::Zookeeper => serializer.serialize_i32(8),
25533 Self::UnknownValue(u) => u.0.serialize(serializer),
25534 }
25535 }
25536}
25537
25538impl<'de> serde::de::Deserialize<'de> for Component {
25539 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25540 where
25541 D: serde::Deserializer<'de>,
25542 {
25543 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Component>::new(
25544 ".google.cloud.dataproc.v1.Component",
25545 ))
25546 }
25547}
25548
25549/// Actions in response to failure of a resource associated with a cluster.
25550///
25551/// # Working with unknown values
25552///
25553/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25554/// additional enum variants at any time. Adding new variants is not considered
25555/// a breaking change. Applications should write their code in anticipation of:
25556///
25557/// - New values appearing in future releases of the client library, **and**
25558/// - New values received dynamically, without application changes.
25559///
25560/// Please consult the [Working with enums] section in the user guide for some
25561/// guidelines.
25562///
25563/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25564#[derive(Clone, Debug, PartialEq)]
25565#[non_exhaustive]
25566pub enum FailureAction {
25567 /// When FailureAction is unspecified, failure action defaults to NO_ACTION.
25568 Unspecified,
25569 /// Take no action on failure to create a cluster resource. NO_ACTION is the
25570 /// default.
25571 NoAction,
25572 /// Delete the failed cluster resource.
25573 Delete,
25574 /// If set, the enum was initialized with an unknown value.
25575 ///
25576 /// Applications can examine the value using [FailureAction::value] or
25577 /// [FailureAction::name].
25578 UnknownValue(failure_action::UnknownValue),
25579}
25580
25581#[doc(hidden)]
25582pub mod failure_action {
25583 #[allow(unused_imports)]
25584 use super::*;
25585 #[derive(Clone, Debug, PartialEq)]
25586 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25587}
25588
25589impl FailureAction {
25590 /// Gets the enum value.
25591 ///
25592 /// Returns `None` if the enum contains an unknown value deserialized from
25593 /// the string representation of enums.
25594 pub fn value(&self) -> std::option::Option<i32> {
25595 match self {
25596 Self::Unspecified => std::option::Option::Some(0),
25597 Self::NoAction => std::option::Option::Some(1),
25598 Self::Delete => std::option::Option::Some(2),
25599 Self::UnknownValue(u) => u.0.value(),
25600 }
25601 }
25602
25603 /// Gets the enum value as a string.
25604 ///
25605 /// Returns `None` if the enum contains an unknown value deserialized from
25606 /// the integer representation of enums.
25607 pub fn name(&self) -> std::option::Option<&str> {
25608 match self {
25609 Self::Unspecified => std::option::Option::Some("FAILURE_ACTION_UNSPECIFIED"),
25610 Self::NoAction => std::option::Option::Some("NO_ACTION"),
25611 Self::Delete => std::option::Option::Some("DELETE"),
25612 Self::UnknownValue(u) => u.0.name(),
25613 }
25614 }
25615}
25616
25617impl std::default::Default for FailureAction {
25618 fn default() -> Self {
25619 use std::convert::From;
25620 Self::from(0)
25621 }
25622}
25623
25624impl std::fmt::Display for FailureAction {
25625 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25626 wkt::internal::display_enum(f, self.name(), self.value())
25627 }
25628}
25629
25630impl std::convert::From<i32> for FailureAction {
25631 fn from(value: i32) -> Self {
25632 match value {
25633 0 => Self::Unspecified,
25634 1 => Self::NoAction,
25635 2 => Self::Delete,
25636 _ => Self::UnknownValue(failure_action::UnknownValue(
25637 wkt::internal::UnknownEnumValue::Integer(value),
25638 )),
25639 }
25640 }
25641}
25642
25643impl std::convert::From<&str> for FailureAction {
25644 fn from(value: &str) -> Self {
25645 use std::string::ToString;
25646 match value {
25647 "FAILURE_ACTION_UNSPECIFIED" => Self::Unspecified,
25648 "NO_ACTION" => Self::NoAction,
25649 "DELETE" => Self::Delete,
25650 _ => Self::UnknownValue(failure_action::UnknownValue(
25651 wkt::internal::UnknownEnumValue::String(value.to_string()),
25652 )),
25653 }
25654 }
25655}
25656
25657impl serde::ser::Serialize for FailureAction {
25658 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25659 where
25660 S: serde::Serializer,
25661 {
25662 match self {
25663 Self::Unspecified => serializer.serialize_i32(0),
25664 Self::NoAction => serializer.serialize_i32(1),
25665 Self::Delete => serializer.serialize_i32(2),
25666 Self::UnknownValue(u) => u.0.serialize(serializer),
25667 }
25668 }
25669}
25670
25671impl<'de> serde::de::Deserialize<'de> for FailureAction {
25672 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25673 where
25674 D: serde::Deserializer<'de>,
25675 {
25676 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureAction>::new(
25677 ".google.cloud.dataproc.v1.FailureAction",
25678 ))
25679 }
25680}