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 gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_type;
28extern crate lazy_static;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Describes an autoscaling policy for Dataproc cluster autoscaler.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct AutoscalingPolicy {
44 /// Required. The policy id.
45 ///
46 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
47 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
48 /// or hyphen. Must consist of between 3 and 50 characters.
49 pub id: std::string::String,
50
51 /// Output only. The "resource name" of the autoscaling policy, as described
52 /// in <https://cloud.google.com/apis/design/resource_names>.
53 ///
54 /// * For `projects.regions.autoscalingPolicies`, the resource name of the
55 /// policy has the following format:
56 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
57 ///
58 /// * For `projects.locations.autoscalingPolicies`, the resource name of the
59 /// policy has the following format:
60 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
61 ///
62 pub name: std::string::String,
63
64 /// Required. Describes how the autoscaler will operate for primary workers.
65 pub worker_config: std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
66
67 /// Optional. Describes how the autoscaler will operate for secondary workers.
68 pub secondary_worker_config:
69 std::option::Option<crate::model::InstanceGroupAutoscalingPolicyConfig>,
70
71 /// Optional. The labels to associate with this autoscaling policy.
72 /// Label **keys** must contain 1 to 63 characters, and must conform to
73 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
74 /// Label **values** may be empty, but, if present, must contain 1 to 63
75 /// characters, and must conform to [RFC
76 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
77 /// associated with an autoscaling policy.
78 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
79
80 /// Autoscaling algorithm for policy.
81 pub algorithm: std::option::Option<crate::model::autoscaling_policy::Algorithm>,
82
83 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
84}
85
86impl AutoscalingPolicy {
87 pub fn new() -> Self {
88 std::default::Default::default()
89 }
90
91 /// Sets the value of [id][crate::model::AutoscalingPolicy::id].
92 ///
93 /// # Example
94 /// ```ignore,no_run
95 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
96 /// let x = AutoscalingPolicy::new().set_id("example");
97 /// ```
98 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
99 self.id = v.into();
100 self
101 }
102
103 /// Sets the value of [name][crate::model::AutoscalingPolicy::name].
104 ///
105 /// # Example
106 /// ```ignore,no_run
107 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
108 /// let x = AutoscalingPolicy::new().set_name("example");
109 /// ```
110 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
111 self.name = v.into();
112 self
113 }
114
115 /// Sets the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
116 ///
117 /// # Example
118 /// ```ignore,no_run
119 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
120 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
121 /// let x = AutoscalingPolicy::new().set_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
122 /// ```
123 pub fn set_worker_config<T>(mut self, v: T) -> Self
124 where
125 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
126 {
127 self.worker_config = std::option::Option::Some(v.into());
128 self
129 }
130
131 /// Sets or clears the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
132 ///
133 /// # Example
134 /// ```ignore,no_run
135 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
136 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
137 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
138 /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
139 /// ```
140 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
141 where
142 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
143 {
144 self.worker_config = v.map(|x| x.into());
145 self
146 }
147
148 /// Sets the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
149 ///
150 /// # Example
151 /// ```ignore,no_run
152 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
153 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
154 /// let x = AutoscalingPolicy::new().set_secondary_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
155 /// ```
156 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
157 where
158 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
159 {
160 self.secondary_worker_config = std::option::Option::Some(v.into());
161 self
162 }
163
164 /// Sets or clears the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
165 ///
166 /// # Example
167 /// ```ignore,no_run
168 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
169 /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
170 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
171 /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
172 /// ```
173 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
174 where
175 T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
176 {
177 self.secondary_worker_config = v.map(|x| x.into());
178 self
179 }
180
181 /// Sets the value of [labels][crate::model::AutoscalingPolicy::labels].
182 ///
183 /// # Example
184 /// ```ignore,no_run
185 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
186 /// let x = AutoscalingPolicy::new().set_labels([
187 /// ("key0", "abc"),
188 /// ("key1", "xyz"),
189 /// ]);
190 /// ```
191 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
192 where
193 T: std::iter::IntoIterator<Item = (K, V)>,
194 K: std::convert::Into<std::string::String>,
195 V: std::convert::Into<std::string::String>,
196 {
197 use std::iter::Iterator;
198 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
199 self
200 }
201
202 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm].
203 ///
204 /// Note that all the setters affecting `algorithm` are mutually
205 /// exclusive.
206 ///
207 /// # Example
208 /// ```ignore,no_run
209 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
210 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
211 /// let x = AutoscalingPolicy::new().set_algorithm(Some(
212 /// google_cloud_dataproc_v1::model::autoscaling_policy::Algorithm::BasicAlgorithm(BasicAutoscalingAlgorithm::default().into())));
213 /// ```
214 pub fn set_algorithm<
215 T: std::convert::Into<std::option::Option<crate::model::autoscaling_policy::Algorithm>>,
216 >(
217 mut self,
218 v: T,
219 ) -> Self {
220 self.algorithm = v.into();
221 self
222 }
223
224 /// The value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
225 /// if it holds a `BasicAlgorithm`, `None` if the field is not set or
226 /// holds a different branch.
227 pub fn basic_algorithm(
228 &self,
229 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>> {
230 #[allow(unreachable_patterns)]
231 self.algorithm.as_ref().and_then(|v| match v {
232 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v) => {
233 std::option::Option::Some(v)
234 }
235 _ => std::option::Option::None,
236 })
237 }
238
239 /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
240 /// to hold a `BasicAlgorithm`.
241 ///
242 /// Note that all the setters affecting `algorithm` are
243 /// mutually exclusive.
244 ///
245 /// # Example
246 /// ```ignore,no_run
247 /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
248 /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
249 /// let x = AutoscalingPolicy::new().set_basic_algorithm(BasicAutoscalingAlgorithm::default()/* use setters */);
250 /// assert!(x.basic_algorithm().is_some());
251 /// ```
252 pub fn set_basic_algorithm<
253 T: std::convert::Into<std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>>,
254 >(
255 mut self,
256 v: T,
257 ) -> Self {
258 self.algorithm = std::option::Option::Some(
259 crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v.into()),
260 );
261 self
262 }
263}
264
265impl wkt::message::Message for AutoscalingPolicy {
266 fn typename() -> &'static str {
267 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingPolicy"
268 }
269}
270
271/// Defines additional types related to [AutoscalingPolicy].
272pub mod autoscaling_policy {
273 #[allow(unused_imports)]
274 use super::*;
275
276 /// Autoscaling algorithm for policy.
277 #[derive(Clone, Debug, PartialEq)]
278 #[non_exhaustive]
279 pub enum Algorithm {
280 BasicAlgorithm(std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>),
281 }
282}
283
284/// Basic algorithm for autoscaling.
285#[derive(Clone, Default, PartialEq)]
286#[non_exhaustive]
287pub struct BasicAutoscalingAlgorithm {
288 /// Optional. Duration between scaling events. A scaling period starts after
289 /// the update operation from the previous event has completed.
290 ///
291 /// Bounds: [2m, 1d]. Default: 2m.
292 pub cooldown_period: std::option::Option<wkt::Duration>,
293
294 pub config: std::option::Option<crate::model::basic_autoscaling_algorithm::Config>,
295
296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
297}
298
299impl BasicAutoscalingAlgorithm {
300 pub fn new() -> Self {
301 std::default::Default::default()
302 }
303
304 /// Sets the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
305 ///
306 /// # Example
307 /// ```ignore,no_run
308 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
309 /// use wkt::Duration;
310 /// let x = BasicAutoscalingAlgorithm::new().set_cooldown_period(Duration::default()/* use setters */);
311 /// ```
312 pub fn set_cooldown_period<T>(mut self, v: T) -> Self
313 where
314 T: std::convert::Into<wkt::Duration>,
315 {
316 self.cooldown_period = std::option::Option::Some(v.into());
317 self
318 }
319
320 /// Sets or clears the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
321 ///
322 /// # Example
323 /// ```ignore,no_run
324 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
325 /// use wkt::Duration;
326 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(Some(Duration::default()/* use setters */));
327 /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(None::<Duration>);
328 /// ```
329 pub fn set_or_clear_cooldown_period<T>(mut self, v: std::option::Option<T>) -> Self
330 where
331 T: std::convert::Into<wkt::Duration>,
332 {
333 self.cooldown_period = v.map(|x| x.into());
334 self
335 }
336
337 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config].
338 ///
339 /// Note that all the setters affecting `config` are mutually
340 /// exclusive.
341 ///
342 /// # Example
343 /// ```ignore,no_run
344 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
345 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
346 /// let x = BasicAutoscalingAlgorithm::new().set_config(Some(
347 /// google_cloud_dataproc_v1::model::basic_autoscaling_algorithm::Config::YarnConfig(BasicYarnAutoscalingConfig::default().into())));
348 /// ```
349 pub fn set_config<
350 T: std::convert::Into<std::option::Option<crate::model::basic_autoscaling_algorithm::Config>>,
351 >(
352 mut self,
353 v: T,
354 ) -> Self {
355 self.config = v.into();
356 self
357 }
358
359 /// The value of [config][crate::model::BasicAutoscalingAlgorithm::config]
360 /// if it holds a `YarnConfig`, `None` if the field is not set or
361 /// holds a different branch.
362 pub fn yarn_config(
363 &self,
364 ) -> std::option::Option<&std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>> {
365 #[allow(unreachable_patterns)]
366 self.config.as_ref().and_then(|v| match v {
367 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v) => {
368 std::option::Option::Some(v)
369 }
370 _ => std::option::Option::None,
371 })
372 }
373
374 /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config]
375 /// to hold a `YarnConfig`.
376 ///
377 /// Note that all the setters affecting `config` are
378 /// mutually exclusive.
379 ///
380 /// # Example
381 /// ```ignore,no_run
382 /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
383 /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
384 /// let x = BasicAutoscalingAlgorithm::new().set_yarn_config(BasicYarnAutoscalingConfig::default()/* use setters */);
385 /// assert!(x.yarn_config().is_some());
386 /// ```
387 pub fn set_yarn_config<
388 T: std::convert::Into<std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>>,
389 >(
390 mut self,
391 v: T,
392 ) -> Self {
393 self.config = std::option::Option::Some(
394 crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v.into()),
395 );
396 self
397 }
398}
399
400impl wkt::message::Message for BasicAutoscalingAlgorithm {
401 fn typename() -> &'static str {
402 "type.googleapis.com/google.cloud.dataproc.v1.BasicAutoscalingAlgorithm"
403 }
404}
405
406/// Defines additional types related to [BasicAutoscalingAlgorithm].
407pub mod basic_autoscaling_algorithm {
408 #[allow(unused_imports)]
409 use super::*;
410
411 #[derive(Clone, Debug, PartialEq)]
412 #[non_exhaustive]
413 pub enum Config {
414 /// Required. YARN autoscaling configuration.
415 YarnConfig(std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>),
416 }
417}
418
419/// Basic autoscaling configurations for YARN.
420#[derive(Clone, Default, PartialEq)]
421#[non_exhaustive]
422pub struct BasicYarnAutoscalingConfig {
423 /// Required. Timeout for YARN graceful decommissioning of Node Managers.
424 /// Specifies the duration to wait for jobs to complete before forcefully
425 /// removing workers (and potentially interrupting jobs). Only applicable to
426 /// downscaling operations.
427 ///
428 /// Bounds: [0s, 1d].
429 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
430
431 /// Required. Fraction of average YARN pending memory in the last cooldown
432 /// period for which to add workers. A scale-up factor of 1.0 will result in
433 /// scaling up so that there is no pending memory remaining after the update
434 /// (more aggressive scaling). A scale-up factor closer to 0 will result in a
435 /// smaller magnitude of scaling up (less aggressive scaling). See [How
436 /// autoscaling
437 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
438 /// for more information.
439 ///
440 /// Bounds: [0.0, 1.0].
441 pub scale_up_factor: f64,
442
443 /// Required. Fraction of average YARN pending memory in the last cooldown
444 /// period for which to remove workers. A scale-down factor of 1 will result in
445 /// scaling down so that there is no available memory remaining after the
446 /// update (more aggressive scaling). A scale-down factor of 0 disables
447 /// removing workers, which can be beneficial for autoscaling a single job.
448 /// See [How autoscaling
449 /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
450 /// for more information.
451 ///
452 /// Bounds: [0.0, 1.0].
453 pub scale_down_factor: f64,
454
455 /// Optional. Minimum scale-up threshold as a fraction of total cluster size
456 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
457 /// 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
458 /// the cluster to scale. A threshold of 0 means the autoscaler will scale up
459 /// on any recommended change.
460 ///
461 /// Bounds: [0.0, 1.0]. Default: 0.0.
462 pub scale_up_min_worker_fraction: f64,
463
464 /// Optional. Minimum scale-down threshold as a fraction of total cluster size
465 /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
466 /// 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
467 /// the cluster to scale. A threshold of 0 means the autoscaler will scale down
468 /// on any recommended change.
469 ///
470 /// Bounds: [0.0, 1.0]. Default: 0.0.
471 pub scale_down_min_worker_fraction: f64,
472
473 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
474}
475
476impl BasicYarnAutoscalingConfig {
477 pub fn new() -> Self {
478 std::default::Default::default()
479 }
480
481 /// Sets the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
482 ///
483 /// # Example
484 /// ```ignore,no_run
485 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
486 /// use wkt::Duration;
487 /// let x = BasicYarnAutoscalingConfig::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
488 /// ```
489 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
490 where
491 T: std::convert::Into<wkt::Duration>,
492 {
493 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
494 self
495 }
496
497 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
498 ///
499 /// # Example
500 /// ```ignore,no_run
501 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
502 /// use wkt::Duration;
503 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
504 /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
505 /// ```
506 pub fn set_or_clear_graceful_decommission_timeout<T>(
507 mut self,
508 v: std::option::Option<T>,
509 ) -> Self
510 where
511 T: std::convert::Into<wkt::Duration>,
512 {
513 self.graceful_decommission_timeout = v.map(|x| x.into());
514 self
515 }
516
517 /// Sets the value of [scale_up_factor][crate::model::BasicYarnAutoscalingConfig::scale_up_factor].
518 ///
519 /// # Example
520 /// ```ignore,no_run
521 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
522 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_factor(42.0);
523 /// ```
524 pub fn set_scale_up_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
525 self.scale_up_factor = v.into();
526 self
527 }
528
529 /// Sets the value of [scale_down_factor][crate::model::BasicYarnAutoscalingConfig::scale_down_factor].
530 ///
531 /// # Example
532 /// ```ignore,no_run
533 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
534 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_factor(42.0);
535 /// ```
536 pub fn set_scale_down_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
537 self.scale_down_factor = v.into();
538 self
539 }
540
541 /// Sets the value of [scale_up_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_up_min_worker_fraction].
542 ///
543 /// # Example
544 /// ```ignore,no_run
545 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
546 /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_min_worker_fraction(42.0);
547 /// ```
548 pub fn set_scale_up_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
549 self.scale_up_min_worker_fraction = v.into();
550 self
551 }
552
553 /// Sets the value of [scale_down_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_down_min_worker_fraction].
554 ///
555 /// # Example
556 /// ```ignore,no_run
557 /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
558 /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_min_worker_fraction(42.0);
559 /// ```
560 pub fn set_scale_down_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
561 self.scale_down_min_worker_fraction = v.into();
562 self
563 }
564}
565
566impl wkt::message::Message for BasicYarnAutoscalingConfig {
567 fn typename() -> &'static str {
568 "type.googleapis.com/google.cloud.dataproc.v1.BasicYarnAutoscalingConfig"
569 }
570}
571
572/// Configuration for the size bounds of an instance group, including its
573/// proportional size to other groups.
574#[derive(Clone, Default, PartialEq)]
575#[non_exhaustive]
576pub struct InstanceGroupAutoscalingPolicyConfig {
577 /// Optional. Minimum number of instances for this group.
578 ///
579 /// Primary workers - Bounds: [2, max_instances]. Default: 2.
580 /// Secondary workers - Bounds: [0, max_instances]. Default: 0.
581 pub min_instances: i32,
582
583 /// Required. Maximum number of instances for this group. Required for primary
584 /// workers. Note that by default, clusters will not use secondary workers.
585 /// Required for secondary workers if the minimum secondary instances is set.
586 ///
587 /// Primary workers - Bounds: [min_instances, ).
588 /// Secondary workers - Bounds: [min_instances, ). Default: 0.
589 pub max_instances: i32,
590
591 /// Optional. Weight for the instance group, which is used to determine the
592 /// fraction of total workers in the cluster from this instance group.
593 /// For example, if primary workers have weight 2, and secondary workers have
594 /// weight 1, the cluster will have approximately 2 primary workers for each
595 /// secondary worker.
596 ///
597 /// The cluster may not reach the specified balance if constrained
598 /// by min/max bounds or other autoscaling settings. For example, if
599 /// `max_instances` for secondary workers is 0, then only primary workers will
600 /// be added. The cluster can also be out of balance when created.
601 ///
602 /// If weight is not set on any instance group, the cluster will default to
603 /// equal weight for all groups: the cluster will attempt to maintain an equal
604 /// number of workers in each group within the configured size bounds for each
605 /// group. If weight is set for one group only, the cluster will default to
606 /// zero weight on the unset group. For example if weight is set only on
607 /// primary workers, the cluster will use primary workers only and no
608 /// secondary workers.
609 pub weight: i32,
610
611 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
612}
613
614impl InstanceGroupAutoscalingPolicyConfig {
615 pub fn new() -> Self {
616 std::default::Default::default()
617 }
618
619 /// Sets the value of [min_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::min_instances].
620 ///
621 /// # Example
622 /// ```ignore,no_run
623 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
624 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_min_instances(42);
625 /// ```
626 pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
627 self.min_instances = v.into();
628 self
629 }
630
631 /// Sets the value of [max_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::max_instances].
632 ///
633 /// # Example
634 /// ```ignore,no_run
635 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
636 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_max_instances(42);
637 /// ```
638 pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
639 self.max_instances = v.into();
640 self
641 }
642
643 /// Sets the value of [weight][crate::model::InstanceGroupAutoscalingPolicyConfig::weight].
644 ///
645 /// # Example
646 /// ```ignore,no_run
647 /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
648 /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_weight(42);
649 /// ```
650 pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
651 self.weight = v.into();
652 self
653 }
654}
655
656impl wkt::message::Message for InstanceGroupAutoscalingPolicyConfig {
657 fn typename() -> &'static str {
658 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig"
659 }
660}
661
662/// A request to create an autoscaling policy.
663#[derive(Clone, Default, PartialEq)]
664#[non_exhaustive]
665pub struct CreateAutoscalingPolicyRequest {
666 /// Required. The "resource name" of the region or location, as described
667 /// in <https://cloud.google.com/apis/design/resource_names>.
668 ///
669 /// * For `projects.regions.autoscalingPolicies.create`, the resource name
670 /// of the region has the following format:
671 /// `projects/{project_id}/regions/{region}`
672 ///
673 /// * For `projects.locations.autoscalingPolicies.create`, the resource name
674 /// of the location has the following format:
675 /// `projects/{project_id}/locations/{location}`
676 ///
677 pub parent: std::string::String,
678
679 /// Required. The autoscaling policy to create.
680 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
681
682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
683}
684
685impl CreateAutoscalingPolicyRequest {
686 pub fn new() -> Self {
687 std::default::Default::default()
688 }
689
690 /// Sets the value of [parent][crate::model::CreateAutoscalingPolicyRequest::parent].
691 ///
692 /// # Example
693 /// ```ignore,no_run
694 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
695 /// let x = CreateAutoscalingPolicyRequest::new().set_parent("example");
696 /// ```
697 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
698 self.parent = v.into();
699 self
700 }
701
702 /// Sets the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
703 ///
704 /// # Example
705 /// ```ignore,no_run
706 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
707 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
708 /// let x = CreateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
709 /// ```
710 pub fn set_policy<T>(mut self, v: T) -> Self
711 where
712 T: std::convert::Into<crate::model::AutoscalingPolicy>,
713 {
714 self.policy = std::option::Option::Some(v.into());
715 self
716 }
717
718 /// Sets or clears the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
719 ///
720 /// # Example
721 /// ```ignore,no_run
722 /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
723 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
724 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
725 /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
726 /// ```
727 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
728 where
729 T: std::convert::Into<crate::model::AutoscalingPolicy>,
730 {
731 self.policy = v.map(|x| x.into());
732 self
733 }
734}
735
736impl wkt::message::Message for CreateAutoscalingPolicyRequest {
737 fn typename() -> &'static str {
738 "type.googleapis.com/google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest"
739 }
740}
741
742/// A request to fetch an autoscaling policy.
743#[derive(Clone, Default, PartialEq)]
744#[non_exhaustive]
745pub struct GetAutoscalingPolicyRequest {
746 /// Required. The "resource name" of the autoscaling policy, as described
747 /// in <https://cloud.google.com/apis/design/resource_names>.
748 ///
749 /// * For `projects.regions.autoscalingPolicies.get`, the resource name
750 /// of the policy has the following format:
751 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
752 ///
753 /// * For `projects.locations.autoscalingPolicies.get`, the resource name
754 /// of the policy has the following format:
755 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
756 ///
757 pub name: std::string::String,
758
759 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
760}
761
762impl GetAutoscalingPolicyRequest {
763 pub fn new() -> Self {
764 std::default::Default::default()
765 }
766
767 /// Sets the value of [name][crate::model::GetAutoscalingPolicyRequest::name].
768 ///
769 /// # Example
770 /// ```ignore,no_run
771 /// # use google_cloud_dataproc_v1::model::GetAutoscalingPolicyRequest;
772 /// let x = GetAutoscalingPolicyRequest::new().set_name("example");
773 /// ```
774 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
775 self.name = v.into();
776 self
777 }
778}
779
780impl wkt::message::Message for GetAutoscalingPolicyRequest {
781 fn typename() -> &'static str {
782 "type.googleapis.com/google.cloud.dataproc.v1.GetAutoscalingPolicyRequest"
783 }
784}
785
786/// A request to update an autoscaling policy.
787#[derive(Clone, Default, PartialEq)]
788#[non_exhaustive]
789pub struct UpdateAutoscalingPolicyRequest {
790 /// Required. The updated autoscaling policy.
791 pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
792
793 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
794}
795
796impl UpdateAutoscalingPolicyRequest {
797 pub fn new() -> Self {
798 std::default::Default::default()
799 }
800
801 /// Sets the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
802 ///
803 /// # Example
804 /// ```ignore,no_run
805 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
806 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
807 /// let x = UpdateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
808 /// ```
809 pub fn set_policy<T>(mut self, v: T) -> Self
810 where
811 T: std::convert::Into<crate::model::AutoscalingPolicy>,
812 {
813 self.policy = std::option::Option::Some(v.into());
814 self
815 }
816
817 /// Sets or clears the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
818 ///
819 /// # Example
820 /// ```ignore,no_run
821 /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
822 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
823 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
824 /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
825 /// ```
826 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
827 where
828 T: std::convert::Into<crate::model::AutoscalingPolicy>,
829 {
830 self.policy = v.map(|x| x.into());
831 self
832 }
833}
834
835impl wkt::message::Message for UpdateAutoscalingPolicyRequest {
836 fn typename() -> &'static str {
837 "type.googleapis.com/google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest"
838 }
839}
840
841/// A request to delete an autoscaling policy.
842///
843/// Autoscaling policies in use by one or more clusters will not be deleted.
844#[derive(Clone, Default, PartialEq)]
845#[non_exhaustive]
846pub struct DeleteAutoscalingPolicyRequest {
847 /// Required. The "resource name" of the autoscaling policy, as described
848 /// in <https://cloud.google.com/apis/design/resource_names>.
849 ///
850 /// * For `projects.regions.autoscalingPolicies.delete`, the resource name
851 /// of the policy has the following format:
852 /// `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
853 ///
854 /// * For `projects.locations.autoscalingPolicies.delete`, the resource name
855 /// of the policy has the following format:
856 /// `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
857 ///
858 pub name: std::string::String,
859
860 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
861}
862
863impl DeleteAutoscalingPolicyRequest {
864 pub fn new() -> Self {
865 std::default::Default::default()
866 }
867
868 /// Sets the value of [name][crate::model::DeleteAutoscalingPolicyRequest::name].
869 ///
870 /// # Example
871 /// ```ignore,no_run
872 /// # use google_cloud_dataproc_v1::model::DeleteAutoscalingPolicyRequest;
873 /// let x = DeleteAutoscalingPolicyRequest::new().set_name("example");
874 /// ```
875 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
876 self.name = v.into();
877 self
878 }
879}
880
881impl wkt::message::Message for DeleteAutoscalingPolicyRequest {
882 fn typename() -> &'static str {
883 "type.googleapis.com/google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest"
884 }
885}
886
887/// A request to list autoscaling policies in a project.
888#[derive(Clone, Default, PartialEq)]
889#[non_exhaustive]
890pub struct ListAutoscalingPoliciesRequest {
891 /// Required. The "resource name" of the region or location, as described
892 /// in <https://cloud.google.com/apis/design/resource_names>.
893 ///
894 /// * For `projects.regions.autoscalingPolicies.list`, the resource name
895 /// of the region has the following format:
896 /// `projects/{project_id}/regions/{region}`
897 ///
898 /// * For `projects.locations.autoscalingPolicies.list`, the resource name
899 /// of the location has the following format:
900 /// `projects/{project_id}/locations/{location}`
901 ///
902 pub parent: std::string::String,
903
904 /// Optional. The maximum number of results to return in each response.
905 /// Must be less than or equal to 1000. Defaults to 100.
906 pub page_size: i32,
907
908 /// Optional. The page token, returned by a previous call, to request the
909 /// next page of results.
910 pub page_token: std::string::String,
911
912 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
913}
914
915impl ListAutoscalingPoliciesRequest {
916 pub fn new() -> Self {
917 std::default::Default::default()
918 }
919
920 /// Sets the value of [parent][crate::model::ListAutoscalingPoliciesRequest::parent].
921 ///
922 /// # Example
923 /// ```ignore,no_run
924 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
925 /// let x = ListAutoscalingPoliciesRequest::new().set_parent("example");
926 /// ```
927 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
928 self.parent = v.into();
929 self
930 }
931
932 /// Sets the value of [page_size][crate::model::ListAutoscalingPoliciesRequest::page_size].
933 ///
934 /// # Example
935 /// ```ignore,no_run
936 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
937 /// let x = ListAutoscalingPoliciesRequest::new().set_page_size(42);
938 /// ```
939 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
940 self.page_size = v.into();
941 self
942 }
943
944 /// Sets the value of [page_token][crate::model::ListAutoscalingPoliciesRequest::page_token].
945 ///
946 /// # Example
947 /// ```ignore,no_run
948 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
949 /// let x = ListAutoscalingPoliciesRequest::new().set_page_token("example");
950 /// ```
951 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
952 self.page_token = v.into();
953 self
954 }
955}
956
957impl wkt::message::Message for ListAutoscalingPoliciesRequest {
958 fn typename() -> &'static str {
959 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest"
960 }
961}
962
963/// A response to a request to list autoscaling policies in a project.
964#[derive(Clone, Default, PartialEq)]
965#[non_exhaustive]
966pub struct ListAutoscalingPoliciesResponse {
967 /// Output only. Autoscaling policies list.
968 pub policies: std::vec::Vec<crate::model::AutoscalingPolicy>,
969
970 /// Output only. This token is included in the response if there are more
971 /// results to fetch.
972 pub next_page_token: std::string::String,
973
974 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
975}
976
977impl ListAutoscalingPoliciesResponse {
978 pub fn new() -> Self {
979 std::default::Default::default()
980 }
981
982 /// Sets the value of [policies][crate::model::ListAutoscalingPoliciesResponse::policies].
983 ///
984 /// # Example
985 /// ```ignore,no_run
986 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
987 /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
988 /// let x = ListAutoscalingPoliciesResponse::new()
989 /// .set_policies([
990 /// AutoscalingPolicy::default()/* use setters */,
991 /// AutoscalingPolicy::default()/* use (different) setters */,
992 /// ]);
993 /// ```
994 pub fn set_policies<T, V>(mut self, v: T) -> Self
995 where
996 T: std::iter::IntoIterator<Item = V>,
997 V: std::convert::Into<crate::model::AutoscalingPolicy>,
998 {
999 use std::iter::Iterator;
1000 self.policies = v.into_iter().map(|i| i.into()).collect();
1001 self
1002 }
1003
1004 /// Sets the value of [next_page_token][crate::model::ListAutoscalingPoliciesResponse::next_page_token].
1005 ///
1006 /// # Example
1007 /// ```ignore,no_run
1008 /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1009 /// let x = ListAutoscalingPoliciesResponse::new().set_next_page_token("example");
1010 /// ```
1011 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1012 self.next_page_token = v.into();
1013 self
1014 }
1015}
1016
1017impl wkt::message::Message for ListAutoscalingPoliciesResponse {
1018 fn typename() -> &'static str {
1019 "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse"
1020 }
1021}
1022
1023#[doc(hidden)]
1024impl google_cloud_gax::paginator::internal::PageableResponse for ListAutoscalingPoliciesResponse {
1025 type PageItem = crate::model::AutoscalingPolicy;
1026
1027 fn items(self) -> std::vec::Vec<Self::PageItem> {
1028 self.policies
1029 }
1030
1031 fn next_page_token(&self) -> std::string::String {
1032 use std::clone::Clone;
1033 self.next_page_token.clone()
1034 }
1035}
1036
1037/// A request to create a batch workload.
1038#[derive(Clone, Default, PartialEq)]
1039#[non_exhaustive]
1040pub struct CreateBatchRequest {
1041 /// Required. The parent resource where this batch will be created.
1042 pub parent: std::string::String,
1043
1044 /// Required. The batch to create.
1045 pub batch: std::option::Option<crate::model::Batch>,
1046
1047 /// Optional. The ID to use for the batch, which will become the final
1048 /// component of the batch's resource name.
1049 ///
1050 /// This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
1051 pub batch_id: std::string::String,
1052
1053 /// Optional. A unique ID used to identify the request. If the service
1054 /// receives two
1055 /// [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
1056 /// with the same request_id, the second request is ignored and the
1057 /// Operation that corresponds to the first Batch created and stored
1058 /// in the backend is returned.
1059 ///
1060 /// Recommendation: Set this value to a
1061 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
1062 ///
1063 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
1064 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
1065 pub request_id: std::string::String,
1066
1067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1068}
1069
1070impl CreateBatchRequest {
1071 pub fn new() -> Self {
1072 std::default::Default::default()
1073 }
1074
1075 /// Sets the value of [parent][crate::model::CreateBatchRequest::parent].
1076 ///
1077 /// # Example
1078 /// ```ignore,no_run
1079 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1080 /// let x = CreateBatchRequest::new().set_parent("example");
1081 /// ```
1082 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1083 self.parent = v.into();
1084 self
1085 }
1086
1087 /// Sets the value of [batch][crate::model::CreateBatchRequest::batch].
1088 ///
1089 /// # Example
1090 /// ```ignore,no_run
1091 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1092 /// use google_cloud_dataproc_v1::model::Batch;
1093 /// let x = CreateBatchRequest::new().set_batch(Batch::default()/* use setters */);
1094 /// ```
1095 pub fn set_batch<T>(mut self, v: T) -> Self
1096 where
1097 T: std::convert::Into<crate::model::Batch>,
1098 {
1099 self.batch = std::option::Option::Some(v.into());
1100 self
1101 }
1102
1103 /// Sets or clears the value of [batch][crate::model::CreateBatchRequest::batch].
1104 ///
1105 /// # Example
1106 /// ```ignore,no_run
1107 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1108 /// use google_cloud_dataproc_v1::model::Batch;
1109 /// let x = CreateBatchRequest::new().set_or_clear_batch(Some(Batch::default()/* use setters */));
1110 /// let x = CreateBatchRequest::new().set_or_clear_batch(None::<Batch>);
1111 /// ```
1112 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1113 where
1114 T: std::convert::Into<crate::model::Batch>,
1115 {
1116 self.batch = v.map(|x| x.into());
1117 self
1118 }
1119
1120 /// Sets the value of [batch_id][crate::model::CreateBatchRequest::batch_id].
1121 ///
1122 /// # Example
1123 /// ```ignore,no_run
1124 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1125 /// let x = CreateBatchRequest::new().set_batch_id("example");
1126 /// ```
1127 pub fn set_batch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1128 self.batch_id = v.into();
1129 self
1130 }
1131
1132 /// Sets the value of [request_id][crate::model::CreateBatchRequest::request_id].
1133 ///
1134 /// # Example
1135 /// ```ignore,no_run
1136 /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1137 /// let x = CreateBatchRequest::new().set_request_id("example");
1138 /// ```
1139 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1140 self.request_id = v.into();
1141 self
1142 }
1143}
1144
1145impl wkt::message::Message for CreateBatchRequest {
1146 fn typename() -> &'static str {
1147 "type.googleapis.com/google.cloud.dataproc.v1.CreateBatchRequest"
1148 }
1149}
1150
1151/// A request to get the resource representation for a batch workload.
1152#[derive(Clone, Default, PartialEq)]
1153#[non_exhaustive]
1154pub struct GetBatchRequest {
1155 /// Required. The fully qualified name of the batch to retrieve
1156 /// in the format
1157 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1158 pub name: std::string::String,
1159
1160 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1161}
1162
1163impl GetBatchRequest {
1164 pub fn new() -> Self {
1165 std::default::Default::default()
1166 }
1167
1168 /// Sets the value of [name][crate::model::GetBatchRequest::name].
1169 ///
1170 /// # Example
1171 /// ```ignore,no_run
1172 /// # use google_cloud_dataproc_v1::model::GetBatchRequest;
1173 /// let x = GetBatchRequest::new().set_name("example");
1174 /// ```
1175 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1176 self.name = v.into();
1177 self
1178 }
1179}
1180
1181impl wkt::message::Message for GetBatchRequest {
1182 fn typename() -> &'static str {
1183 "type.googleapis.com/google.cloud.dataproc.v1.GetBatchRequest"
1184 }
1185}
1186
1187/// A request to list batch workloads in a project.
1188#[derive(Clone, Default, PartialEq)]
1189#[non_exhaustive]
1190pub struct ListBatchesRequest {
1191 /// Required. The parent, which owns this collection of batches.
1192 pub parent: std::string::String,
1193
1194 /// Optional. The maximum number of batches to return in each response.
1195 /// The service may return fewer than this value.
1196 /// The default page size is 20; the maximum page size is 1000.
1197 pub page_size: i32,
1198
1199 /// Optional. A page token received from a previous `ListBatches` call.
1200 /// Provide this token to retrieve the subsequent page.
1201 pub page_token: std::string::String,
1202
1203 /// Optional. A filter for the batches to return in the response.
1204 ///
1205 /// A filter is a logical expression constraining the values of various fields
1206 /// in each batch resource. Filters are case sensitive, and may contain
1207 /// multiple clauses combined with logical operators (AND/OR).
1208 /// Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`.
1209 ///
1210 /// e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"`
1211 /// filters for batches in state RUNNING that were created before 2023-01-01
1212 ///
1213 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
1214 /// description of the filter syntax and a list of supported comparisons.
1215 pub filter: std::string::String,
1216
1217 /// Optional. Field(s) on which to sort the list of batches.
1218 ///
1219 /// Currently the only supported sort orders are unspecified (empty) and
1220 /// `create_time desc` to sort by most recently created batches first.
1221 ///
1222 /// See <https://google.aip.dev/132#ordering> for more details.
1223 pub order_by: std::string::String,
1224
1225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1226}
1227
1228impl ListBatchesRequest {
1229 pub fn new() -> Self {
1230 std::default::Default::default()
1231 }
1232
1233 /// Sets the value of [parent][crate::model::ListBatchesRequest::parent].
1234 ///
1235 /// # Example
1236 /// ```ignore,no_run
1237 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1238 /// let x = ListBatchesRequest::new().set_parent("example");
1239 /// ```
1240 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1241 self.parent = v.into();
1242 self
1243 }
1244
1245 /// Sets the value of [page_size][crate::model::ListBatchesRequest::page_size].
1246 ///
1247 /// # Example
1248 /// ```ignore,no_run
1249 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1250 /// let x = ListBatchesRequest::new().set_page_size(42);
1251 /// ```
1252 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1253 self.page_size = v.into();
1254 self
1255 }
1256
1257 /// Sets the value of [page_token][crate::model::ListBatchesRequest::page_token].
1258 ///
1259 /// # Example
1260 /// ```ignore,no_run
1261 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1262 /// let x = ListBatchesRequest::new().set_page_token("example");
1263 /// ```
1264 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1265 self.page_token = v.into();
1266 self
1267 }
1268
1269 /// Sets the value of [filter][crate::model::ListBatchesRequest::filter].
1270 ///
1271 /// # Example
1272 /// ```ignore,no_run
1273 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1274 /// let x = ListBatchesRequest::new().set_filter("example");
1275 /// ```
1276 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1277 self.filter = v.into();
1278 self
1279 }
1280
1281 /// Sets the value of [order_by][crate::model::ListBatchesRequest::order_by].
1282 ///
1283 /// # Example
1284 /// ```ignore,no_run
1285 /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1286 /// let x = ListBatchesRequest::new().set_order_by("example");
1287 /// ```
1288 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1289 self.order_by = v.into();
1290 self
1291 }
1292}
1293
1294impl wkt::message::Message for ListBatchesRequest {
1295 fn typename() -> &'static str {
1296 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesRequest"
1297 }
1298}
1299
1300/// A list of batch workloads.
1301#[derive(Clone, Default, PartialEq)]
1302#[non_exhaustive]
1303pub struct ListBatchesResponse {
1304 /// The batches from the specified collection.
1305 pub batches: std::vec::Vec<crate::model::Batch>,
1306
1307 /// A token, which can be sent as `page_token` to retrieve the next page.
1308 /// If this field is omitted, there are no subsequent pages.
1309 pub next_page_token: std::string::String,
1310
1311 /// Output only. List of Batches that could not be included in the response.
1312 /// Attempting to get one of these resources may indicate why it was not
1313 /// included in the list response.
1314 pub unreachable: std::vec::Vec<std::string::String>,
1315
1316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1317}
1318
1319impl ListBatchesResponse {
1320 pub fn new() -> Self {
1321 std::default::Default::default()
1322 }
1323
1324 /// Sets the value of [batches][crate::model::ListBatchesResponse::batches].
1325 ///
1326 /// # Example
1327 /// ```ignore,no_run
1328 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1329 /// use google_cloud_dataproc_v1::model::Batch;
1330 /// let x = ListBatchesResponse::new()
1331 /// .set_batches([
1332 /// Batch::default()/* use setters */,
1333 /// Batch::default()/* use (different) setters */,
1334 /// ]);
1335 /// ```
1336 pub fn set_batches<T, V>(mut self, v: T) -> Self
1337 where
1338 T: std::iter::IntoIterator<Item = V>,
1339 V: std::convert::Into<crate::model::Batch>,
1340 {
1341 use std::iter::Iterator;
1342 self.batches = v.into_iter().map(|i| i.into()).collect();
1343 self
1344 }
1345
1346 /// Sets the value of [next_page_token][crate::model::ListBatchesResponse::next_page_token].
1347 ///
1348 /// # Example
1349 /// ```ignore,no_run
1350 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1351 /// let x = ListBatchesResponse::new().set_next_page_token("example");
1352 /// ```
1353 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1354 self.next_page_token = v.into();
1355 self
1356 }
1357
1358 /// Sets the value of [unreachable][crate::model::ListBatchesResponse::unreachable].
1359 ///
1360 /// # Example
1361 /// ```ignore,no_run
1362 /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1363 /// let x = ListBatchesResponse::new().set_unreachable(["a", "b", "c"]);
1364 /// ```
1365 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1366 where
1367 T: std::iter::IntoIterator<Item = V>,
1368 V: std::convert::Into<std::string::String>,
1369 {
1370 use std::iter::Iterator;
1371 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1372 self
1373 }
1374}
1375
1376impl wkt::message::Message for ListBatchesResponse {
1377 fn typename() -> &'static str {
1378 "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesResponse"
1379 }
1380}
1381
1382#[doc(hidden)]
1383impl google_cloud_gax::paginator::internal::PageableResponse for ListBatchesResponse {
1384 type PageItem = crate::model::Batch;
1385
1386 fn items(self) -> std::vec::Vec<Self::PageItem> {
1387 self.batches
1388 }
1389
1390 fn next_page_token(&self) -> std::string::String {
1391 use std::clone::Clone;
1392 self.next_page_token.clone()
1393 }
1394}
1395
1396/// A request to delete a batch workload.
1397#[derive(Clone, Default, PartialEq)]
1398#[non_exhaustive]
1399pub struct DeleteBatchRequest {
1400 /// Required. The fully qualified name of the batch to retrieve
1401 /// in the format
1402 /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1403 pub name: std::string::String,
1404
1405 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1406}
1407
1408impl DeleteBatchRequest {
1409 pub fn new() -> Self {
1410 std::default::Default::default()
1411 }
1412
1413 /// Sets the value of [name][crate::model::DeleteBatchRequest::name].
1414 ///
1415 /// # Example
1416 /// ```ignore,no_run
1417 /// # use google_cloud_dataproc_v1::model::DeleteBatchRequest;
1418 /// let x = DeleteBatchRequest::new().set_name("example");
1419 /// ```
1420 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1421 self.name = v.into();
1422 self
1423 }
1424}
1425
1426impl wkt::message::Message for DeleteBatchRequest {
1427 fn typename() -> &'static str {
1428 "type.googleapis.com/google.cloud.dataproc.v1.DeleteBatchRequest"
1429 }
1430}
1431
1432/// A representation of a batch workload in the service.
1433#[derive(Clone, Default, PartialEq)]
1434#[non_exhaustive]
1435pub struct Batch {
1436 /// Output only. The resource name of the batch.
1437 pub name: std::string::String,
1438
1439 /// Output only. A batch UUID (Unique Universal Identifier). The service
1440 /// generates this value when it creates the batch.
1441 pub uuid: std::string::String,
1442
1443 /// Output only. The time when the batch was created.
1444 pub create_time: std::option::Option<wkt::Timestamp>,
1445
1446 /// Output only. Runtime information about batch execution.
1447 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
1448
1449 /// Output only. The state of the batch.
1450 pub state: crate::model::batch::State,
1451
1452 /// Output only. Batch state details, such as a failure
1453 /// description if the state is `FAILED`.
1454 pub state_message: std::string::String,
1455
1456 /// Output only. The time when the batch entered a current state.
1457 pub state_time: std::option::Option<wkt::Timestamp>,
1458
1459 /// Output only. The email address of the user who created the batch.
1460 pub creator: std::string::String,
1461
1462 /// Optional. The labels to associate with this batch.
1463 /// Label **keys** must contain 1 to 63 characters, and must conform to
1464 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
1465 /// Label **values** may be empty, but, if present, must contain 1 to 63
1466 /// characters, and must conform to [RFC
1467 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
1468 /// associated with a batch.
1469 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1470
1471 /// Optional. Runtime configuration for the batch execution.
1472 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
1473
1474 /// Optional. Environment configuration for the batch execution.
1475 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
1476
1477 /// Output only. The resource name of the operation associated with this batch.
1478 pub operation: std::string::String,
1479
1480 /// Output only. Historical state information for the batch.
1481 pub state_history: std::vec::Vec<crate::model::batch::StateHistory>,
1482
1483 /// The application/framework-specific portion of the batch configuration.
1484 pub batch_config: std::option::Option<crate::model::batch::BatchConfig>,
1485
1486 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1487}
1488
1489impl Batch {
1490 pub fn new() -> Self {
1491 std::default::Default::default()
1492 }
1493
1494 /// Sets the value of [name][crate::model::Batch::name].
1495 ///
1496 /// # Example
1497 /// ```ignore,no_run
1498 /// # use google_cloud_dataproc_v1::model::Batch;
1499 /// let x = Batch::new().set_name("example");
1500 /// ```
1501 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1502 self.name = v.into();
1503 self
1504 }
1505
1506 /// Sets the value of [uuid][crate::model::Batch::uuid].
1507 ///
1508 /// # Example
1509 /// ```ignore,no_run
1510 /// # use google_cloud_dataproc_v1::model::Batch;
1511 /// let x = Batch::new().set_uuid("example");
1512 /// ```
1513 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1514 self.uuid = v.into();
1515 self
1516 }
1517
1518 /// Sets the value of [create_time][crate::model::Batch::create_time].
1519 ///
1520 /// # Example
1521 /// ```ignore,no_run
1522 /// # use google_cloud_dataproc_v1::model::Batch;
1523 /// use wkt::Timestamp;
1524 /// let x = Batch::new().set_create_time(Timestamp::default()/* use setters */);
1525 /// ```
1526 pub fn set_create_time<T>(mut self, v: T) -> Self
1527 where
1528 T: std::convert::Into<wkt::Timestamp>,
1529 {
1530 self.create_time = std::option::Option::Some(v.into());
1531 self
1532 }
1533
1534 /// Sets or clears the value of [create_time][crate::model::Batch::create_time].
1535 ///
1536 /// # Example
1537 /// ```ignore,no_run
1538 /// # use google_cloud_dataproc_v1::model::Batch;
1539 /// use wkt::Timestamp;
1540 /// let x = Batch::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1541 /// let x = Batch::new().set_or_clear_create_time(None::<Timestamp>);
1542 /// ```
1543 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1544 where
1545 T: std::convert::Into<wkt::Timestamp>,
1546 {
1547 self.create_time = v.map(|x| x.into());
1548 self
1549 }
1550
1551 /// Sets the value of [runtime_info][crate::model::Batch::runtime_info].
1552 ///
1553 /// # Example
1554 /// ```ignore,no_run
1555 /// # use google_cloud_dataproc_v1::model::Batch;
1556 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1557 /// let x = Batch::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
1558 /// ```
1559 pub fn set_runtime_info<T>(mut self, v: T) -> Self
1560 where
1561 T: std::convert::Into<crate::model::RuntimeInfo>,
1562 {
1563 self.runtime_info = std::option::Option::Some(v.into());
1564 self
1565 }
1566
1567 /// Sets or clears the value of [runtime_info][crate::model::Batch::runtime_info].
1568 ///
1569 /// # Example
1570 /// ```ignore,no_run
1571 /// # use google_cloud_dataproc_v1::model::Batch;
1572 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1573 /// let x = Batch::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
1574 /// let x = Batch::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
1575 /// ```
1576 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
1577 where
1578 T: std::convert::Into<crate::model::RuntimeInfo>,
1579 {
1580 self.runtime_info = v.map(|x| x.into());
1581 self
1582 }
1583
1584 /// Sets the value of [state][crate::model::Batch::state].
1585 ///
1586 /// # Example
1587 /// ```ignore,no_run
1588 /// # use google_cloud_dataproc_v1::model::Batch;
1589 /// use google_cloud_dataproc_v1::model::batch::State;
1590 /// let x0 = Batch::new().set_state(State::Pending);
1591 /// let x1 = Batch::new().set_state(State::Running);
1592 /// let x2 = Batch::new().set_state(State::Cancelling);
1593 /// ```
1594 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(mut self, v: T) -> Self {
1595 self.state = v.into();
1596 self
1597 }
1598
1599 /// Sets the value of [state_message][crate::model::Batch::state_message].
1600 ///
1601 /// # Example
1602 /// ```ignore,no_run
1603 /// # use google_cloud_dataproc_v1::model::Batch;
1604 /// let x = Batch::new().set_state_message("example");
1605 /// ```
1606 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1607 self.state_message = v.into();
1608 self
1609 }
1610
1611 /// Sets the value of [state_time][crate::model::Batch::state_time].
1612 ///
1613 /// # Example
1614 /// ```ignore,no_run
1615 /// # use google_cloud_dataproc_v1::model::Batch;
1616 /// use wkt::Timestamp;
1617 /// let x = Batch::new().set_state_time(Timestamp::default()/* use setters */);
1618 /// ```
1619 pub fn set_state_time<T>(mut self, v: T) -> Self
1620 where
1621 T: std::convert::Into<wkt::Timestamp>,
1622 {
1623 self.state_time = std::option::Option::Some(v.into());
1624 self
1625 }
1626
1627 /// Sets or clears the value of [state_time][crate::model::Batch::state_time].
1628 ///
1629 /// # Example
1630 /// ```ignore,no_run
1631 /// # use google_cloud_dataproc_v1::model::Batch;
1632 /// use wkt::Timestamp;
1633 /// let x = Batch::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
1634 /// let x = Batch::new().set_or_clear_state_time(None::<Timestamp>);
1635 /// ```
1636 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
1637 where
1638 T: std::convert::Into<wkt::Timestamp>,
1639 {
1640 self.state_time = v.map(|x| x.into());
1641 self
1642 }
1643
1644 /// Sets the value of [creator][crate::model::Batch::creator].
1645 ///
1646 /// # Example
1647 /// ```ignore,no_run
1648 /// # use google_cloud_dataproc_v1::model::Batch;
1649 /// let x = Batch::new().set_creator("example");
1650 /// ```
1651 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1652 self.creator = v.into();
1653 self
1654 }
1655
1656 /// Sets the value of [labels][crate::model::Batch::labels].
1657 ///
1658 /// # Example
1659 /// ```ignore,no_run
1660 /// # use google_cloud_dataproc_v1::model::Batch;
1661 /// let x = Batch::new().set_labels([
1662 /// ("key0", "abc"),
1663 /// ("key1", "xyz"),
1664 /// ]);
1665 /// ```
1666 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1667 where
1668 T: std::iter::IntoIterator<Item = (K, V)>,
1669 K: std::convert::Into<std::string::String>,
1670 V: std::convert::Into<std::string::String>,
1671 {
1672 use std::iter::Iterator;
1673 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1674 self
1675 }
1676
1677 /// Sets the value of [runtime_config][crate::model::Batch::runtime_config].
1678 ///
1679 /// # Example
1680 /// ```ignore,no_run
1681 /// # use google_cloud_dataproc_v1::model::Batch;
1682 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1683 /// let x = Batch::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
1684 /// ```
1685 pub fn set_runtime_config<T>(mut self, v: T) -> Self
1686 where
1687 T: std::convert::Into<crate::model::RuntimeConfig>,
1688 {
1689 self.runtime_config = std::option::Option::Some(v.into());
1690 self
1691 }
1692
1693 /// Sets or clears the value of [runtime_config][crate::model::Batch::runtime_config].
1694 ///
1695 /// # Example
1696 /// ```ignore,no_run
1697 /// # use google_cloud_dataproc_v1::model::Batch;
1698 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1699 /// let x = Batch::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
1700 /// let x = Batch::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
1701 /// ```
1702 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
1703 where
1704 T: std::convert::Into<crate::model::RuntimeConfig>,
1705 {
1706 self.runtime_config = v.map(|x| x.into());
1707 self
1708 }
1709
1710 /// Sets the value of [environment_config][crate::model::Batch::environment_config].
1711 ///
1712 /// # Example
1713 /// ```ignore,no_run
1714 /// # use google_cloud_dataproc_v1::model::Batch;
1715 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1716 /// let x = Batch::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
1717 /// ```
1718 pub fn set_environment_config<T>(mut self, v: T) -> Self
1719 where
1720 T: std::convert::Into<crate::model::EnvironmentConfig>,
1721 {
1722 self.environment_config = std::option::Option::Some(v.into());
1723 self
1724 }
1725
1726 /// Sets or clears the value of [environment_config][crate::model::Batch::environment_config].
1727 ///
1728 /// # Example
1729 /// ```ignore,no_run
1730 /// # use google_cloud_dataproc_v1::model::Batch;
1731 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1732 /// let x = Batch::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
1733 /// let x = Batch::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
1734 /// ```
1735 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
1736 where
1737 T: std::convert::Into<crate::model::EnvironmentConfig>,
1738 {
1739 self.environment_config = v.map(|x| x.into());
1740 self
1741 }
1742
1743 /// Sets the value of [operation][crate::model::Batch::operation].
1744 ///
1745 /// # Example
1746 /// ```ignore,no_run
1747 /// # use google_cloud_dataproc_v1::model::Batch;
1748 /// let x = Batch::new().set_operation("example");
1749 /// ```
1750 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1751 self.operation = v.into();
1752 self
1753 }
1754
1755 /// Sets the value of [state_history][crate::model::Batch::state_history].
1756 ///
1757 /// # Example
1758 /// ```ignore,no_run
1759 /// # use google_cloud_dataproc_v1::model::Batch;
1760 /// use google_cloud_dataproc_v1::model::batch::StateHistory;
1761 /// let x = Batch::new()
1762 /// .set_state_history([
1763 /// StateHistory::default()/* use setters */,
1764 /// StateHistory::default()/* use (different) setters */,
1765 /// ]);
1766 /// ```
1767 pub fn set_state_history<T, V>(mut self, v: T) -> Self
1768 where
1769 T: std::iter::IntoIterator<Item = V>,
1770 V: std::convert::Into<crate::model::batch::StateHistory>,
1771 {
1772 use std::iter::Iterator;
1773 self.state_history = v.into_iter().map(|i| i.into()).collect();
1774 self
1775 }
1776
1777 /// Sets the value of [batch_config][crate::model::Batch::batch_config].
1778 ///
1779 /// Note that all the setters affecting `batch_config` are mutually
1780 /// exclusive.
1781 ///
1782 /// # Example
1783 /// ```ignore,no_run
1784 /// # use google_cloud_dataproc_v1::model::Batch;
1785 /// use google_cloud_dataproc_v1::model::PySparkBatch;
1786 /// let x = Batch::new().set_batch_config(Some(
1787 /// google_cloud_dataproc_v1::model::batch::BatchConfig::PysparkBatch(PySparkBatch::default().into())));
1788 /// ```
1789 pub fn set_batch_config<
1790 T: std::convert::Into<std::option::Option<crate::model::batch::BatchConfig>>,
1791 >(
1792 mut self,
1793 v: T,
1794 ) -> Self {
1795 self.batch_config = v.into();
1796 self
1797 }
1798
1799 /// The value of [batch_config][crate::model::Batch::batch_config]
1800 /// if it holds a `PysparkBatch`, `None` if the field is not set or
1801 /// holds a different branch.
1802 pub fn pyspark_batch(
1803 &self,
1804 ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkBatch>> {
1805 #[allow(unreachable_patterns)]
1806 self.batch_config.as_ref().and_then(|v| match v {
1807 crate::model::batch::BatchConfig::PysparkBatch(v) => std::option::Option::Some(v),
1808 _ => std::option::Option::None,
1809 })
1810 }
1811
1812 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1813 /// to hold a `PysparkBatch`.
1814 ///
1815 /// Note that all the setters affecting `batch_config` are
1816 /// mutually exclusive.
1817 ///
1818 /// # Example
1819 /// ```ignore,no_run
1820 /// # use google_cloud_dataproc_v1::model::Batch;
1821 /// use google_cloud_dataproc_v1::model::PySparkBatch;
1822 /// let x = Batch::new().set_pyspark_batch(PySparkBatch::default()/* use setters */);
1823 /// assert!(x.pyspark_batch().is_some());
1824 /// assert!(x.spark_batch().is_none());
1825 /// assert!(x.spark_r_batch().is_none());
1826 /// assert!(x.spark_sql_batch().is_none());
1827 /// ```
1828 pub fn set_pyspark_batch<T: std::convert::Into<std::boxed::Box<crate::model::PySparkBatch>>>(
1829 mut self,
1830 v: T,
1831 ) -> Self {
1832 self.batch_config =
1833 std::option::Option::Some(crate::model::batch::BatchConfig::PysparkBatch(v.into()));
1834 self
1835 }
1836
1837 /// The value of [batch_config][crate::model::Batch::batch_config]
1838 /// if it holds a `SparkBatch`, `None` if the field is not set or
1839 /// holds a different branch.
1840 pub fn spark_batch(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkBatch>> {
1841 #[allow(unreachable_patterns)]
1842 self.batch_config.as_ref().and_then(|v| match v {
1843 crate::model::batch::BatchConfig::SparkBatch(v) => std::option::Option::Some(v),
1844 _ => std::option::Option::None,
1845 })
1846 }
1847
1848 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1849 /// to hold a `SparkBatch`.
1850 ///
1851 /// Note that all the setters affecting `batch_config` are
1852 /// mutually exclusive.
1853 ///
1854 /// # Example
1855 /// ```ignore,no_run
1856 /// # use google_cloud_dataproc_v1::model::Batch;
1857 /// use google_cloud_dataproc_v1::model::SparkBatch;
1858 /// let x = Batch::new().set_spark_batch(SparkBatch::default()/* use setters */);
1859 /// assert!(x.spark_batch().is_some());
1860 /// assert!(x.pyspark_batch().is_none());
1861 /// assert!(x.spark_r_batch().is_none());
1862 /// assert!(x.spark_sql_batch().is_none());
1863 /// ```
1864 pub fn set_spark_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkBatch>>>(
1865 mut self,
1866 v: T,
1867 ) -> Self {
1868 self.batch_config =
1869 std::option::Option::Some(crate::model::batch::BatchConfig::SparkBatch(v.into()));
1870 self
1871 }
1872
1873 /// The value of [batch_config][crate::model::Batch::batch_config]
1874 /// if it holds a `SparkRBatch`, `None` if the field is not set or
1875 /// holds a different branch.
1876 pub fn spark_r_batch(
1877 &self,
1878 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkRBatch>> {
1879 #[allow(unreachable_patterns)]
1880 self.batch_config.as_ref().and_then(|v| match v {
1881 crate::model::batch::BatchConfig::SparkRBatch(v) => std::option::Option::Some(v),
1882 _ => std::option::Option::None,
1883 })
1884 }
1885
1886 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1887 /// to hold a `SparkRBatch`.
1888 ///
1889 /// Note that all the setters affecting `batch_config` are
1890 /// mutually exclusive.
1891 ///
1892 /// # Example
1893 /// ```ignore,no_run
1894 /// # use google_cloud_dataproc_v1::model::Batch;
1895 /// use google_cloud_dataproc_v1::model::SparkRBatch;
1896 /// let x = Batch::new().set_spark_r_batch(SparkRBatch::default()/* use setters */);
1897 /// assert!(x.spark_r_batch().is_some());
1898 /// assert!(x.pyspark_batch().is_none());
1899 /// assert!(x.spark_batch().is_none());
1900 /// assert!(x.spark_sql_batch().is_none());
1901 /// ```
1902 pub fn set_spark_r_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkRBatch>>>(
1903 mut self,
1904 v: T,
1905 ) -> Self {
1906 self.batch_config =
1907 std::option::Option::Some(crate::model::batch::BatchConfig::SparkRBatch(v.into()));
1908 self
1909 }
1910
1911 /// The value of [batch_config][crate::model::Batch::batch_config]
1912 /// if it holds a `SparkSqlBatch`, `None` if the field is not set or
1913 /// holds a different branch.
1914 pub fn spark_sql_batch(
1915 &self,
1916 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlBatch>> {
1917 #[allow(unreachable_patterns)]
1918 self.batch_config.as_ref().and_then(|v| match v {
1919 crate::model::batch::BatchConfig::SparkSqlBatch(v) => std::option::Option::Some(v),
1920 _ => std::option::Option::None,
1921 })
1922 }
1923
1924 /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1925 /// to hold a `SparkSqlBatch`.
1926 ///
1927 /// Note that all the setters affecting `batch_config` are
1928 /// mutually exclusive.
1929 ///
1930 /// # Example
1931 /// ```ignore,no_run
1932 /// # use google_cloud_dataproc_v1::model::Batch;
1933 /// use google_cloud_dataproc_v1::model::SparkSqlBatch;
1934 /// let x = Batch::new().set_spark_sql_batch(SparkSqlBatch::default()/* use setters */);
1935 /// assert!(x.spark_sql_batch().is_some());
1936 /// assert!(x.pyspark_batch().is_none());
1937 /// assert!(x.spark_batch().is_none());
1938 /// assert!(x.spark_r_batch().is_none());
1939 /// ```
1940 pub fn set_spark_sql_batch<
1941 T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlBatch>>,
1942 >(
1943 mut self,
1944 v: T,
1945 ) -> Self {
1946 self.batch_config =
1947 std::option::Option::Some(crate::model::batch::BatchConfig::SparkSqlBatch(v.into()));
1948 self
1949 }
1950}
1951
1952impl wkt::message::Message for Batch {
1953 fn typename() -> &'static str {
1954 "type.googleapis.com/google.cloud.dataproc.v1.Batch"
1955 }
1956}
1957
1958/// Defines additional types related to [Batch].
1959pub mod batch {
1960 #[allow(unused_imports)]
1961 use super::*;
1962
1963 /// Historical state information.
1964 #[derive(Clone, Default, PartialEq)]
1965 #[non_exhaustive]
1966 pub struct StateHistory {
1967 /// Output only. The state of the batch at this point in history.
1968 pub state: crate::model::batch::State,
1969
1970 /// Output only. Details about the state at this point in history.
1971 pub state_message: std::string::String,
1972
1973 /// Output only. The time when the batch entered the historical state.
1974 pub state_start_time: std::option::Option<wkt::Timestamp>,
1975
1976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1977 }
1978
1979 impl StateHistory {
1980 pub fn new() -> Self {
1981 std::default::Default::default()
1982 }
1983
1984 /// Sets the value of [state][crate::model::batch::StateHistory::state].
1985 ///
1986 /// # Example
1987 /// ```ignore,no_run
1988 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
1989 /// use google_cloud_dataproc_v1::model::batch::State;
1990 /// let x0 = StateHistory::new().set_state(State::Pending);
1991 /// let x1 = StateHistory::new().set_state(State::Running);
1992 /// let x2 = StateHistory::new().set_state(State::Cancelling);
1993 /// ```
1994 pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(
1995 mut self,
1996 v: T,
1997 ) -> Self {
1998 self.state = v.into();
1999 self
2000 }
2001
2002 /// Sets the value of [state_message][crate::model::batch::StateHistory::state_message].
2003 ///
2004 /// # Example
2005 /// ```ignore,no_run
2006 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2007 /// let x = StateHistory::new().set_state_message("example");
2008 /// ```
2009 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
2010 mut self,
2011 v: T,
2012 ) -> Self {
2013 self.state_message = v.into();
2014 self
2015 }
2016
2017 /// Sets the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2018 ///
2019 /// # Example
2020 /// ```ignore,no_run
2021 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2022 /// use wkt::Timestamp;
2023 /// let x = StateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
2024 /// ```
2025 pub fn set_state_start_time<T>(mut self, v: T) -> Self
2026 where
2027 T: std::convert::Into<wkt::Timestamp>,
2028 {
2029 self.state_start_time = std::option::Option::Some(v.into());
2030 self
2031 }
2032
2033 /// Sets or clears the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2034 ///
2035 /// # Example
2036 /// ```ignore,no_run
2037 /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2038 /// use wkt::Timestamp;
2039 /// let x = StateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
2040 /// let x = StateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
2041 /// ```
2042 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2043 where
2044 T: std::convert::Into<wkt::Timestamp>,
2045 {
2046 self.state_start_time = v.map(|x| x.into());
2047 self
2048 }
2049 }
2050
2051 impl wkt::message::Message for StateHistory {
2052 fn typename() -> &'static str {
2053 "type.googleapis.com/google.cloud.dataproc.v1.Batch.StateHistory"
2054 }
2055 }
2056
2057 /// The batch state.
2058 ///
2059 /// # Working with unknown values
2060 ///
2061 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2062 /// additional enum variants at any time. Adding new variants is not considered
2063 /// a breaking change. Applications should write their code in anticipation of:
2064 ///
2065 /// - New values appearing in future releases of the client library, **and**
2066 /// - New values received dynamically, without application changes.
2067 ///
2068 /// Please consult the [Working with enums] section in the user guide for some
2069 /// guidelines.
2070 ///
2071 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2072 #[derive(Clone, Debug, PartialEq)]
2073 #[non_exhaustive]
2074 pub enum State {
2075 /// The batch state is unknown.
2076 Unspecified,
2077 /// The batch is created before running.
2078 Pending,
2079 /// The batch is running.
2080 Running,
2081 /// The batch is cancelling.
2082 Cancelling,
2083 /// The batch cancellation was successful.
2084 Cancelled,
2085 /// The batch completed successfully.
2086 Succeeded,
2087 /// The batch is no longer running due to an error.
2088 Failed,
2089 /// If set, the enum was initialized with an unknown value.
2090 ///
2091 /// Applications can examine the value using [State::value] or
2092 /// [State::name].
2093 UnknownValue(state::UnknownValue),
2094 }
2095
2096 #[doc(hidden)]
2097 pub mod state {
2098 #[allow(unused_imports)]
2099 use super::*;
2100 #[derive(Clone, Debug, PartialEq)]
2101 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2102 }
2103
2104 impl State {
2105 /// Gets the enum value.
2106 ///
2107 /// Returns `None` if the enum contains an unknown value deserialized from
2108 /// the string representation of enums.
2109 pub fn value(&self) -> std::option::Option<i32> {
2110 match self {
2111 Self::Unspecified => std::option::Option::Some(0),
2112 Self::Pending => std::option::Option::Some(1),
2113 Self::Running => std::option::Option::Some(2),
2114 Self::Cancelling => std::option::Option::Some(3),
2115 Self::Cancelled => std::option::Option::Some(4),
2116 Self::Succeeded => std::option::Option::Some(5),
2117 Self::Failed => std::option::Option::Some(6),
2118 Self::UnknownValue(u) => u.0.value(),
2119 }
2120 }
2121
2122 /// Gets the enum value as a string.
2123 ///
2124 /// Returns `None` if the enum contains an unknown value deserialized from
2125 /// the integer representation of enums.
2126 pub fn name(&self) -> std::option::Option<&str> {
2127 match self {
2128 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2129 Self::Pending => std::option::Option::Some("PENDING"),
2130 Self::Running => std::option::Option::Some("RUNNING"),
2131 Self::Cancelling => std::option::Option::Some("CANCELLING"),
2132 Self::Cancelled => std::option::Option::Some("CANCELLED"),
2133 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2134 Self::Failed => std::option::Option::Some("FAILED"),
2135 Self::UnknownValue(u) => u.0.name(),
2136 }
2137 }
2138 }
2139
2140 impl std::default::Default for State {
2141 fn default() -> Self {
2142 use std::convert::From;
2143 Self::from(0)
2144 }
2145 }
2146
2147 impl std::fmt::Display for State {
2148 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2149 wkt::internal::display_enum(f, self.name(), self.value())
2150 }
2151 }
2152
2153 impl std::convert::From<i32> for State {
2154 fn from(value: i32) -> Self {
2155 match value {
2156 0 => Self::Unspecified,
2157 1 => Self::Pending,
2158 2 => Self::Running,
2159 3 => Self::Cancelling,
2160 4 => Self::Cancelled,
2161 5 => Self::Succeeded,
2162 6 => Self::Failed,
2163 _ => Self::UnknownValue(state::UnknownValue(
2164 wkt::internal::UnknownEnumValue::Integer(value),
2165 )),
2166 }
2167 }
2168 }
2169
2170 impl std::convert::From<&str> for State {
2171 fn from(value: &str) -> Self {
2172 use std::string::ToString;
2173 match value {
2174 "STATE_UNSPECIFIED" => Self::Unspecified,
2175 "PENDING" => Self::Pending,
2176 "RUNNING" => Self::Running,
2177 "CANCELLING" => Self::Cancelling,
2178 "CANCELLED" => Self::Cancelled,
2179 "SUCCEEDED" => Self::Succeeded,
2180 "FAILED" => Self::Failed,
2181 _ => Self::UnknownValue(state::UnknownValue(
2182 wkt::internal::UnknownEnumValue::String(value.to_string()),
2183 )),
2184 }
2185 }
2186 }
2187
2188 impl serde::ser::Serialize for State {
2189 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2190 where
2191 S: serde::Serializer,
2192 {
2193 match self {
2194 Self::Unspecified => serializer.serialize_i32(0),
2195 Self::Pending => serializer.serialize_i32(1),
2196 Self::Running => serializer.serialize_i32(2),
2197 Self::Cancelling => serializer.serialize_i32(3),
2198 Self::Cancelled => serializer.serialize_i32(4),
2199 Self::Succeeded => serializer.serialize_i32(5),
2200 Self::Failed => serializer.serialize_i32(6),
2201 Self::UnknownValue(u) => u.0.serialize(serializer),
2202 }
2203 }
2204 }
2205
2206 impl<'de> serde::de::Deserialize<'de> for State {
2207 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2208 where
2209 D: serde::Deserializer<'de>,
2210 {
2211 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2212 ".google.cloud.dataproc.v1.Batch.State",
2213 ))
2214 }
2215 }
2216
2217 /// The application/framework-specific portion of the batch configuration.
2218 #[derive(Clone, Debug, PartialEq)]
2219 #[non_exhaustive]
2220 pub enum BatchConfig {
2221 /// Optional. PySpark batch config.
2222 PysparkBatch(std::boxed::Box<crate::model::PySparkBatch>),
2223 /// Optional. Spark batch config.
2224 SparkBatch(std::boxed::Box<crate::model::SparkBatch>),
2225 /// Optional. SparkR batch config.
2226 SparkRBatch(std::boxed::Box<crate::model::SparkRBatch>),
2227 /// Optional. SparkSql batch config.
2228 SparkSqlBatch(std::boxed::Box<crate::model::SparkSqlBatch>),
2229 }
2230}
2231
2232/// A configuration for running an
2233/// [Apache
2234/// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html)
2235/// batch workload.
2236#[derive(Clone, Default, PartialEq)]
2237#[non_exhaustive]
2238pub struct PySparkBatch {
2239 /// Required. The HCFS URI of the main Python file to use as the Spark driver.
2240 /// Must be a .py file.
2241 pub main_python_file_uri: std::string::String,
2242
2243 /// Optional. The arguments to pass to the driver. Do not include arguments
2244 /// that can be set as batch properties, such as `--conf`, since a collision
2245 /// can occur that causes an incorrect batch submission.
2246 pub args: std::vec::Vec<std::string::String>,
2247
2248 /// Optional. HCFS file URIs of Python files to pass to the PySpark
2249 /// framework. Supported file types: `.py`, `.egg`, and `.zip`.
2250 pub python_file_uris: std::vec::Vec<std::string::String>,
2251
2252 /// Optional. HCFS URIs of jar files to add to the classpath of the
2253 /// Spark driver and tasks.
2254 pub jar_file_uris: std::vec::Vec<std::string::String>,
2255
2256 /// Optional. HCFS URIs of files to be placed in the working directory of
2257 /// each executor.
2258 pub file_uris: std::vec::Vec<std::string::String>,
2259
2260 /// Optional. HCFS URIs of archives to be extracted into the working directory
2261 /// of each executor. Supported file types:
2262 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2263 pub archive_uris: std::vec::Vec<std::string::String>,
2264
2265 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2266}
2267
2268impl PySparkBatch {
2269 pub fn new() -> Self {
2270 std::default::Default::default()
2271 }
2272
2273 /// Sets the value of [main_python_file_uri][crate::model::PySparkBatch::main_python_file_uri].
2274 ///
2275 /// # Example
2276 /// ```ignore,no_run
2277 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2278 /// let x = PySparkBatch::new().set_main_python_file_uri("example");
2279 /// ```
2280 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
2281 mut self,
2282 v: T,
2283 ) -> Self {
2284 self.main_python_file_uri = v.into();
2285 self
2286 }
2287
2288 /// Sets the value of [args][crate::model::PySparkBatch::args].
2289 ///
2290 /// # Example
2291 /// ```ignore,no_run
2292 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2293 /// let x = PySparkBatch::new().set_args(["a", "b", "c"]);
2294 /// ```
2295 pub fn set_args<T, V>(mut self, v: T) -> Self
2296 where
2297 T: std::iter::IntoIterator<Item = V>,
2298 V: std::convert::Into<std::string::String>,
2299 {
2300 use std::iter::Iterator;
2301 self.args = v.into_iter().map(|i| i.into()).collect();
2302 self
2303 }
2304
2305 /// Sets the value of [python_file_uris][crate::model::PySparkBatch::python_file_uris].
2306 ///
2307 /// # Example
2308 /// ```ignore,no_run
2309 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2310 /// let x = PySparkBatch::new().set_python_file_uris(["a", "b", "c"]);
2311 /// ```
2312 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
2313 where
2314 T: std::iter::IntoIterator<Item = V>,
2315 V: std::convert::Into<std::string::String>,
2316 {
2317 use std::iter::Iterator;
2318 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
2319 self
2320 }
2321
2322 /// Sets the value of [jar_file_uris][crate::model::PySparkBatch::jar_file_uris].
2323 ///
2324 /// # Example
2325 /// ```ignore,no_run
2326 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2327 /// let x = PySparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2328 /// ```
2329 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2330 where
2331 T: std::iter::IntoIterator<Item = V>,
2332 V: std::convert::Into<std::string::String>,
2333 {
2334 use std::iter::Iterator;
2335 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2336 self
2337 }
2338
2339 /// Sets the value of [file_uris][crate::model::PySparkBatch::file_uris].
2340 ///
2341 /// # Example
2342 /// ```ignore,no_run
2343 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2344 /// let x = PySparkBatch::new().set_file_uris(["a", "b", "c"]);
2345 /// ```
2346 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2347 where
2348 T: std::iter::IntoIterator<Item = V>,
2349 V: std::convert::Into<std::string::String>,
2350 {
2351 use std::iter::Iterator;
2352 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2353 self
2354 }
2355
2356 /// Sets the value of [archive_uris][crate::model::PySparkBatch::archive_uris].
2357 ///
2358 /// # Example
2359 /// ```ignore,no_run
2360 /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2361 /// let x = PySparkBatch::new().set_archive_uris(["a", "b", "c"]);
2362 /// ```
2363 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2364 where
2365 T: std::iter::IntoIterator<Item = V>,
2366 V: std::convert::Into<std::string::String>,
2367 {
2368 use std::iter::Iterator;
2369 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2370 self
2371 }
2372}
2373
2374impl wkt::message::Message for PySparkBatch {
2375 fn typename() -> &'static str {
2376 "type.googleapis.com/google.cloud.dataproc.v1.PySparkBatch"
2377 }
2378}
2379
2380/// A configuration for running an [Apache Spark](https://spark.apache.org/)
2381/// batch workload.
2382#[derive(Clone, Default, PartialEq)]
2383#[non_exhaustive]
2384pub struct SparkBatch {
2385 /// Optional. The arguments to pass to the driver. Do not include arguments
2386 /// that can be set as batch properties, such as `--conf`, since a collision
2387 /// can occur that causes an incorrect batch submission.
2388 pub args: std::vec::Vec<std::string::String>,
2389
2390 /// Optional. HCFS URIs of jar files to add to the classpath of the
2391 /// Spark driver and tasks.
2392 pub jar_file_uris: std::vec::Vec<std::string::String>,
2393
2394 /// Optional. HCFS URIs of files to be placed in the working directory of
2395 /// each executor.
2396 pub file_uris: std::vec::Vec<std::string::String>,
2397
2398 /// Optional. HCFS URIs of archives to be extracted into the working directory
2399 /// of each executor. Supported file types:
2400 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2401 pub archive_uris: std::vec::Vec<std::string::String>,
2402
2403 /// The specification of the main method to call to drive the Spark
2404 /// workload. Specify either the jar file that contains the main class or the
2405 /// main class name. To pass both a main jar and a main class in that jar, add
2406 /// the jar to `jar_file_uris`, and then specify the main class
2407 /// name in `main_class`.
2408 pub driver: std::option::Option<crate::model::spark_batch::Driver>,
2409
2410 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2411}
2412
2413impl SparkBatch {
2414 pub fn new() -> Self {
2415 std::default::Default::default()
2416 }
2417
2418 /// Sets the value of [args][crate::model::SparkBatch::args].
2419 ///
2420 /// # Example
2421 /// ```ignore,no_run
2422 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2423 /// let x = SparkBatch::new().set_args(["a", "b", "c"]);
2424 /// ```
2425 pub fn set_args<T, V>(mut self, v: T) -> Self
2426 where
2427 T: std::iter::IntoIterator<Item = V>,
2428 V: std::convert::Into<std::string::String>,
2429 {
2430 use std::iter::Iterator;
2431 self.args = v.into_iter().map(|i| i.into()).collect();
2432 self
2433 }
2434
2435 /// Sets the value of [jar_file_uris][crate::model::SparkBatch::jar_file_uris].
2436 ///
2437 /// # Example
2438 /// ```ignore,no_run
2439 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2440 /// let x = SparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2441 /// ```
2442 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2443 where
2444 T: std::iter::IntoIterator<Item = V>,
2445 V: std::convert::Into<std::string::String>,
2446 {
2447 use std::iter::Iterator;
2448 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2449 self
2450 }
2451
2452 /// Sets the value of [file_uris][crate::model::SparkBatch::file_uris].
2453 ///
2454 /// # Example
2455 /// ```ignore,no_run
2456 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2457 /// let x = SparkBatch::new().set_file_uris(["a", "b", "c"]);
2458 /// ```
2459 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2460 where
2461 T: std::iter::IntoIterator<Item = V>,
2462 V: std::convert::Into<std::string::String>,
2463 {
2464 use std::iter::Iterator;
2465 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2466 self
2467 }
2468
2469 /// Sets the value of [archive_uris][crate::model::SparkBatch::archive_uris].
2470 ///
2471 /// # Example
2472 /// ```ignore,no_run
2473 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2474 /// let x = SparkBatch::new().set_archive_uris(["a", "b", "c"]);
2475 /// ```
2476 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2477 where
2478 T: std::iter::IntoIterator<Item = V>,
2479 V: std::convert::Into<std::string::String>,
2480 {
2481 use std::iter::Iterator;
2482 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2483 self
2484 }
2485
2486 /// Sets the value of [driver][crate::model::SparkBatch::driver].
2487 ///
2488 /// Note that all the setters affecting `driver` are mutually
2489 /// exclusive.
2490 ///
2491 /// # Example
2492 /// ```ignore,no_run
2493 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2494 /// use google_cloud_dataproc_v1::model::spark_batch::Driver;
2495 /// let x = SparkBatch::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
2496 /// ```
2497 pub fn set_driver<
2498 T: std::convert::Into<std::option::Option<crate::model::spark_batch::Driver>>,
2499 >(
2500 mut self,
2501 v: T,
2502 ) -> Self {
2503 self.driver = v.into();
2504 self
2505 }
2506
2507 /// The value of [driver][crate::model::SparkBatch::driver]
2508 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
2509 /// holds a different branch.
2510 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
2511 #[allow(unreachable_patterns)]
2512 self.driver.as_ref().and_then(|v| match v {
2513 crate::model::spark_batch::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
2514 _ => std::option::Option::None,
2515 })
2516 }
2517
2518 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2519 /// to hold a `MainJarFileUri`.
2520 ///
2521 /// Note that all the setters affecting `driver` are
2522 /// mutually exclusive.
2523 ///
2524 /// # Example
2525 /// ```ignore,no_run
2526 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2527 /// let x = SparkBatch::new().set_main_jar_file_uri("example");
2528 /// assert!(x.main_jar_file_uri().is_some());
2529 /// assert!(x.main_class().is_none());
2530 /// ```
2531 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
2532 mut self,
2533 v: T,
2534 ) -> Self {
2535 self.driver =
2536 std::option::Option::Some(crate::model::spark_batch::Driver::MainJarFileUri(v.into()));
2537 self
2538 }
2539
2540 /// The value of [driver][crate::model::SparkBatch::driver]
2541 /// if it holds a `MainClass`, `None` if the field is not set or
2542 /// holds a different branch.
2543 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
2544 #[allow(unreachable_patterns)]
2545 self.driver.as_ref().and_then(|v| match v {
2546 crate::model::spark_batch::Driver::MainClass(v) => std::option::Option::Some(v),
2547 _ => std::option::Option::None,
2548 })
2549 }
2550
2551 /// Sets the value of [driver][crate::model::SparkBatch::driver]
2552 /// to hold a `MainClass`.
2553 ///
2554 /// Note that all the setters affecting `driver` are
2555 /// mutually exclusive.
2556 ///
2557 /// # Example
2558 /// ```ignore,no_run
2559 /// # use google_cloud_dataproc_v1::model::SparkBatch;
2560 /// let x = SparkBatch::new().set_main_class("example");
2561 /// assert!(x.main_class().is_some());
2562 /// assert!(x.main_jar_file_uri().is_none());
2563 /// ```
2564 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2565 self.driver =
2566 std::option::Option::Some(crate::model::spark_batch::Driver::MainClass(v.into()));
2567 self
2568 }
2569}
2570
2571impl wkt::message::Message for SparkBatch {
2572 fn typename() -> &'static str {
2573 "type.googleapis.com/google.cloud.dataproc.v1.SparkBatch"
2574 }
2575}
2576
2577/// Defines additional types related to [SparkBatch].
2578pub mod spark_batch {
2579 #[allow(unused_imports)]
2580 use super::*;
2581
2582 /// The specification of the main method to call to drive the Spark
2583 /// workload. Specify either the jar file that contains the main class or the
2584 /// main class name. To pass both a main jar and a main class in that jar, add
2585 /// the jar to `jar_file_uris`, and then specify the main class
2586 /// name in `main_class`.
2587 #[derive(Clone, Debug, PartialEq)]
2588 #[non_exhaustive]
2589 pub enum Driver {
2590 /// Optional. The HCFS URI of the jar file that contains the main class.
2591 MainJarFileUri(std::string::String),
2592 /// Optional. The name of the driver main class. The jar file that contains
2593 /// the class must be in the classpath or specified in `jar_file_uris`.
2594 MainClass(std::string::String),
2595 }
2596}
2597
2598/// A configuration for running an
2599/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
2600/// batch workload.
2601#[derive(Clone, Default, PartialEq)]
2602#[non_exhaustive]
2603pub struct SparkRBatch {
2604 /// Required. The HCFS URI of the main R file to use as the driver.
2605 /// Must be a `.R` or `.r` file.
2606 pub main_r_file_uri: std::string::String,
2607
2608 /// Optional. The arguments to pass to the Spark driver. Do not include
2609 /// arguments that can be set as batch properties, such as `--conf`, since a
2610 /// collision can occur that causes an incorrect batch submission.
2611 pub args: std::vec::Vec<std::string::String>,
2612
2613 /// Optional. HCFS URIs of files to be placed in the working directory of
2614 /// each executor.
2615 pub file_uris: std::vec::Vec<std::string::String>,
2616
2617 /// Optional. HCFS URIs of archives to be extracted into the working directory
2618 /// of each executor. Supported file types:
2619 /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2620 pub archive_uris: std::vec::Vec<std::string::String>,
2621
2622 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2623}
2624
2625impl SparkRBatch {
2626 pub fn new() -> Self {
2627 std::default::Default::default()
2628 }
2629
2630 /// Sets the value of [main_r_file_uri][crate::model::SparkRBatch::main_r_file_uri].
2631 ///
2632 /// # Example
2633 /// ```ignore,no_run
2634 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2635 /// let x = SparkRBatch::new().set_main_r_file_uri("example");
2636 /// ```
2637 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2638 self.main_r_file_uri = v.into();
2639 self
2640 }
2641
2642 /// Sets the value of [args][crate::model::SparkRBatch::args].
2643 ///
2644 /// # Example
2645 /// ```ignore,no_run
2646 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2647 /// let x = SparkRBatch::new().set_args(["a", "b", "c"]);
2648 /// ```
2649 pub fn set_args<T, V>(mut self, v: T) -> Self
2650 where
2651 T: std::iter::IntoIterator<Item = V>,
2652 V: std::convert::Into<std::string::String>,
2653 {
2654 use std::iter::Iterator;
2655 self.args = v.into_iter().map(|i| i.into()).collect();
2656 self
2657 }
2658
2659 /// Sets the value of [file_uris][crate::model::SparkRBatch::file_uris].
2660 ///
2661 /// # Example
2662 /// ```ignore,no_run
2663 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2664 /// let x = SparkRBatch::new().set_file_uris(["a", "b", "c"]);
2665 /// ```
2666 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2667 where
2668 T: std::iter::IntoIterator<Item = V>,
2669 V: std::convert::Into<std::string::String>,
2670 {
2671 use std::iter::Iterator;
2672 self.file_uris = v.into_iter().map(|i| i.into()).collect();
2673 self
2674 }
2675
2676 /// Sets the value of [archive_uris][crate::model::SparkRBatch::archive_uris].
2677 ///
2678 /// # Example
2679 /// ```ignore,no_run
2680 /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2681 /// let x = SparkRBatch::new().set_archive_uris(["a", "b", "c"]);
2682 /// ```
2683 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2684 where
2685 T: std::iter::IntoIterator<Item = V>,
2686 V: std::convert::Into<std::string::String>,
2687 {
2688 use std::iter::Iterator;
2689 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2690 self
2691 }
2692}
2693
2694impl wkt::message::Message for SparkRBatch {
2695 fn typename() -> &'static str {
2696 "type.googleapis.com/google.cloud.dataproc.v1.SparkRBatch"
2697 }
2698}
2699
2700/// A configuration for running
2701/// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch
2702/// workload.
2703#[derive(Clone, Default, PartialEq)]
2704#[non_exhaustive]
2705pub struct SparkSqlBatch {
2706 /// Required. The HCFS URI of the script that contains Spark SQL queries to
2707 /// execute.
2708 pub query_file_uri: std::string::String,
2709
2710 /// Optional. Mapping of query variable names to values (equivalent to the
2711 /// Spark SQL command: `SET name="value";`).
2712 pub query_variables: std::collections::HashMap<std::string::String, std::string::String>,
2713
2714 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2715 pub jar_file_uris: std::vec::Vec<std::string::String>,
2716
2717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2718}
2719
2720impl SparkSqlBatch {
2721 pub fn new() -> Self {
2722 std::default::Default::default()
2723 }
2724
2725 /// Sets the value of [query_file_uri][crate::model::SparkSqlBatch::query_file_uri].
2726 ///
2727 /// # Example
2728 /// ```ignore,no_run
2729 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2730 /// let x = SparkSqlBatch::new().set_query_file_uri("example");
2731 /// ```
2732 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2733 self.query_file_uri = v.into();
2734 self
2735 }
2736
2737 /// Sets the value of [query_variables][crate::model::SparkSqlBatch::query_variables].
2738 ///
2739 /// # Example
2740 /// ```ignore,no_run
2741 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2742 /// let x = SparkSqlBatch::new().set_query_variables([
2743 /// ("key0", "abc"),
2744 /// ("key1", "xyz"),
2745 /// ]);
2746 /// ```
2747 pub fn set_query_variables<T, K, V>(mut self, v: T) -> Self
2748 where
2749 T: std::iter::IntoIterator<Item = (K, V)>,
2750 K: std::convert::Into<std::string::String>,
2751 V: std::convert::Into<std::string::String>,
2752 {
2753 use std::iter::Iterator;
2754 self.query_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2755 self
2756 }
2757
2758 /// Sets the value of [jar_file_uris][crate::model::SparkSqlBatch::jar_file_uris].
2759 ///
2760 /// # Example
2761 /// ```ignore,no_run
2762 /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2763 /// let x = SparkSqlBatch::new().set_jar_file_uris(["a", "b", "c"]);
2764 /// ```
2765 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2766 where
2767 T: std::iter::IntoIterator<Item = V>,
2768 V: std::convert::Into<std::string::String>,
2769 {
2770 use std::iter::Iterator;
2771 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2772 self
2773 }
2774}
2775
2776impl wkt::message::Message for SparkSqlBatch {
2777 fn typename() -> &'static str {
2778 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlBatch"
2779 }
2780}
2781
2782/// Describes the identifying information, config, and status of
2783/// a Dataproc cluster
2784#[derive(Clone, Default, PartialEq)]
2785#[non_exhaustive]
2786pub struct Cluster {
2787 /// Required. The Google Cloud Platform project ID that the cluster belongs to.
2788 pub project_id: std::string::String,
2789
2790 /// Required. The cluster name, which must be unique within a project.
2791 /// The name must start with a lowercase letter, and can contain
2792 /// up to 51 lowercase letters, numbers, and hyphens. It cannot end
2793 /// with a hyphen. The name of a deleted cluster can be reused.
2794 pub cluster_name: std::string::String,
2795
2796 /// Optional. The cluster config for a cluster of Compute Engine Instances.
2797 /// Note that Dataproc may set default values, and values may change
2798 /// when clusters are updated.
2799 ///
2800 /// Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
2801 pub config: std::option::Option<crate::model::ClusterConfig>,
2802
2803 /// Optional. The virtual cluster config is used when creating a Dataproc
2804 /// cluster that does not directly control the underlying compute resources,
2805 /// for example, when creating a [Dataproc-on-GKE
2806 /// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
2807 /// Dataproc may set default values, and values may change when
2808 /// clusters are updated. Exactly one of
2809 /// [config][google.cloud.dataproc.v1.Cluster.config] or
2810 /// [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config]
2811 /// must be specified.
2812 ///
2813 /// [google.cloud.dataproc.v1.Cluster.config]: crate::model::Cluster::config
2814 /// [google.cloud.dataproc.v1.Cluster.virtual_cluster_config]: crate::model::Cluster::virtual_cluster_config
2815 pub virtual_cluster_config: std::option::Option<crate::model::VirtualClusterConfig>,
2816
2817 /// Optional. The labels to associate with this cluster.
2818 /// Label **keys** must contain 1 to 63 characters, and must conform to
2819 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
2820 /// Label **values** may be empty, but, if present, must contain 1 to 63
2821 /// characters, and must conform to [RFC
2822 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
2823 /// associated with a cluster.
2824 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2825
2826 /// Output only. Cluster status.
2827 pub status: std::option::Option<crate::model::ClusterStatus>,
2828
2829 /// Output only. The previous cluster status.
2830 pub status_history: std::vec::Vec<crate::model::ClusterStatus>,
2831
2832 /// Output only. A cluster UUID (Unique Universal Identifier). Dataproc
2833 /// generates this value when it creates the cluster.
2834 pub cluster_uuid: std::string::String,
2835
2836 /// Output only. Contains cluster daemon metrics such as HDFS and YARN stats.
2837 ///
2838 /// **Beta Feature**: This report is available for testing purposes only. It
2839 /// may be changed before final release.
2840 pub metrics: std::option::Option<crate::model::ClusterMetrics>,
2841
2842 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2843}
2844
2845impl Cluster {
2846 pub fn new() -> Self {
2847 std::default::Default::default()
2848 }
2849
2850 /// Sets the value of [project_id][crate::model::Cluster::project_id].
2851 ///
2852 /// # Example
2853 /// ```ignore,no_run
2854 /// # use google_cloud_dataproc_v1::model::Cluster;
2855 /// let x = Cluster::new().set_project_id("example");
2856 /// ```
2857 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2858 self.project_id = v.into();
2859 self
2860 }
2861
2862 /// Sets the value of [cluster_name][crate::model::Cluster::cluster_name].
2863 ///
2864 /// # Example
2865 /// ```ignore,no_run
2866 /// # use google_cloud_dataproc_v1::model::Cluster;
2867 /// let x = Cluster::new().set_cluster_name("example");
2868 /// ```
2869 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2870 self.cluster_name = v.into();
2871 self
2872 }
2873
2874 /// Sets the value of [config][crate::model::Cluster::config].
2875 ///
2876 /// # Example
2877 /// ```ignore,no_run
2878 /// # use google_cloud_dataproc_v1::model::Cluster;
2879 /// use google_cloud_dataproc_v1::model::ClusterConfig;
2880 /// let x = Cluster::new().set_config(ClusterConfig::default()/* use setters */);
2881 /// ```
2882 pub fn set_config<T>(mut self, v: T) -> Self
2883 where
2884 T: std::convert::Into<crate::model::ClusterConfig>,
2885 {
2886 self.config = std::option::Option::Some(v.into());
2887 self
2888 }
2889
2890 /// Sets or clears the value of [config][crate::model::Cluster::config].
2891 ///
2892 /// # Example
2893 /// ```ignore,no_run
2894 /// # use google_cloud_dataproc_v1::model::Cluster;
2895 /// use google_cloud_dataproc_v1::model::ClusterConfig;
2896 /// let x = Cluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
2897 /// let x = Cluster::new().set_or_clear_config(None::<ClusterConfig>);
2898 /// ```
2899 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
2900 where
2901 T: std::convert::Into<crate::model::ClusterConfig>,
2902 {
2903 self.config = v.map(|x| x.into());
2904 self
2905 }
2906
2907 /// Sets the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
2908 ///
2909 /// # Example
2910 /// ```ignore,no_run
2911 /// # use google_cloud_dataproc_v1::model::Cluster;
2912 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
2913 /// let x = Cluster::new().set_virtual_cluster_config(VirtualClusterConfig::default()/* use setters */);
2914 /// ```
2915 pub fn set_virtual_cluster_config<T>(mut self, v: T) -> Self
2916 where
2917 T: std::convert::Into<crate::model::VirtualClusterConfig>,
2918 {
2919 self.virtual_cluster_config = std::option::Option::Some(v.into());
2920 self
2921 }
2922
2923 /// Sets or clears the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
2924 ///
2925 /// # Example
2926 /// ```ignore,no_run
2927 /// # use google_cloud_dataproc_v1::model::Cluster;
2928 /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
2929 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(Some(VirtualClusterConfig::default()/* use setters */));
2930 /// let x = Cluster::new().set_or_clear_virtual_cluster_config(None::<VirtualClusterConfig>);
2931 /// ```
2932 pub fn set_or_clear_virtual_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
2933 where
2934 T: std::convert::Into<crate::model::VirtualClusterConfig>,
2935 {
2936 self.virtual_cluster_config = v.map(|x| x.into());
2937 self
2938 }
2939
2940 /// Sets the value of [labels][crate::model::Cluster::labels].
2941 ///
2942 /// # Example
2943 /// ```ignore,no_run
2944 /// # use google_cloud_dataproc_v1::model::Cluster;
2945 /// let x = Cluster::new().set_labels([
2946 /// ("key0", "abc"),
2947 /// ("key1", "xyz"),
2948 /// ]);
2949 /// ```
2950 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2951 where
2952 T: std::iter::IntoIterator<Item = (K, V)>,
2953 K: std::convert::Into<std::string::String>,
2954 V: std::convert::Into<std::string::String>,
2955 {
2956 use std::iter::Iterator;
2957 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2958 self
2959 }
2960
2961 /// Sets the value of [status][crate::model::Cluster::status].
2962 ///
2963 /// # Example
2964 /// ```ignore,no_run
2965 /// # use google_cloud_dataproc_v1::model::Cluster;
2966 /// use google_cloud_dataproc_v1::model::ClusterStatus;
2967 /// let x = Cluster::new().set_status(ClusterStatus::default()/* use setters */);
2968 /// ```
2969 pub fn set_status<T>(mut self, v: T) -> Self
2970 where
2971 T: std::convert::Into<crate::model::ClusterStatus>,
2972 {
2973 self.status = std::option::Option::Some(v.into());
2974 self
2975 }
2976
2977 /// Sets or clears the value of [status][crate::model::Cluster::status].
2978 ///
2979 /// # Example
2980 /// ```ignore,no_run
2981 /// # use google_cloud_dataproc_v1::model::Cluster;
2982 /// use google_cloud_dataproc_v1::model::ClusterStatus;
2983 /// let x = Cluster::new().set_or_clear_status(Some(ClusterStatus::default()/* use setters */));
2984 /// let x = Cluster::new().set_or_clear_status(None::<ClusterStatus>);
2985 /// ```
2986 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
2987 where
2988 T: std::convert::Into<crate::model::ClusterStatus>,
2989 {
2990 self.status = v.map(|x| x.into());
2991 self
2992 }
2993
2994 /// Sets the value of [status_history][crate::model::Cluster::status_history].
2995 ///
2996 /// # Example
2997 /// ```ignore,no_run
2998 /// # use google_cloud_dataproc_v1::model::Cluster;
2999 /// use google_cloud_dataproc_v1::model::ClusterStatus;
3000 /// let x = Cluster::new()
3001 /// .set_status_history([
3002 /// ClusterStatus::default()/* use setters */,
3003 /// ClusterStatus::default()/* use (different) setters */,
3004 /// ]);
3005 /// ```
3006 pub fn set_status_history<T, V>(mut self, v: T) -> Self
3007 where
3008 T: std::iter::IntoIterator<Item = V>,
3009 V: std::convert::Into<crate::model::ClusterStatus>,
3010 {
3011 use std::iter::Iterator;
3012 self.status_history = v.into_iter().map(|i| i.into()).collect();
3013 self
3014 }
3015
3016 /// Sets the value of [cluster_uuid][crate::model::Cluster::cluster_uuid].
3017 ///
3018 /// # Example
3019 /// ```ignore,no_run
3020 /// # use google_cloud_dataproc_v1::model::Cluster;
3021 /// let x = Cluster::new().set_cluster_uuid("example");
3022 /// ```
3023 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3024 self.cluster_uuid = v.into();
3025 self
3026 }
3027
3028 /// Sets the value of [metrics][crate::model::Cluster::metrics].
3029 ///
3030 /// # Example
3031 /// ```ignore,no_run
3032 /// # use google_cloud_dataproc_v1::model::Cluster;
3033 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3034 /// let x = Cluster::new().set_metrics(ClusterMetrics::default()/* use setters */);
3035 /// ```
3036 pub fn set_metrics<T>(mut self, v: T) -> Self
3037 where
3038 T: std::convert::Into<crate::model::ClusterMetrics>,
3039 {
3040 self.metrics = std::option::Option::Some(v.into());
3041 self
3042 }
3043
3044 /// Sets or clears the value of [metrics][crate::model::Cluster::metrics].
3045 ///
3046 /// # Example
3047 /// ```ignore,no_run
3048 /// # use google_cloud_dataproc_v1::model::Cluster;
3049 /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3050 /// let x = Cluster::new().set_or_clear_metrics(Some(ClusterMetrics::default()/* use setters */));
3051 /// let x = Cluster::new().set_or_clear_metrics(None::<ClusterMetrics>);
3052 /// ```
3053 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
3054 where
3055 T: std::convert::Into<crate::model::ClusterMetrics>,
3056 {
3057 self.metrics = v.map(|x| x.into());
3058 self
3059 }
3060}
3061
3062impl wkt::message::Message for Cluster {
3063 fn typename() -> &'static str {
3064 "type.googleapis.com/google.cloud.dataproc.v1.Cluster"
3065 }
3066}
3067
3068/// The cluster config.
3069#[derive(Clone, Default, PartialEq)]
3070#[non_exhaustive]
3071pub struct ClusterConfig {
3072 /// Optional. The cluster tier.
3073 pub cluster_tier: crate::model::cluster_config::ClusterTier,
3074
3075 /// Optional. A Cloud Storage bucket used to stage job
3076 /// dependencies, config files, and job driver console output.
3077 /// If you do not specify a staging bucket, Cloud
3078 /// Dataproc will determine a Cloud Storage location (US,
3079 /// ASIA, or EU) for your cluster's staging bucket according to the
3080 /// Compute Engine zone where your cluster is deployed, and then create
3081 /// and manage this project-level, per-location bucket (see
3082 /// [Dataproc staging and temp
3083 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3084 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3085 /// a Cloud Storage bucket.**
3086 pub config_bucket: std::string::String,
3087
3088 /// Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs
3089 /// data, such as Spark and MapReduce history files. If you do not specify a
3090 /// temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or
3091 /// EU) for your cluster's temp bucket according to the Compute Engine zone
3092 /// where your cluster is deployed, and then create and manage this
3093 /// project-level, per-location bucket. The default bucket has a TTL of 90
3094 /// days, but you can use any TTL (or none) if you specify a bucket (see
3095 /// [Dataproc staging and temp
3096 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3097 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3098 /// a Cloud Storage bucket.**
3099 pub temp_bucket: std::string::String,
3100
3101 /// Optional. The shared Compute Engine config settings for
3102 /// all instances in a cluster.
3103 pub gce_cluster_config: std::option::Option<crate::model::GceClusterConfig>,
3104
3105 /// Optional. The Compute Engine config settings for
3106 /// the cluster's master instance.
3107 pub master_config: std::option::Option<crate::model::InstanceGroupConfig>,
3108
3109 /// Optional. The Compute Engine config settings for
3110 /// the cluster's worker instances.
3111 pub worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3112
3113 /// Optional. The Compute Engine config settings for
3114 /// a cluster's secondary worker instances
3115 pub secondary_worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3116
3117 /// Optional. The config settings for cluster software.
3118 pub software_config: std::option::Option<crate::model::SoftwareConfig>,
3119
3120 /// Optional. Commands to execute on each node after config is
3121 /// completed. By default, executables are run on master and all worker nodes.
3122 /// You can test a node's `role` metadata to run an executable on
3123 /// a master or worker node, as shown below using `curl` (you can also use
3124 /// `wget`):
3125 ///
3126 /// ```norust
3127 /// ROLE=$(curl -H Metadata-Flavor:Google
3128 /// http://metadata/computeMetadata/v1/instance/attributes/dataproc-role)
3129 /// if [[ "${ROLE}" == 'Master' ]]; then
3130 /// ... master specific actions ...
3131 /// else
3132 /// ... worker specific actions ...
3133 /// fi
3134 /// ```
3135 pub initialization_actions: std::vec::Vec<crate::model::NodeInitializationAction>,
3136
3137 /// Optional. Encryption settings for the cluster.
3138 pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
3139
3140 /// Optional. Autoscaling config for the policy associated with the cluster.
3141 /// Cluster does not autoscale if this field is unset.
3142 pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
3143
3144 /// Optional. Security settings for the cluster.
3145 pub security_config: std::option::Option<crate::model::SecurityConfig>,
3146
3147 /// Optional. Lifecycle setting for the cluster.
3148 pub lifecycle_config: std::option::Option<crate::model::LifecycleConfig>,
3149
3150 /// Optional. Port/endpoint configuration for this cluster
3151 pub endpoint_config: std::option::Option<crate::model::EndpointConfig>,
3152
3153 /// Optional. Metastore configuration.
3154 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3155
3156 /// Optional. The config for Dataproc metrics.
3157 pub dataproc_metric_config: std::option::Option<crate::model::DataprocMetricConfig>,
3158
3159 /// Optional. The node group settings.
3160 pub auxiliary_node_groups: std::vec::Vec<crate::model::AuxiliaryNodeGroup>,
3161
3162 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3163}
3164
3165impl ClusterConfig {
3166 pub fn new() -> Self {
3167 std::default::Default::default()
3168 }
3169
3170 /// Sets the value of [cluster_tier][crate::model::ClusterConfig::cluster_tier].
3171 ///
3172 /// # Example
3173 /// ```ignore,no_run
3174 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3175 /// use google_cloud_dataproc_v1::model::cluster_config::ClusterTier;
3176 /// let x0 = ClusterConfig::new().set_cluster_tier(ClusterTier::Standard);
3177 /// let x1 = ClusterConfig::new().set_cluster_tier(ClusterTier::Premium);
3178 /// ```
3179 pub fn set_cluster_tier<T: std::convert::Into<crate::model::cluster_config::ClusterTier>>(
3180 mut self,
3181 v: T,
3182 ) -> Self {
3183 self.cluster_tier = v.into();
3184 self
3185 }
3186
3187 /// Sets the value of [config_bucket][crate::model::ClusterConfig::config_bucket].
3188 ///
3189 /// # Example
3190 /// ```ignore,no_run
3191 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3192 /// let x = ClusterConfig::new().set_config_bucket("example");
3193 /// ```
3194 pub fn set_config_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3195 self.config_bucket = v.into();
3196 self
3197 }
3198
3199 /// Sets the value of [temp_bucket][crate::model::ClusterConfig::temp_bucket].
3200 ///
3201 /// # Example
3202 /// ```ignore,no_run
3203 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3204 /// let x = ClusterConfig::new().set_temp_bucket("example");
3205 /// ```
3206 pub fn set_temp_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3207 self.temp_bucket = v.into();
3208 self
3209 }
3210
3211 /// Sets the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3212 ///
3213 /// # Example
3214 /// ```ignore,no_run
3215 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3216 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3217 /// let x = ClusterConfig::new().set_gce_cluster_config(GceClusterConfig::default()/* use setters */);
3218 /// ```
3219 pub fn set_gce_cluster_config<T>(mut self, v: T) -> Self
3220 where
3221 T: std::convert::Into<crate::model::GceClusterConfig>,
3222 {
3223 self.gce_cluster_config = std::option::Option::Some(v.into());
3224 self
3225 }
3226
3227 /// Sets or clears the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3228 ///
3229 /// # Example
3230 /// ```ignore,no_run
3231 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3232 /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3233 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(Some(GceClusterConfig::default()/* use setters */));
3234 /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(None::<GceClusterConfig>);
3235 /// ```
3236 pub fn set_or_clear_gce_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3237 where
3238 T: std::convert::Into<crate::model::GceClusterConfig>,
3239 {
3240 self.gce_cluster_config = v.map(|x| x.into());
3241 self
3242 }
3243
3244 /// Sets the value of [master_config][crate::model::ClusterConfig::master_config].
3245 ///
3246 /// # Example
3247 /// ```ignore,no_run
3248 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3249 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3250 /// let x = ClusterConfig::new().set_master_config(InstanceGroupConfig::default()/* use setters */);
3251 /// ```
3252 pub fn set_master_config<T>(mut self, v: T) -> Self
3253 where
3254 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3255 {
3256 self.master_config = std::option::Option::Some(v.into());
3257 self
3258 }
3259
3260 /// Sets or clears the value of [master_config][crate::model::ClusterConfig::master_config].
3261 ///
3262 /// # Example
3263 /// ```ignore,no_run
3264 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3265 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3266 /// let x = ClusterConfig::new().set_or_clear_master_config(Some(InstanceGroupConfig::default()/* use setters */));
3267 /// let x = ClusterConfig::new().set_or_clear_master_config(None::<InstanceGroupConfig>);
3268 /// ```
3269 pub fn set_or_clear_master_config<T>(mut self, v: std::option::Option<T>) -> Self
3270 where
3271 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3272 {
3273 self.master_config = v.map(|x| x.into());
3274 self
3275 }
3276
3277 /// Sets the value of [worker_config][crate::model::ClusterConfig::worker_config].
3278 ///
3279 /// # Example
3280 /// ```ignore,no_run
3281 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3282 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3283 /// let x = ClusterConfig::new().set_worker_config(InstanceGroupConfig::default()/* use setters */);
3284 /// ```
3285 pub fn set_worker_config<T>(mut self, v: T) -> Self
3286 where
3287 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3288 {
3289 self.worker_config = std::option::Option::Some(v.into());
3290 self
3291 }
3292
3293 /// Sets or clears the value of [worker_config][crate::model::ClusterConfig::worker_config].
3294 ///
3295 /// # Example
3296 /// ```ignore,no_run
3297 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3298 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3299 /// let x = ClusterConfig::new().set_or_clear_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3300 /// let x = ClusterConfig::new().set_or_clear_worker_config(None::<InstanceGroupConfig>);
3301 /// ```
3302 pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3303 where
3304 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3305 {
3306 self.worker_config = v.map(|x| x.into());
3307 self
3308 }
3309
3310 /// Sets the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3311 ///
3312 /// # Example
3313 /// ```ignore,no_run
3314 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3315 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3316 /// let x = ClusterConfig::new().set_secondary_worker_config(InstanceGroupConfig::default()/* use setters */);
3317 /// ```
3318 pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
3319 where
3320 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3321 {
3322 self.secondary_worker_config = std::option::Option::Some(v.into());
3323 self
3324 }
3325
3326 /// Sets or clears the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3327 ///
3328 /// # Example
3329 /// ```ignore,no_run
3330 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3331 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3332 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3333 /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(None::<InstanceGroupConfig>);
3334 /// ```
3335 pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3336 where
3337 T: std::convert::Into<crate::model::InstanceGroupConfig>,
3338 {
3339 self.secondary_worker_config = v.map(|x| x.into());
3340 self
3341 }
3342
3343 /// Sets the value of [software_config][crate::model::ClusterConfig::software_config].
3344 ///
3345 /// # Example
3346 /// ```ignore,no_run
3347 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3348 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3349 /// let x = ClusterConfig::new().set_software_config(SoftwareConfig::default()/* use setters */);
3350 /// ```
3351 pub fn set_software_config<T>(mut self, v: T) -> Self
3352 where
3353 T: std::convert::Into<crate::model::SoftwareConfig>,
3354 {
3355 self.software_config = std::option::Option::Some(v.into());
3356 self
3357 }
3358
3359 /// Sets or clears the value of [software_config][crate::model::ClusterConfig::software_config].
3360 ///
3361 /// # Example
3362 /// ```ignore,no_run
3363 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3364 /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3365 /// let x = ClusterConfig::new().set_or_clear_software_config(Some(SoftwareConfig::default()/* use setters */));
3366 /// let x = ClusterConfig::new().set_or_clear_software_config(None::<SoftwareConfig>);
3367 /// ```
3368 pub fn set_or_clear_software_config<T>(mut self, v: std::option::Option<T>) -> Self
3369 where
3370 T: std::convert::Into<crate::model::SoftwareConfig>,
3371 {
3372 self.software_config = v.map(|x| x.into());
3373 self
3374 }
3375
3376 /// Sets the value of [initialization_actions][crate::model::ClusterConfig::initialization_actions].
3377 ///
3378 /// # Example
3379 /// ```ignore,no_run
3380 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3381 /// use google_cloud_dataproc_v1::model::NodeInitializationAction;
3382 /// let x = ClusterConfig::new()
3383 /// .set_initialization_actions([
3384 /// NodeInitializationAction::default()/* use setters */,
3385 /// NodeInitializationAction::default()/* use (different) setters */,
3386 /// ]);
3387 /// ```
3388 pub fn set_initialization_actions<T, V>(mut self, v: T) -> Self
3389 where
3390 T: std::iter::IntoIterator<Item = V>,
3391 V: std::convert::Into<crate::model::NodeInitializationAction>,
3392 {
3393 use std::iter::Iterator;
3394 self.initialization_actions = v.into_iter().map(|i| i.into()).collect();
3395 self
3396 }
3397
3398 /// Sets the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3399 ///
3400 /// # Example
3401 /// ```ignore,no_run
3402 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3403 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3404 /// let x = ClusterConfig::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
3405 /// ```
3406 pub fn set_encryption_config<T>(mut self, v: T) -> Self
3407 where
3408 T: std::convert::Into<crate::model::EncryptionConfig>,
3409 {
3410 self.encryption_config = std::option::Option::Some(v.into());
3411 self
3412 }
3413
3414 /// Sets or clears the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3415 ///
3416 /// # Example
3417 /// ```ignore,no_run
3418 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3419 /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3420 /// let x = ClusterConfig::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
3421 /// let x = ClusterConfig::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
3422 /// ```
3423 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3424 where
3425 T: std::convert::Into<crate::model::EncryptionConfig>,
3426 {
3427 self.encryption_config = v.map(|x| x.into());
3428 self
3429 }
3430
3431 /// Sets the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3432 ///
3433 /// # Example
3434 /// ```ignore,no_run
3435 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3436 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3437 /// let x = ClusterConfig::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
3438 /// ```
3439 pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
3440 where
3441 T: std::convert::Into<crate::model::AutoscalingConfig>,
3442 {
3443 self.autoscaling_config = std::option::Option::Some(v.into());
3444 self
3445 }
3446
3447 /// Sets or clears the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3448 ///
3449 /// # Example
3450 /// ```ignore,no_run
3451 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3452 /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3453 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
3454 /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
3455 /// ```
3456 pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
3457 where
3458 T: std::convert::Into<crate::model::AutoscalingConfig>,
3459 {
3460 self.autoscaling_config = v.map(|x| x.into());
3461 self
3462 }
3463
3464 /// Sets the value of [security_config][crate::model::ClusterConfig::security_config].
3465 ///
3466 /// # Example
3467 /// ```ignore,no_run
3468 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3469 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3470 /// let x = ClusterConfig::new().set_security_config(SecurityConfig::default()/* use setters */);
3471 /// ```
3472 pub fn set_security_config<T>(mut self, v: T) -> Self
3473 where
3474 T: std::convert::Into<crate::model::SecurityConfig>,
3475 {
3476 self.security_config = std::option::Option::Some(v.into());
3477 self
3478 }
3479
3480 /// Sets or clears the value of [security_config][crate::model::ClusterConfig::security_config].
3481 ///
3482 /// # Example
3483 /// ```ignore,no_run
3484 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3485 /// use google_cloud_dataproc_v1::model::SecurityConfig;
3486 /// let x = ClusterConfig::new().set_or_clear_security_config(Some(SecurityConfig::default()/* use setters */));
3487 /// let x = ClusterConfig::new().set_or_clear_security_config(None::<SecurityConfig>);
3488 /// ```
3489 pub fn set_or_clear_security_config<T>(mut self, v: std::option::Option<T>) -> Self
3490 where
3491 T: std::convert::Into<crate::model::SecurityConfig>,
3492 {
3493 self.security_config = v.map(|x| x.into());
3494 self
3495 }
3496
3497 /// Sets the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3498 ///
3499 /// # Example
3500 /// ```ignore,no_run
3501 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3502 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3503 /// let x = ClusterConfig::new().set_lifecycle_config(LifecycleConfig::default()/* use setters */);
3504 /// ```
3505 pub fn set_lifecycle_config<T>(mut self, v: T) -> Self
3506 where
3507 T: std::convert::Into<crate::model::LifecycleConfig>,
3508 {
3509 self.lifecycle_config = std::option::Option::Some(v.into());
3510 self
3511 }
3512
3513 /// Sets or clears the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3514 ///
3515 /// # Example
3516 /// ```ignore,no_run
3517 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3518 /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3519 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(Some(LifecycleConfig::default()/* use setters */));
3520 /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(None::<LifecycleConfig>);
3521 /// ```
3522 pub fn set_or_clear_lifecycle_config<T>(mut self, v: std::option::Option<T>) -> Self
3523 where
3524 T: std::convert::Into<crate::model::LifecycleConfig>,
3525 {
3526 self.lifecycle_config = v.map(|x| x.into());
3527 self
3528 }
3529
3530 /// Sets the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3531 ///
3532 /// # Example
3533 /// ```ignore,no_run
3534 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3535 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3536 /// let x = ClusterConfig::new().set_endpoint_config(EndpointConfig::default()/* use setters */);
3537 /// ```
3538 pub fn set_endpoint_config<T>(mut self, v: T) -> Self
3539 where
3540 T: std::convert::Into<crate::model::EndpointConfig>,
3541 {
3542 self.endpoint_config = std::option::Option::Some(v.into());
3543 self
3544 }
3545
3546 /// Sets or clears the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3547 ///
3548 /// # Example
3549 /// ```ignore,no_run
3550 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3551 /// use google_cloud_dataproc_v1::model::EndpointConfig;
3552 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(Some(EndpointConfig::default()/* use setters */));
3553 /// let x = ClusterConfig::new().set_or_clear_endpoint_config(None::<EndpointConfig>);
3554 /// ```
3555 pub fn set_or_clear_endpoint_config<T>(mut self, v: std::option::Option<T>) -> Self
3556 where
3557 T: std::convert::Into<crate::model::EndpointConfig>,
3558 {
3559 self.endpoint_config = v.map(|x| x.into());
3560 self
3561 }
3562
3563 /// Sets the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3564 ///
3565 /// # Example
3566 /// ```ignore,no_run
3567 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3568 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3569 /// let x = ClusterConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
3570 /// ```
3571 pub fn set_metastore_config<T>(mut self, v: T) -> Self
3572 where
3573 T: std::convert::Into<crate::model::MetastoreConfig>,
3574 {
3575 self.metastore_config = std::option::Option::Some(v.into());
3576 self
3577 }
3578
3579 /// Sets or clears the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3580 ///
3581 /// # Example
3582 /// ```ignore,no_run
3583 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3584 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3585 /// let x = ClusterConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
3586 /// let x = ClusterConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
3587 /// ```
3588 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
3589 where
3590 T: std::convert::Into<crate::model::MetastoreConfig>,
3591 {
3592 self.metastore_config = v.map(|x| x.into());
3593 self
3594 }
3595
3596 /// Sets the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3597 ///
3598 /// # Example
3599 /// ```ignore,no_run
3600 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3601 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3602 /// let x = ClusterConfig::new().set_dataproc_metric_config(DataprocMetricConfig::default()/* use setters */);
3603 /// ```
3604 pub fn set_dataproc_metric_config<T>(mut self, v: T) -> Self
3605 where
3606 T: std::convert::Into<crate::model::DataprocMetricConfig>,
3607 {
3608 self.dataproc_metric_config = std::option::Option::Some(v.into());
3609 self
3610 }
3611
3612 /// Sets or clears the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3613 ///
3614 /// # Example
3615 /// ```ignore,no_run
3616 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3617 /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3618 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(Some(DataprocMetricConfig::default()/* use setters */));
3619 /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(None::<DataprocMetricConfig>);
3620 /// ```
3621 pub fn set_or_clear_dataproc_metric_config<T>(mut self, v: std::option::Option<T>) -> Self
3622 where
3623 T: std::convert::Into<crate::model::DataprocMetricConfig>,
3624 {
3625 self.dataproc_metric_config = v.map(|x| x.into());
3626 self
3627 }
3628
3629 /// Sets the value of [auxiliary_node_groups][crate::model::ClusterConfig::auxiliary_node_groups].
3630 ///
3631 /// # Example
3632 /// ```ignore,no_run
3633 /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3634 /// use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
3635 /// let x = ClusterConfig::new()
3636 /// .set_auxiliary_node_groups([
3637 /// AuxiliaryNodeGroup::default()/* use setters */,
3638 /// AuxiliaryNodeGroup::default()/* use (different) setters */,
3639 /// ]);
3640 /// ```
3641 pub fn set_auxiliary_node_groups<T, V>(mut self, v: T) -> Self
3642 where
3643 T: std::iter::IntoIterator<Item = V>,
3644 V: std::convert::Into<crate::model::AuxiliaryNodeGroup>,
3645 {
3646 use std::iter::Iterator;
3647 self.auxiliary_node_groups = v.into_iter().map(|i| i.into()).collect();
3648 self
3649 }
3650}
3651
3652impl wkt::message::Message for ClusterConfig {
3653 fn typename() -> &'static str {
3654 "type.googleapis.com/google.cloud.dataproc.v1.ClusterConfig"
3655 }
3656}
3657
3658/// Defines additional types related to [ClusterConfig].
3659pub mod cluster_config {
3660 #[allow(unused_imports)]
3661 use super::*;
3662
3663 /// The cluster tier.
3664 ///
3665 /// # Working with unknown values
3666 ///
3667 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3668 /// additional enum variants at any time. Adding new variants is not considered
3669 /// a breaking change. Applications should write their code in anticipation of:
3670 ///
3671 /// - New values appearing in future releases of the client library, **and**
3672 /// - New values received dynamically, without application changes.
3673 ///
3674 /// Please consult the [Working with enums] section in the user guide for some
3675 /// guidelines.
3676 ///
3677 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3678 #[derive(Clone, Debug, PartialEq)]
3679 #[non_exhaustive]
3680 pub enum ClusterTier {
3681 /// Not set. Works the same as CLUSTER_TIER_STANDARD.
3682 Unspecified,
3683 /// Standard Dataproc cluster.
3684 Standard,
3685 /// Premium Dataproc cluster.
3686 Premium,
3687 /// If set, the enum was initialized with an unknown value.
3688 ///
3689 /// Applications can examine the value using [ClusterTier::value] or
3690 /// [ClusterTier::name].
3691 UnknownValue(cluster_tier::UnknownValue),
3692 }
3693
3694 #[doc(hidden)]
3695 pub mod cluster_tier {
3696 #[allow(unused_imports)]
3697 use super::*;
3698 #[derive(Clone, Debug, PartialEq)]
3699 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3700 }
3701
3702 impl ClusterTier {
3703 /// Gets the enum value.
3704 ///
3705 /// Returns `None` if the enum contains an unknown value deserialized from
3706 /// the string representation of enums.
3707 pub fn value(&self) -> std::option::Option<i32> {
3708 match self {
3709 Self::Unspecified => std::option::Option::Some(0),
3710 Self::Standard => std::option::Option::Some(1),
3711 Self::Premium => std::option::Option::Some(2),
3712 Self::UnknownValue(u) => u.0.value(),
3713 }
3714 }
3715
3716 /// Gets the enum value as a string.
3717 ///
3718 /// Returns `None` if the enum contains an unknown value deserialized from
3719 /// the integer representation of enums.
3720 pub fn name(&self) -> std::option::Option<&str> {
3721 match self {
3722 Self::Unspecified => std::option::Option::Some("CLUSTER_TIER_UNSPECIFIED"),
3723 Self::Standard => std::option::Option::Some("CLUSTER_TIER_STANDARD"),
3724 Self::Premium => std::option::Option::Some("CLUSTER_TIER_PREMIUM"),
3725 Self::UnknownValue(u) => u.0.name(),
3726 }
3727 }
3728 }
3729
3730 impl std::default::Default for ClusterTier {
3731 fn default() -> Self {
3732 use std::convert::From;
3733 Self::from(0)
3734 }
3735 }
3736
3737 impl std::fmt::Display for ClusterTier {
3738 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3739 wkt::internal::display_enum(f, self.name(), self.value())
3740 }
3741 }
3742
3743 impl std::convert::From<i32> for ClusterTier {
3744 fn from(value: i32) -> Self {
3745 match value {
3746 0 => Self::Unspecified,
3747 1 => Self::Standard,
3748 2 => Self::Premium,
3749 _ => Self::UnknownValue(cluster_tier::UnknownValue(
3750 wkt::internal::UnknownEnumValue::Integer(value),
3751 )),
3752 }
3753 }
3754 }
3755
3756 impl std::convert::From<&str> for ClusterTier {
3757 fn from(value: &str) -> Self {
3758 use std::string::ToString;
3759 match value {
3760 "CLUSTER_TIER_UNSPECIFIED" => Self::Unspecified,
3761 "CLUSTER_TIER_STANDARD" => Self::Standard,
3762 "CLUSTER_TIER_PREMIUM" => Self::Premium,
3763 _ => Self::UnknownValue(cluster_tier::UnknownValue(
3764 wkt::internal::UnknownEnumValue::String(value.to_string()),
3765 )),
3766 }
3767 }
3768 }
3769
3770 impl serde::ser::Serialize for ClusterTier {
3771 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3772 where
3773 S: serde::Serializer,
3774 {
3775 match self {
3776 Self::Unspecified => serializer.serialize_i32(0),
3777 Self::Standard => serializer.serialize_i32(1),
3778 Self::Premium => serializer.serialize_i32(2),
3779 Self::UnknownValue(u) => u.0.serialize(serializer),
3780 }
3781 }
3782 }
3783
3784 impl<'de> serde::de::Deserialize<'de> for ClusterTier {
3785 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3786 where
3787 D: serde::Deserializer<'de>,
3788 {
3789 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterTier>::new(
3790 ".google.cloud.dataproc.v1.ClusterConfig.ClusterTier",
3791 ))
3792 }
3793 }
3794}
3795
3796/// The Dataproc cluster config for a cluster that does not directly control the
3797/// underlying compute resources, such as a [Dataproc-on-GKE
3798/// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
3799#[derive(Clone, Default, PartialEq)]
3800#[non_exhaustive]
3801pub struct VirtualClusterConfig {
3802 /// Optional. A Cloud Storage bucket used to stage job
3803 /// dependencies, config files, and job driver console output.
3804 /// If you do not specify a staging bucket, Cloud
3805 /// Dataproc will determine a Cloud Storage location (US,
3806 /// ASIA, or EU) for your cluster's staging bucket according to the
3807 /// Compute Engine zone where your cluster is deployed, and then create
3808 /// and manage this project-level, per-location bucket (see
3809 /// [Dataproc staging and temp
3810 /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3811 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3812 /// a Cloud Storage bucket.**
3813 pub staging_bucket: std::string::String,
3814
3815 /// Optional. Configuration of auxiliary services used by this cluster.
3816 pub auxiliary_services_config: std::option::Option<crate::model::AuxiliaryServicesConfig>,
3817
3818 pub infrastructure_config:
3819 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
3820
3821 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3822}
3823
3824impl VirtualClusterConfig {
3825 pub fn new() -> Self {
3826 std::default::Default::default()
3827 }
3828
3829 /// Sets the value of [staging_bucket][crate::model::VirtualClusterConfig::staging_bucket].
3830 ///
3831 /// # Example
3832 /// ```ignore,no_run
3833 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3834 /// let x = VirtualClusterConfig::new().set_staging_bucket("example");
3835 /// ```
3836 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3837 self.staging_bucket = v.into();
3838 self
3839 }
3840
3841 /// Sets the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
3842 ///
3843 /// # Example
3844 /// ```ignore,no_run
3845 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3846 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
3847 /// let x = VirtualClusterConfig::new().set_auxiliary_services_config(AuxiliaryServicesConfig::default()/* use setters */);
3848 /// ```
3849 pub fn set_auxiliary_services_config<T>(mut self, v: T) -> Self
3850 where
3851 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
3852 {
3853 self.auxiliary_services_config = std::option::Option::Some(v.into());
3854 self
3855 }
3856
3857 /// Sets or clears the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
3858 ///
3859 /// # Example
3860 /// ```ignore,no_run
3861 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3862 /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
3863 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(Some(AuxiliaryServicesConfig::default()/* use setters */));
3864 /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(None::<AuxiliaryServicesConfig>);
3865 /// ```
3866 pub fn set_or_clear_auxiliary_services_config<T>(mut self, v: std::option::Option<T>) -> Self
3867 where
3868 T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
3869 {
3870 self.auxiliary_services_config = v.map(|x| x.into());
3871 self
3872 }
3873
3874 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config].
3875 ///
3876 /// Note that all the setters affecting `infrastructure_config` are mutually
3877 /// exclusive.
3878 ///
3879 /// # Example
3880 /// ```ignore,no_run
3881 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3882 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
3883 /// let x = VirtualClusterConfig::new().set_infrastructure_config(Some(
3884 /// google_cloud_dataproc_v1::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(KubernetesClusterConfig::default().into())));
3885 /// ```
3886 pub fn set_infrastructure_config<
3887 T: std::convert::Into<
3888 std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
3889 >,
3890 >(
3891 mut self,
3892 v: T,
3893 ) -> Self {
3894 self.infrastructure_config = v.into();
3895 self
3896 }
3897
3898 /// The value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
3899 /// if it holds a `KubernetesClusterConfig`, `None` if the field is not set or
3900 /// holds a different branch.
3901 pub fn kubernetes_cluster_config(
3902 &self,
3903 ) -> std::option::Option<&std::boxed::Box<crate::model::KubernetesClusterConfig>> {
3904 #[allow(unreachable_patterns)]
3905 self.infrastructure_config.as_ref().and_then(|v| match v {
3906 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
3907 v,
3908 ) => std::option::Option::Some(v),
3909 _ => std::option::Option::None,
3910 })
3911 }
3912
3913 /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
3914 /// to hold a `KubernetesClusterConfig`.
3915 ///
3916 /// Note that all the setters affecting `infrastructure_config` are
3917 /// mutually exclusive.
3918 ///
3919 /// # Example
3920 /// ```ignore,no_run
3921 /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3922 /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
3923 /// let x = VirtualClusterConfig::new().set_kubernetes_cluster_config(KubernetesClusterConfig::default()/* use setters */);
3924 /// assert!(x.kubernetes_cluster_config().is_some());
3925 /// ```
3926 pub fn set_kubernetes_cluster_config<
3927 T: std::convert::Into<std::boxed::Box<crate::model::KubernetesClusterConfig>>,
3928 >(
3929 mut self,
3930 v: T,
3931 ) -> Self {
3932 self.infrastructure_config = std::option::Option::Some(
3933 crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
3934 v.into(),
3935 ),
3936 );
3937 self
3938 }
3939}
3940
3941impl wkt::message::Message for VirtualClusterConfig {
3942 fn typename() -> &'static str {
3943 "type.googleapis.com/google.cloud.dataproc.v1.VirtualClusterConfig"
3944 }
3945}
3946
3947/// Defines additional types related to [VirtualClusterConfig].
3948pub mod virtual_cluster_config {
3949 #[allow(unused_imports)]
3950 use super::*;
3951
3952 #[derive(Clone, Debug, PartialEq)]
3953 #[non_exhaustive]
3954 pub enum InfrastructureConfig {
3955 /// Required. The configuration for running the Dataproc cluster on
3956 /// Kubernetes.
3957 KubernetesClusterConfig(std::boxed::Box<crate::model::KubernetesClusterConfig>),
3958 }
3959}
3960
3961/// Auxiliary services configuration for a Cluster.
3962#[derive(Clone, Default, PartialEq)]
3963#[non_exhaustive]
3964pub struct AuxiliaryServicesConfig {
3965 /// Optional. The Hive Metastore configuration for this workload.
3966 pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3967
3968 /// Optional. The Spark History Server configuration for the workload.
3969 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
3970
3971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3972}
3973
3974impl AuxiliaryServicesConfig {
3975 pub fn new() -> Self {
3976 std::default::Default::default()
3977 }
3978
3979 /// Sets the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
3980 ///
3981 /// # Example
3982 /// ```ignore,no_run
3983 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
3984 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3985 /// let x = AuxiliaryServicesConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
3986 /// ```
3987 pub fn set_metastore_config<T>(mut self, v: T) -> Self
3988 where
3989 T: std::convert::Into<crate::model::MetastoreConfig>,
3990 {
3991 self.metastore_config = std::option::Option::Some(v.into());
3992 self
3993 }
3994
3995 /// Sets or clears the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
3996 ///
3997 /// # Example
3998 /// ```ignore,no_run
3999 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4000 /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4001 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4002 /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4003 /// ```
4004 pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4005 where
4006 T: std::convert::Into<crate::model::MetastoreConfig>,
4007 {
4008 self.metastore_config = v.map(|x| x.into());
4009 self
4010 }
4011
4012 /// Sets the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4013 ///
4014 /// # Example
4015 /// ```ignore,no_run
4016 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4017 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4018 /// let x = AuxiliaryServicesConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
4019 /// ```
4020 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
4021 where
4022 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4023 {
4024 self.spark_history_server_config = std::option::Option::Some(v.into());
4025 self
4026 }
4027
4028 /// Sets or clears the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4029 ///
4030 /// # Example
4031 /// ```ignore,no_run
4032 /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4033 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4034 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
4035 /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
4036 /// ```
4037 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
4038 where
4039 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4040 {
4041 self.spark_history_server_config = v.map(|x| x.into());
4042 self
4043 }
4044}
4045
4046impl wkt::message::Message for AuxiliaryServicesConfig {
4047 fn typename() -> &'static str {
4048 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryServicesConfig"
4049 }
4050}
4051
4052/// Endpoint config for this cluster
4053#[derive(Clone, Default, PartialEq)]
4054#[non_exhaustive]
4055pub struct EndpointConfig {
4056 /// Output only. The map of port descriptions to URLs. Will only be populated
4057 /// if enable_http_port_access is true.
4058 pub http_ports: std::collections::HashMap<std::string::String, std::string::String>,
4059
4060 /// Optional. If true, enable http access to specific ports on the cluster
4061 /// from external sources. Defaults to false.
4062 pub enable_http_port_access: bool,
4063
4064 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4065}
4066
4067impl EndpointConfig {
4068 pub fn new() -> Self {
4069 std::default::Default::default()
4070 }
4071
4072 /// Sets the value of [http_ports][crate::model::EndpointConfig::http_ports].
4073 ///
4074 /// # Example
4075 /// ```ignore,no_run
4076 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4077 /// let x = EndpointConfig::new().set_http_ports([
4078 /// ("key0", "abc"),
4079 /// ("key1", "xyz"),
4080 /// ]);
4081 /// ```
4082 pub fn set_http_ports<T, K, V>(mut self, v: T) -> Self
4083 where
4084 T: std::iter::IntoIterator<Item = (K, V)>,
4085 K: std::convert::Into<std::string::String>,
4086 V: std::convert::Into<std::string::String>,
4087 {
4088 use std::iter::Iterator;
4089 self.http_ports = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4090 self
4091 }
4092
4093 /// Sets the value of [enable_http_port_access][crate::model::EndpointConfig::enable_http_port_access].
4094 ///
4095 /// # Example
4096 /// ```ignore,no_run
4097 /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4098 /// let x = EndpointConfig::new().set_enable_http_port_access(true);
4099 /// ```
4100 pub fn set_enable_http_port_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4101 self.enable_http_port_access = v.into();
4102 self
4103 }
4104}
4105
4106impl wkt::message::Message for EndpointConfig {
4107 fn typename() -> &'static str {
4108 "type.googleapis.com/google.cloud.dataproc.v1.EndpointConfig"
4109 }
4110}
4111
4112/// Autoscaling Policy config associated with the cluster.
4113#[derive(Clone, Default, PartialEq)]
4114#[non_exhaustive]
4115pub struct AutoscalingConfig {
4116 /// Optional. The autoscaling policy used by the cluster.
4117 ///
4118 /// Only resource names including projectid and location (region) are valid.
4119 /// Examples:
4120 ///
4121 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4122 /// * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4123 ///
4124 /// Note that the policy must be in the same project and Dataproc region.
4125 pub policy_uri: std::string::String,
4126
4127 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4128}
4129
4130impl AutoscalingConfig {
4131 pub fn new() -> Self {
4132 std::default::Default::default()
4133 }
4134
4135 /// Sets the value of [policy_uri][crate::model::AutoscalingConfig::policy_uri].
4136 ///
4137 /// # Example
4138 /// ```ignore,no_run
4139 /// # use google_cloud_dataproc_v1::model::AutoscalingConfig;
4140 /// let x = AutoscalingConfig::new().set_policy_uri("example");
4141 /// ```
4142 pub fn set_policy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4143 self.policy_uri = v.into();
4144 self
4145 }
4146}
4147
4148impl wkt::message::Message for AutoscalingConfig {
4149 fn typename() -> &'static str {
4150 "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingConfig"
4151 }
4152}
4153
4154/// Encryption settings for the cluster.
4155#[derive(Clone, Default, PartialEq)]
4156#[non_exhaustive]
4157pub struct EncryptionConfig {
4158 /// Optional. The Cloud KMS key resource name to use for persistent disk
4159 /// encryption for all instances in the cluster. See [Use CMEK with cluster
4160 /// data]
4161 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4162 /// for more information.
4163 pub gce_pd_kms_key_name: std::string::String,
4164
4165 /// Optional. The Cloud KMS key resource name to use for cluster persistent
4166 /// disk and job argument encryption. See [Use CMEK with cluster data]
4167 /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4168 /// for more information.
4169 ///
4170 /// When this key resource name is provided, the following job arguments of
4171 /// the following job types submitted to the cluster are encrypted using CMEK:
4172 ///
4173 /// * [FlinkJob
4174 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
4175 /// * [HadoopJob
4176 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
4177 /// * [SparkJob
4178 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
4179 /// * [SparkRJob
4180 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
4181 /// * [PySparkJob
4182 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
4183 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
4184 /// scriptVariables and queryList.queries
4185 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
4186 /// scriptVariables and queryList.queries
4187 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
4188 /// scriptVariables and queryList.queries
4189 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
4190 /// scriptVariables and queryList.queries
4191 pub kms_key: std::string::String,
4192
4193 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4194}
4195
4196impl EncryptionConfig {
4197 pub fn new() -> Self {
4198 std::default::Default::default()
4199 }
4200
4201 /// Sets the value of [gce_pd_kms_key_name][crate::model::EncryptionConfig::gce_pd_kms_key_name].
4202 ///
4203 /// # Example
4204 /// ```ignore,no_run
4205 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4206 /// let x = EncryptionConfig::new().set_gce_pd_kms_key_name("example");
4207 /// ```
4208 pub fn set_gce_pd_kms_key_name<T: std::convert::Into<std::string::String>>(
4209 mut self,
4210 v: T,
4211 ) -> Self {
4212 self.gce_pd_kms_key_name = v.into();
4213 self
4214 }
4215
4216 /// Sets the value of [kms_key][crate::model::EncryptionConfig::kms_key].
4217 ///
4218 /// # Example
4219 /// ```ignore,no_run
4220 /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4221 /// let x = EncryptionConfig::new().set_kms_key("example");
4222 /// ```
4223 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4224 self.kms_key = v.into();
4225 self
4226 }
4227}
4228
4229impl wkt::message::Message for EncryptionConfig {
4230 fn typename() -> &'static str {
4231 "type.googleapis.com/google.cloud.dataproc.v1.EncryptionConfig"
4232 }
4233}
4234
4235/// Common config settings for resources of Compute Engine cluster
4236/// instances, applicable to all instances in the cluster.
4237#[derive(Clone, Default, PartialEq)]
4238#[non_exhaustive]
4239pub struct GceClusterConfig {
4240 /// Optional. The Compute Engine zone where the Dataproc cluster will be
4241 /// located. If omitted, the service will pick a zone in the cluster's Compute
4242 /// Engine region. On a get request, zone will always be present.
4243 ///
4244 /// A full URL, partial URI, or short name are valid. Examples:
4245 ///
4246 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]`
4247 /// * `projects/[project_id]/zones/[zone]`
4248 /// * `[zone]`
4249 pub zone_uri: std::string::String,
4250
4251 /// Optional. The Compute Engine network to be used for machine
4252 /// communications. Cannot be specified with subnetwork_uri. If neither
4253 /// `network_uri` nor `subnetwork_uri` is specified, the "default" network of
4254 /// the project is used, if it exists. Cannot be a "Custom Subnet Network" (see
4255 /// [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for
4256 /// more information).
4257 ///
4258 /// A full URL, partial URI, or short name are valid. Examples:
4259 ///
4260 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/networks/default`
4261 /// * `projects/[project_id]/global/networks/default`
4262 /// * `default`
4263 pub network_uri: std::string::String,
4264
4265 /// Optional. The Compute Engine subnetwork to be used for machine
4266 /// communications. Cannot be specified with network_uri.
4267 ///
4268 /// A full URL, partial URI, or short name are valid. Examples:
4269 ///
4270 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/regions/[region]/subnetworks/sub0`
4271 /// * `projects/[project_id]/regions/[region]/subnetworks/sub0`
4272 /// * `sub0`
4273 pub subnetwork_uri: std::string::String,
4274
4275 /// Optional. This setting applies to subnetwork-enabled networks. It is set to
4276 /// `true` by default in clusters created with image versions 2.2.x.
4277 ///
4278 /// When set to `true`:
4279 ///
4280 /// * All cluster VMs have internal IP addresses.
4281 /// * [Google Private Access]
4282 /// (<https://cloud.google.com/vpc/docs/private-google-access>)
4283 /// must be enabled to access Dataproc and other Google Cloud APIs.
4284 /// * Off-cluster dependencies must be configured to be accessible
4285 /// without external IP addresses.
4286 ///
4287 /// When set to `false`:
4288 ///
4289 /// * Cluster VMs are not restricted to internal IP addresses.
4290 /// * Ephemeral external IP addresses are assigned to each cluster VM.
4291 pub internal_ip_only: std::option::Option<bool>,
4292
4293 /// Optional. The type of IPv6 access for a cluster.
4294 pub private_ipv6_google_access: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess,
4295
4296 /// Optional. The [Dataproc service
4297 /// account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc)
4298 /// (also see [VM Data Plane
4299 /// identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity))
4300 /// used by Dataproc cluster VM instances to access Google Cloud Platform
4301 /// services.
4302 ///
4303 /// If not specified, the
4304 /// [Compute Engine default service
4305 /// account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
4306 /// is used.
4307 pub service_account: std::string::String,
4308
4309 /// Optional. The URIs of service account scopes to be included in
4310 /// Compute Engine instances. The following base set of scopes is always
4311 /// included:
4312 ///
4313 /// * <https://www.googleapis.com/auth/cloud.useraccounts.readonly>
4314 /// * <https://www.googleapis.com/auth/devstorage.read_write>
4315 /// * <https://www.googleapis.com/auth/logging.write>
4316 ///
4317 /// If no scopes are specified, the following defaults are also provided:
4318 ///
4319 /// * <https://www.googleapis.com/auth/bigquery>
4320 /// * <https://www.googleapis.com/auth/bigtable.admin.table>
4321 /// * <https://www.googleapis.com/auth/bigtable.data>
4322 /// * <https://www.googleapis.com/auth/devstorage.full_control>
4323 pub service_account_scopes: std::vec::Vec<std::string::String>,
4324
4325 /// The Compute Engine network tags to add to all instances (see [Tagging
4326 /// instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)).
4327 pub tags: std::vec::Vec<std::string::String>,
4328
4329 /// Optional. The Compute Engine metadata entries to add to all instances (see
4330 /// [Project and instance
4331 /// metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
4332 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
4333
4334 /// Optional. Reservation Affinity for consuming Zonal reservation.
4335 pub reservation_affinity: std::option::Option<crate::model::ReservationAffinity>,
4336
4337 /// Optional. Node Group Affinity for sole-tenant clusters.
4338 pub node_group_affinity: std::option::Option<crate::model::NodeGroupAffinity>,
4339
4340 /// Optional. Shielded Instance Config for clusters using [Compute Engine
4341 /// Shielded
4342 /// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
4343 pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
4344
4345 /// Optional. Confidential Instance Config for clusters using [Confidential
4346 /// VMs](https://cloud.google.com/compute/confidential-vm/docs).
4347 pub confidential_instance_config: std::option::Option<crate::model::ConfidentialInstanceConfig>,
4348
4349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4350}
4351
4352impl GceClusterConfig {
4353 pub fn new() -> Self {
4354 std::default::Default::default()
4355 }
4356
4357 /// Sets the value of [zone_uri][crate::model::GceClusterConfig::zone_uri].
4358 ///
4359 /// # Example
4360 /// ```ignore,no_run
4361 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4362 /// let x = GceClusterConfig::new().set_zone_uri("example");
4363 /// ```
4364 pub fn set_zone_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4365 self.zone_uri = v.into();
4366 self
4367 }
4368
4369 /// Sets the value of [network_uri][crate::model::GceClusterConfig::network_uri].
4370 ///
4371 /// # Example
4372 /// ```ignore,no_run
4373 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4374 /// let x = GceClusterConfig::new().set_network_uri("example");
4375 /// ```
4376 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4377 self.network_uri = v.into();
4378 self
4379 }
4380
4381 /// Sets the value of [subnetwork_uri][crate::model::GceClusterConfig::subnetwork_uri].
4382 ///
4383 /// # Example
4384 /// ```ignore,no_run
4385 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4386 /// let x = GceClusterConfig::new().set_subnetwork_uri("example");
4387 /// ```
4388 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4389 self.subnetwork_uri = v.into();
4390 self
4391 }
4392
4393 /// Sets the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4394 ///
4395 /// # Example
4396 /// ```ignore,no_run
4397 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4398 /// let x = GceClusterConfig::new().set_internal_ip_only(true);
4399 /// ```
4400 pub fn set_internal_ip_only<T>(mut self, v: T) -> Self
4401 where
4402 T: std::convert::Into<bool>,
4403 {
4404 self.internal_ip_only = std::option::Option::Some(v.into());
4405 self
4406 }
4407
4408 /// Sets or clears the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4409 ///
4410 /// # Example
4411 /// ```ignore,no_run
4412 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4413 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(Some(false));
4414 /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(None::<bool>);
4415 /// ```
4416 pub fn set_or_clear_internal_ip_only<T>(mut self, v: std::option::Option<T>) -> Self
4417 where
4418 T: std::convert::Into<bool>,
4419 {
4420 self.internal_ip_only = v.map(|x| x.into());
4421 self
4422 }
4423
4424 /// Sets the value of [private_ipv6_google_access][crate::model::GceClusterConfig::private_ipv6_google_access].
4425 ///
4426 /// # Example
4427 /// ```ignore,no_run
4428 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4429 /// use google_cloud_dataproc_v1::model::gce_cluster_config::PrivateIpv6GoogleAccess;
4430 /// let x0 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::InheritFromSubnetwork);
4431 /// let x1 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Outbound);
4432 /// let x2 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Bidirectional);
4433 /// ```
4434 pub fn set_private_ipv6_google_access<
4435 T: std::convert::Into<crate::model::gce_cluster_config::PrivateIpv6GoogleAccess>,
4436 >(
4437 mut self,
4438 v: T,
4439 ) -> Self {
4440 self.private_ipv6_google_access = v.into();
4441 self
4442 }
4443
4444 /// Sets the value of [service_account][crate::model::GceClusterConfig::service_account].
4445 ///
4446 /// # Example
4447 /// ```ignore,no_run
4448 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4449 /// let x = GceClusterConfig::new().set_service_account("example");
4450 /// ```
4451 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4452 self.service_account = v.into();
4453 self
4454 }
4455
4456 /// Sets the value of [service_account_scopes][crate::model::GceClusterConfig::service_account_scopes].
4457 ///
4458 /// # Example
4459 /// ```ignore,no_run
4460 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4461 /// let x = GceClusterConfig::new().set_service_account_scopes(["a", "b", "c"]);
4462 /// ```
4463 pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
4464 where
4465 T: std::iter::IntoIterator<Item = V>,
4466 V: std::convert::Into<std::string::String>,
4467 {
4468 use std::iter::Iterator;
4469 self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
4470 self
4471 }
4472
4473 /// Sets the value of [tags][crate::model::GceClusterConfig::tags].
4474 ///
4475 /// # Example
4476 /// ```ignore,no_run
4477 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4478 /// let x = GceClusterConfig::new().set_tags(["a", "b", "c"]);
4479 /// ```
4480 pub fn set_tags<T, V>(mut self, v: T) -> Self
4481 where
4482 T: std::iter::IntoIterator<Item = V>,
4483 V: std::convert::Into<std::string::String>,
4484 {
4485 use std::iter::Iterator;
4486 self.tags = v.into_iter().map(|i| i.into()).collect();
4487 self
4488 }
4489
4490 /// Sets the value of [metadata][crate::model::GceClusterConfig::metadata].
4491 ///
4492 /// # Example
4493 /// ```ignore,no_run
4494 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4495 /// let x = GceClusterConfig::new().set_metadata([
4496 /// ("key0", "abc"),
4497 /// ("key1", "xyz"),
4498 /// ]);
4499 /// ```
4500 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
4501 where
4502 T: std::iter::IntoIterator<Item = (K, V)>,
4503 K: std::convert::Into<std::string::String>,
4504 V: std::convert::Into<std::string::String>,
4505 {
4506 use std::iter::Iterator;
4507 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4508 self
4509 }
4510
4511 /// Sets the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
4512 ///
4513 /// # Example
4514 /// ```ignore,no_run
4515 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4516 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
4517 /// let x = GceClusterConfig::new().set_reservation_affinity(ReservationAffinity::default()/* use setters */);
4518 /// ```
4519 pub fn set_reservation_affinity<T>(mut self, v: T) -> Self
4520 where
4521 T: std::convert::Into<crate::model::ReservationAffinity>,
4522 {
4523 self.reservation_affinity = std::option::Option::Some(v.into());
4524 self
4525 }
4526
4527 /// Sets or clears the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
4528 ///
4529 /// # Example
4530 /// ```ignore,no_run
4531 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4532 /// use google_cloud_dataproc_v1::model::ReservationAffinity;
4533 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(Some(ReservationAffinity::default()/* use setters */));
4534 /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(None::<ReservationAffinity>);
4535 /// ```
4536 pub fn set_or_clear_reservation_affinity<T>(mut self, v: std::option::Option<T>) -> Self
4537 where
4538 T: std::convert::Into<crate::model::ReservationAffinity>,
4539 {
4540 self.reservation_affinity = v.map(|x| x.into());
4541 self
4542 }
4543
4544 /// Sets the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
4545 ///
4546 /// # Example
4547 /// ```ignore,no_run
4548 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4549 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4550 /// let x = GceClusterConfig::new().set_node_group_affinity(NodeGroupAffinity::default()/* use setters */);
4551 /// ```
4552 pub fn set_node_group_affinity<T>(mut self, v: T) -> Self
4553 where
4554 T: std::convert::Into<crate::model::NodeGroupAffinity>,
4555 {
4556 self.node_group_affinity = std::option::Option::Some(v.into());
4557 self
4558 }
4559
4560 /// Sets or clears the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
4561 ///
4562 /// # Example
4563 /// ```ignore,no_run
4564 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4565 /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4566 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(Some(NodeGroupAffinity::default()/* use setters */));
4567 /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(None::<NodeGroupAffinity>);
4568 /// ```
4569 pub fn set_or_clear_node_group_affinity<T>(mut self, v: std::option::Option<T>) -> Self
4570 where
4571 T: std::convert::Into<crate::model::NodeGroupAffinity>,
4572 {
4573 self.node_group_affinity = v.map(|x| x.into());
4574 self
4575 }
4576
4577 /// Sets the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
4578 ///
4579 /// # Example
4580 /// ```ignore,no_run
4581 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4582 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4583 /// let x = GceClusterConfig::new().set_shielded_instance_config(ShieldedInstanceConfig::default()/* use setters */);
4584 /// ```
4585 pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
4586 where
4587 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
4588 {
4589 self.shielded_instance_config = std::option::Option::Some(v.into());
4590 self
4591 }
4592
4593 /// Sets or clears the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
4594 ///
4595 /// # Example
4596 /// ```ignore,no_run
4597 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4598 /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4599 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(Some(ShieldedInstanceConfig::default()/* use setters */));
4600 /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(None::<ShieldedInstanceConfig>);
4601 /// ```
4602 pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4603 where
4604 T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
4605 {
4606 self.shielded_instance_config = v.map(|x| x.into());
4607 self
4608 }
4609
4610 /// Sets the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
4611 ///
4612 /// # Example
4613 /// ```ignore,no_run
4614 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4615 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
4616 /// let x = GceClusterConfig::new().set_confidential_instance_config(ConfidentialInstanceConfig::default()/* use setters */);
4617 /// ```
4618 pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
4619 where
4620 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
4621 {
4622 self.confidential_instance_config = std::option::Option::Some(v.into());
4623 self
4624 }
4625
4626 /// Sets or clears the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
4627 ///
4628 /// # Example
4629 /// ```ignore,no_run
4630 /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4631 /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
4632 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(Some(ConfidentialInstanceConfig::default()/* use setters */));
4633 /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(None::<ConfidentialInstanceConfig>);
4634 /// ```
4635 pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4636 where
4637 T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
4638 {
4639 self.confidential_instance_config = v.map(|x| x.into());
4640 self
4641 }
4642}
4643
4644impl wkt::message::Message for GceClusterConfig {
4645 fn typename() -> &'static str {
4646 "type.googleapis.com/google.cloud.dataproc.v1.GceClusterConfig"
4647 }
4648}
4649
4650/// Defines additional types related to [GceClusterConfig].
4651pub mod gce_cluster_config {
4652 #[allow(unused_imports)]
4653 use super::*;
4654
4655 /// `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes
4656 /// can communicate with Google Services through gRPC over IPv6.
4657 /// These values are directly mapped to corresponding values in the
4658 /// [Compute Engine Instance
4659 /// fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
4660 ///
4661 /// # Working with unknown values
4662 ///
4663 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4664 /// additional enum variants at any time. Adding new variants is not considered
4665 /// a breaking change. Applications should write their code in anticipation of:
4666 ///
4667 /// - New values appearing in future releases of the client library, **and**
4668 /// - New values received dynamically, without application changes.
4669 ///
4670 /// Please consult the [Working with enums] section in the user guide for some
4671 /// guidelines.
4672 ///
4673 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4674 #[derive(Clone, Debug, PartialEq)]
4675 #[non_exhaustive]
4676 pub enum PrivateIpv6GoogleAccess {
4677 /// If unspecified, Compute Engine default behavior will apply, which
4678 /// is the same as
4679 /// [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK].
4680 ///
4681 /// [google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess::InheritFromSubnetwork
4682 Unspecified,
4683 /// Private access to and from Google Services configuration
4684 /// inherited from the subnetwork configuration. This is the
4685 /// default Compute Engine behavior.
4686 InheritFromSubnetwork,
4687 /// Enables outbound private IPv6 access to Google Services from the Dataproc
4688 /// cluster.
4689 Outbound,
4690 /// Enables bidirectional private IPv6 access between Google Services and the
4691 /// Dataproc cluster.
4692 Bidirectional,
4693 /// If set, the enum was initialized with an unknown value.
4694 ///
4695 /// Applications can examine the value using [PrivateIpv6GoogleAccess::value] or
4696 /// [PrivateIpv6GoogleAccess::name].
4697 UnknownValue(private_ipv_6_google_access::UnknownValue),
4698 }
4699
4700 #[doc(hidden)]
4701 pub mod private_ipv_6_google_access {
4702 #[allow(unused_imports)]
4703 use super::*;
4704 #[derive(Clone, Debug, PartialEq)]
4705 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4706 }
4707
4708 impl PrivateIpv6GoogleAccess {
4709 /// Gets the enum value.
4710 ///
4711 /// Returns `None` if the enum contains an unknown value deserialized from
4712 /// the string representation of enums.
4713 pub fn value(&self) -> std::option::Option<i32> {
4714 match self {
4715 Self::Unspecified => std::option::Option::Some(0),
4716 Self::InheritFromSubnetwork => std::option::Option::Some(1),
4717 Self::Outbound => std::option::Option::Some(2),
4718 Self::Bidirectional => std::option::Option::Some(3),
4719 Self::UnknownValue(u) => u.0.value(),
4720 }
4721 }
4722
4723 /// Gets the enum value as a string.
4724 ///
4725 /// Returns `None` if the enum contains an unknown value deserialized from
4726 /// the integer representation of enums.
4727 pub fn name(&self) -> std::option::Option<&str> {
4728 match self {
4729 Self::Unspecified => {
4730 std::option::Option::Some("PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED")
4731 }
4732 Self::InheritFromSubnetwork => std::option::Option::Some("INHERIT_FROM_SUBNETWORK"),
4733 Self::Outbound => std::option::Option::Some("OUTBOUND"),
4734 Self::Bidirectional => std::option::Option::Some("BIDIRECTIONAL"),
4735 Self::UnknownValue(u) => u.0.name(),
4736 }
4737 }
4738 }
4739
4740 impl std::default::Default for PrivateIpv6GoogleAccess {
4741 fn default() -> Self {
4742 use std::convert::From;
4743 Self::from(0)
4744 }
4745 }
4746
4747 impl std::fmt::Display for PrivateIpv6GoogleAccess {
4748 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4749 wkt::internal::display_enum(f, self.name(), self.value())
4750 }
4751 }
4752
4753 impl std::convert::From<i32> for PrivateIpv6GoogleAccess {
4754 fn from(value: i32) -> Self {
4755 match value {
4756 0 => Self::Unspecified,
4757 1 => Self::InheritFromSubnetwork,
4758 2 => Self::Outbound,
4759 3 => Self::Bidirectional,
4760 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
4761 wkt::internal::UnknownEnumValue::Integer(value),
4762 )),
4763 }
4764 }
4765 }
4766
4767 impl std::convert::From<&str> for PrivateIpv6GoogleAccess {
4768 fn from(value: &str) -> Self {
4769 use std::string::ToString;
4770 match value {
4771 "PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED" => Self::Unspecified,
4772 "INHERIT_FROM_SUBNETWORK" => Self::InheritFromSubnetwork,
4773 "OUTBOUND" => Self::Outbound,
4774 "BIDIRECTIONAL" => Self::Bidirectional,
4775 _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
4776 wkt::internal::UnknownEnumValue::String(value.to_string()),
4777 )),
4778 }
4779 }
4780 }
4781
4782 impl serde::ser::Serialize for PrivateIpv6GoogleAccess {
4783 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4784 where
4785 S: serde::Serializer,
4786 {
4787 match self {
4788 Self::Unspecified => serializer.serialize_i32(0),
4789 Self::InheritFromSubnetwork => serializer.serialize_i32(1),
4790 Self::Outbound => serializer.serialize_i32(2),
4791 Self::Bidirectional => serializer.serialize_i32(3),
4792 Self::UnknownValue(u) => u.0.serialize(serializer),
4793 }
4794 }
4795 }
4796
4797 impl<'de> serde::de::Deserialize<'de> for PrivateIpv6GoogleAccess {
4798 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4799 where
4800 D: serde::Deserializer<'de>,
4801 {
4802 deserializer.deserialize_any(
4803 wkt::internal::EnumVisitor::<PrivateIpv6GoogleAccess>::new(
4804 ".google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess",
4805 ),
4806 )
4807 }
4808 }
4809}
4810
4811/// Node Group Affinity for clusters using sole-tenant node groups.
4812/// **The Dataproc `NodeGroupAffinity` resource is not related to the
4813/// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.**
4814///
4815/// [google.cloud.dataproc.v1.NodeGroup]: crate::model::NodeGroup
4816#[derive(Clone, Default, PartialEq)]
4817#[non_exhaustive]
4818pub struct NodeGroupAffinity {
4819 /// Required. The URI of a
4820 /// sole-tenant [node group
4821 /// resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups)
4822 /// that the cluster will be created on.
4823 ///
4824 /// A full URL, partial URI, or node group name are valid. Examples:
4825 ///
4826 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/nodeGroups/node-group-1`
4827 /// * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1`
4828 /// * `node-group-1`
4829 pub node_group_uri: std::string::String,
4830
4831 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4832}
4833
4834impl NodeGroupAffinity {
4835 pub fn new() -> Self {
4836 std::default::Default::default()
4837 }
4838
4839 /// Sets the value of [node_group_uri][crate::model::NodeGroupAffinity::node_group_uri].
4840 ///
4841 /// # Example
4842 /// ```ignore,no_run
4843 /// # use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4844 /// let x = NodeGroupAffinity::new().set_node_group_uri("example");
4845 /// ```
4846 pub fn set_node_group_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4847 self.node_group_uri = v.into();
4848 self
4849 }
4850}
4851
4852impl wkt::message::Message for NodeGroupAffinity {
4853 fn typename() -> &'static str {
4854 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupAffinity"
4855 }
4856}
4857
4858/// Shielded Instance Config for clusters using [Compute Engine Shielded
4859/// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
4860#[derive(Clone, Default, PartialEq)]
4861#[non_exhaustive]
4862pub struct ShieldedInstanceConfig {
4863 /// Optional. Defines whether instances have Secure Boot enabled.
4864 pub enable_secure_boot: std::option::Option<bool>,
4865
4866 /// Optional. Defines whether instances have the vTPM enabled.
4867 pub enable_vtpm: std::option::Option<bool>,
4868
4869 /// Optional. Defines whether instances have integrity monitoring enabled.
4870 pub enable_integrity_monitoring: std::option::Option<bool>,
4871
4872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4873}
4874
4875impl ShieldedInstanceConfig {
4876 pub fn new() -> Self {
4877 std::default::Default::default()
4878 }
4879
4880 /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
4881 ///
4882 /// # Example
4883 /// ```ignore,no_run
4884 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4885 /// let x = ShieldedInstanceConfig::new().set_enable_secure_boot(true);
4886 /// ```
4887 pub fn set_enable_secure_boot<T>(mut self, v: T) -> Self
4888 where
4889 T: std::convert::Into<bool>,
4890 {
4891 self.enable_secure_boot = std::option::Option::Some(v.into());
4892 self
4893 }
4894
4895 /// Sets or clears the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
4896 ///
4897 /// # Example
4898 /// ```ignore,no_run
4899 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4900 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(Some(false));
4901 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(None::<bool>);
4902 /// ```
4903 pub fn set_or_clear_enable_secure_boot<T>(mut self, v: std::option::Option<T>) -> Self
4904 where
4905 T: std::convert::Into<bool>,
4906 {
4907 self.enable_secure_boot = v.map(|x| x.into());
4908 self
4909 }
4910
4911 /// Sets the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
4912 ///
4913 /// # Example
4914 /// ```ignore,no_run
4915 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4916 /// let x = ShieldedInstanceConfig::new().set_enable_vtpm(true);
4917 /// ```
4918 pub fn set_enable_vtpm<T>(mut self, v: T) -> Self
4919 where
4920 T: std::convert::Into<bool>,
4921 {
4922 self.enable_vtpm = std::option::Option::Some(v.into());
4923 self
4924 }
4925
4926 /// Sets or clears the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
4927 ///
4928 /// # Example
4929 /// ```ignore,no_run
4930 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4931 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(Some(false));
4932 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(None::<bool>);
4933 /// ```
4934 pub fn set_or_clear_enable_vtpm<T>(mut self, v: std::option::Option<T>) -> Self
4935 where
4936 T: std::convert::Into<bool>,
4937 {
4938 self.enable_vtpm = v.map(|x| x.into());
4939 self
4940 }
4941
4942 /// Sets the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
4943 ///
4944 /// # Example
4945 /// ```ignore,no_run
4946 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4947 /// let x = ShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
4948 /// ```
4949 pub fn set_enable_integrity_monitoring<T>(mut self, v: T) -> Self
4950 where
4951 T: std::convert::Into<bool>,
4952 {
4953 self.enable_integrity_monitoring = std::option::Option::Some(v.into());
4954 self
4955 }
4956
4957 /// Sets or clears the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
4958 ///
4959 /// # Example
4960 /// ```ignore,no_run
4961 /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4962 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(Some(false));
4963 /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(None::<bool>);
4964 /// ```
4965 pub fn set_or_clear_enable_integrity_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
4966 where
4967 T: std::convert::Into<bool>,
4968 {
4969 self.enable_integrity_monitoring = v.map(|x| x.into());
4970 self
4971 }
4972}
4973
4974impl wkt::message::Message for ShieldedInstanceConfig {
4975 fn typename() -> &'static str {
4976 "type.googleapis.com/google.cloud.dataproc.v1.ShieldedInstanceConfig"
4977 }
4978}
4979
4980/// Confidential Instance Config for clusters using [Confidential
4981/// VMs](https://cloud.google.com/compute/confidential-vm/docs)
4982#[derive(Clone, Default, PartialEq)]
4983#[non_exhaustive]
4984pub struct ConfidentialInstanceConfig {
4985 /// Optional. Defines whether the instance should have confidential compute
4986 /// enabled.
4987 pub enable_confidential_compute: bool,
4988
4989 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4990}
4991
4992impl ConfidentialInstanceConfig {
4993 pub fn new() -> Self {
4994 std::default::Default::default()
4995 }
4996
4997 /// Sets the value of [enable_confidential_compute][crate::model::ConfidentialInstanceConfig::enable_confidential_compute].
4998 ///
4999 /// # Example
5000 /// ```ignore,no_run
5001 /// # use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5002 /// let x = ConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
5003 /// ```
5004 pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5005 self.enable_confidential_compute = v.into();
5006 self
5007 }
5008}
5009
5010impl wkt::message::Message for ConfidentialInstanceConfig {
5011 fn typename() -> &'static str {
5012 "type.googleapis.com/google.cloud.dataproc.v1.ConfidentialInstanceConfig"
5013 }
5014}
5015
5016/// The config settings for Compute Engine resources in
5017/// an instance group, such as a master or worker group.
5018#[derive(Clone, Default, PartialEq)]
5019#[non_exhaustive]
5020pub struct InstanceGroupConfig {
5021 /// Optional. The number of VM instances in the instance group.
5022 /// For [HA
5023 /// cluster](/dataproc/docs/concepts/configuring-clusters/high-availability)
5024 /// [master_config](#FIELDS.master_config) groups, **must be set to 3**.
5025 /// For standard cluster [master_config](#FIELDS.master_config) groups,
5026 /// **must be set to 1**.
5027 pub num_instances: i32,
5028
5029 /// Output only. The list of instance names. Dataproc derives the names
5030 /// from `cluster_name`, `num_instances`, and the instance group.
5031 pub instance_names: std::vec::Vec<std::string::String>,
5032
5033 /// Output only. List of references to Compute Engine instances.
5034 pub instance_references: std::vec::Vec<crate::model::InstanceReference>,
5035
5036 /// Optional. The Compute Engine image resource used for cluster instances.
5037 ///
5038 /// The URI can represent an image or image family.
5039 ///
5040 /// Image examples:
5041 ///
5042 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/[image-id]`
5043 /// * `projects/[project_id]/global/images/[image-id]`
5044 /// * `image-id`
5045 ///
5046 /// Image family examples. Dataproc will use the most recent
5047 /// image from the family:
5048 ///
5049 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/family/[custom-image-family-name]`
5050 /// * `projects/[project_id]/global/images/family/[custom-image-family-name]`
5051 ///
5052 /// If the URI is unspecified, it will be inferred from
5053 /// `SoftwareConfig.image_version` or the system default.
5054 pub image_uri: std::string::String,
5055
5056 /// Optional. The Compute Engine machine type used for cluster instances.
5057 ///
5058 /// A full URL, partial URI, or short name are valid. Examples:
5059 ///
5060 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5061 /// * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5062 /// * `n1-standard-2`
5063 ///
5064 /// **Auto Zone Exception**: If you are using the Dataproc
5065 /// [Auto Zone
5066 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
5067 /// feature, you must use the short name of the machine type
5068 /// resource, for example, `n1-standard-2`.
5069 pub machine_type_uri: std::string::String,
5070
5071 /// Optional. Disk option config settings.
5072 pub disk_config: std::option::Option<crate::model::DiskConfig>,
5073
5074 /// Output only. Specifies that this instance group contains preemptible
5075 /// instances.
5076 pub is_preemptible: bool,
5077
5078 /// Optional. Specifies the preemptibility of the instance group.
5079 ///
5080 /// The default value for master and worker groups is
5081 /// `NON_PREEMPTIBLE`. This default cannot be changed.
5082 ///
5083 /// The default value for secondary instances is
5084 /// `PREEMPTIBLE`.
5085 pub preemptibility: crate::model::instance_group_config::Preemptibility,
5086
5087 /// Output only. The config for Compute Engine Instance Group
5088 /// Manager that manages this group.
5089 /// This is only used for preemptible instance groups.
5090 pub managed_group_config: std::option::Option<crate::model::ManagedGroupConfig>,
5091
5092 /// Optional. The Compute Engine accelerator configuration for these
5093 /// instances.
5094 pub accelerators: std::vec::Vec<crate::model::AcceleratorConfig>,
5095
5096 /// Optional. Specifies the minimum cpu platform for the Instance Group.
5097 /// See [Dataproc -> Minimum CPU
5098 /// Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu).
5099 pub min_cpu_platform: std::string::String,
5100
5101 /// Optional. The minimum number of primary worker instances to create.
5102 /// If `min_num_instances` is set, cluster creation will succeed if
5103 /// the number of primary workers created is at least equal to the
5104 /// `min_num_instances` number.
5105 ///
5106 /// Example: Cluster creation request with `num_instances` = `5` and
5107 /// `min_num_instances` = `3`:
5108 ///
5109 /// * If 4 VMs are created and 1 instance fails,
5110 /// the failed VM is deleted. The cluster is
5111 /// resized to 4 instances and placed in a `RUNNING` state.
5112 /// * If 2 instances are created and 3 instances fail,
5113 /// the cluster in placed in an `ERROR` state. The failed VMs
5114 /// are not deleted.
5115 pub min_num_instances: i32,
5116
5117 /// Optional. Instance flexibility Policy allowing a mixture of VM shapes and
5118 /// provisioning models.
5119 pub instance_flexibility_policy: std::option::Option<crate::model::InstanceFlexibilityPolicy>,
5120
5121 /// Optional. Configuration to handle the startup of instances during cluster
5122 /// create and update process.
5123 pub startup_config: std::option::Option<crate::model::StartupConfig>,
5124
5125 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5126}
5127
5128impl InstanceGroupConfig {
5129 pub fn new() -> Self {
5130 std::default::Default::default()
5131 }
5132
5133 /// Sets the value of [num_instances][crate::model::InstanceGroupConfig::num_instances].
5134 ///
5135 /// # Example
5136 /// ```ignore,no_run
5137 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5138 /// let x = InstanceGroupConfig::new().set_num_instances(42);
5139 /// ```
5140 pub fn set_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5141 self.num_instances = v.into();
5142 self
5143 }
5144
5145 /// Sets the value of [instance_names][crate::model::InstanceGroupConfig::instance_names].
5146 ///
5147 /// # Example
5148 /// ```ignore,no_run
5149 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5150 /// let x = InstanceGroupConfig::new().set_instance_names(["a", "b", "c"]);
5151 /// ```
5152 pub fn set_instance_names<T, V>(mut self, v: T) -> Self
5153 where
5154 T: std::iter::IntoIterator<Item = V>,
5155 V: std::convert::Into<std::string::String>,
5156 {
5157 use std::iter::Iterator;
5158 self.instance_names = v.into_iter().map(|i| i.into()).collect();
5159 self
5160 }
5161
5162 /// Sets the value of [instance_references][crate::model::InstanceGroupConfig::instance_references].
5163 ///
5164 /// # Example
5165 /// ```ignore,no_run
5166 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5167 /// use google_cloud_dataproc_v1::model::InstanceReference;
5168 /// let x = InstanceGroupConfig::new()
5169 /// .set_instance_references([
5170 /// InstanceReference::default()/* use setters */,
5171 /// InstanceReference::default()/* use (different) setters */,
5172 /// ]);
5173 /// ```
5174 pub fn set_instance_references<T, V>(mut self, v: T) -> Self
5175 where
5176 T: std::iter::IntoIterator<Item = V>,
5177 V: std::convert::Into<crate::model::InstanceReference>,
5178 {
5179 use std::iter::Iterator;
5180 self.instance_references = v.into_iter().map(|i| i.into()).collect();
5181 self
5182 }
5183
5184 /// Sets the value of [image_uri][crate::model::InstanceGroupConfig::image_uri].
5185 ///
5186 /// # Example
5187 /// ```ignore,no_run
5188 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5189 /// let x = InstanceGroupConfig::new().set_image_uri("example");
5190 /// ```
5191 pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5192 self.image_uri = v.into();
5193 self
5194 }
5195
5196 /// Sets the value of [machine_type_uri][crate::model::InstanceGroupConfig::machine_type_uri].
5197 ///
5198 /// # Example
5199 /// ```ignore,no_run
5200 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5201 /// let x = InstanceGroupConfig::new().set_machine_type_uri("example");
5202 /// ```
5203 pub fn set_machine_type_uri<T: std::convert::Into<std::string::String>>(
5204 mut self,
5205 v: T,
5206 ) -> Self {
5207 self.machine_type_uri = v.into();
5208 self
5209 }
5210
5211 /// Sets the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5212 ///
5213 /// # Example
5214 /// ```ignore,no_run
5215 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5216 /// use google_cloud_dataproc_v1::model::DiskConfig;
5217 /// let x = InstanceGroupConfig::new().set_disk_config(DiskConfig::default()/* use setters */);
5218 /// ```
5219 pub fn set_disk_config<T>(mut self, v: T) -> Self
5220 where
5221 T: std::convert::Into<crate::model::DiskConfig>,
5222 {
5223 self.disk_config = std::option::Option::Some(v.into());
5224 self
5225 }
5226
5227 /// Sets or clears the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5228 ///
5229 /// # Example
5230 /// ```ignore,no_run
5231 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5232 /// use google_cloud_dataproc_v1::model::DiskConfig;
5233 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(Some(DiskConfig::default()/* use setters */));
5234 /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(None::<DiskConfig>);
5235 /// ```
5236 pub fn set_or_clear_disk_config<T>(mut self, v: std::option::Option<T>) -> Self
5237 where
5238 T: std::convert::Into<crate::model::DiskConfig>,
5239 {
5240 self.disk_config = v.map(|x| x.into());
5241 self
5242 }
5243
5244 /// Sets the value of [is_preemptible][crate::model::InstanceGroupConfig::is_preemptible].
5245 ///
5246 /// # Example
5247 /// ```ignore,no_run
5248 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5249 /// let x = InstanceGroupConfig::new().set_is_preemptible(true);
5250 /// ```
5251 pub fn set_is_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5252 self.is_preemptible = v.into();
5253 self
5254 }
5255
5256 /// Sets the value of [preemptibility][crate::model::InstanceGroupConfig::preemptibility].
5257 ///
5258 /// # Example
5259 /// ```ignore,no_run
5260 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5261 /// use google_cloud_dataproc_v1::model::instance_group_config::Preemptibility;
5262 /// let x0 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::NonPreemptible);
5263 /// let x1 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Preemptible);
5264 /// let x2 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Spot);
5265 /// ```
5266 pub fn set_preemptibility<
5267 T: std::convert::Into<crate::model::instance_group_config::Preemptibility>,
5268 >(
5269 mut self,
5270 v: T,
5271 ) -> Self {
5272 self.preemptibility = v.into();
5273 self
5274 }
5275
5276 /// Sets the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5277 ///
5278 /// # Example
5279 /// ```ignore,no_run
5280 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5281 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5282 /// let x = InstanceGroupConfig::new().set_managed_group_config(ManagedGroupConfig::default()/* use setters */);
5283 /// ```
5284 pub fn set_managed_group_config<T>(mut self, v: T) -> Self
5285 where
5286 T: std::convert::Into<crate::model::ManagedGroupConfig>,
5287 {
5288 self.managed_group_config = std::option::Option::Some(v.into());
5289 self
5290 }
5291
5292 /// Sets or clears the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5293 ///
5294 /// # Example
5295 /// ```ignore,no_run
5296 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5297 /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5298 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(Some(ManagedGroupConfig::default()/* use setters */));
5299 /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(None::<ManagedGroupConfig>);
5300 /// ```
5301 pub fn set_or_clear_managed_group_config<T>(mut self, v: std::option::Option<T>) -> Self
5302 where
5303 T: std::convert::Into<crate::model::ManagedGroupConfig>,
5304 {
5305 self.managed_group_config = v.map(|x| x.into());
5306 self
5307 }
5308
5309 /// Sets the value of [accelerators][crate::model::InstanceGroupConfig::accelerators].
5310 ///
5311 /// # Example
5312 /// ```ignore,no_run
5313 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5314 /// use google_cloud_dataproc_v1::model::AcceleratorConfig;
5315 /// let x = InstanceGroupConfig::new()
5316 /// .set_accelerators([
5317 /// AcceleratorConfig::default()/* use setters */,
5318 /// AcceleratorConfig::default()/* use (different) setters */,
5319 /// ]);
5320 /// ```
5321 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
5322 where
5323 T: std::iter::IntoIterator<Item = V>,
5324 V: std::convert::Into<crate::model::AcceleratorConfig>,
5325 {
5326 use std::iter::Iterator;
5327 self.accelerators = v.into_iter().map(|i| i.into()).collect();
5328 self
5329 }
5330
5331 /// Sets the value of [min_cpu_platform][crate::model::InstanceGroupConfig::min_cpu_platform].
5332 ///
5333 /// # Example
5334 /// ```ignore,no_run
5335 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5336 /// let x = InstanceGroupConfig::new().set_min_cpu_platform("example");
5337 /// ```
5338 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
5339 mut self,
5340 v: T,
5341 ) -> Self {
5342 self.min_cpu_platform = v.into();
5343 self
5344 }
5345
5346 /// Sets the value of [min_num_instances][crate::model::InstanceGroupConfig::min_num_instances].
5347 ///
5348 /// # Example
5349 /// ```ignore,no_run
5350 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5351 /// let x = InstanceGroupConfig::new().set_min_num_instances(42);
5352 /// ```
5353 pub fn set_min_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5354 self.min_num_instances = v.into();
5355 self
5356 }
5357
5358 /// Sets the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5359 ///
5360 /// # Example
5361 /// ```ignore,no_run
5362 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5363 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5364 /// let x = InstanceGroupConfig::new().set_instance_flexibility_policy(InstanceFlexibilityPolicy::default()/* use setters */);
5365 /// ```
5366 pub fn set_instance_flexibility_policy<T>(mut self, v: T) -> Self
5367 where
5368 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5369 {
5370 self.instance_flexibility_policy = std::option::Option::Some(v.into());
5371 self
5372 }
5373
5374 /// Sets or clears the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5375 ///
5376 /// # Example
5377 /// ```ignore,no_run
5378 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5379 /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5380 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(Some(InstanceFlexibilityPolicy::default()/* use setters */));
5381 /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(None::<InstanceFlexibilityPolicy>);
5382 /// ```
5383 pub fn set_or_clear_instance_flexibility_policy<T>(mut self, v: std::option::Option<T>) -> Self
5384 where
5385 T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5386 {
5387 self.instance_flexibility_policy = v.map(|x| x.into());
5388 self
5389 }
5390
5391 /// Sets the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5392 ///
5393 /// # Example
5394 /// ```ignore,no_run
5395 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5396 /// use google_cloud_dataproc_v1::model::StartupConfig;
5397 /// let x = InstanceGroupConfig::new().set_startup_config(StartupConfig::default()/* use setters */);
5398 /// ```
5399 pub fn set_startup_config<T>(mut self, v: T) -> Self
5400 where
5401 T: std::convert::Into<crate::model::StartupConfig>,
5402 {
5403 self.startup_config = std::option::Option::Some(v.into());
5404 self
5405 }
5406
5407 /// Sets or clears the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5408 ///
5409 /// # Example
5410 /// ```ignore,no_run
5411 /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5412 /// use google_cloud_dataproc_v1::model::StartupConfig;
5413 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(Some(StartupConfig::default()/* use setters */));
5414 /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(None::<StartupConfig>);
5415 /// ```
5416 pub fn set_or_clear_startup_config<T>(mut self, v: std::option::Option<T>) -> Self
5417 where
5418 T: std::convert::Into<crate::model::StartupConfig>,
5419 {
5420 self.startup_config = v.map(|x| x.into());
5421 self
5422 }
5423}
5424
5425impl wkt::message::Message for InstanceGroupConfig {
5426 fn typename() -> &'static str {
5427 "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupConfig"
5428 }
5429}
5430
5431/// Defines additional types related to [InstanceGroupConfig].
5432pub mod instance_group_config {
5433 #[allow(unused_imports)]
5434 use super::*;
5435
5436 /// Controls the use of preemptible instances within the group.
5437 ///
5438 /// # Working with unknown values
5439 ///
5440 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5441 /// additional enum variants at any time. Adding new variants is not considered
5442 /// a breaking change. Applications should write their code in anticipation of:
5443 ///
5444 /// - New values appearing in future releases of the client library, **and**
5445 /// - New values received dynamically, without application changes.
5446 ///
5447 /// Please consult the [Working with enums] section in the user guide for some
5448 /// guidelines.
5449 ///
5450 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5451 #[derive(Clone, Debug, PartialEq)]
5452 #[non_exhaustive]
5453 pub enum Preemptibility {
5454 /// Preemptibility is unspecified, the system will choose the
5455 /// appropriate setting for each instance group.
5456 Unspecified,
5457 /// Instances are non-preemptible.
5458 ///
5459 /// This option is allowed for all instance groups and is the only valid
5460 /// value for Master and Worker instance groups.
5461 NonPreemptible,
5462 /// Instances are [preemptible]
5463 /// (<https://cloud.google.com/compute/docs/instances/preemptible>).
5464 ///
5465 /// This option is allowed only for [secondary worker]
5466 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5467 /// groups.
5468 Preemptible,
5469 /// Instances are [Spot VMs]
5470 /// (<https://cloud.google.com/compute/docs/instances/spot>).
5471 ///
5472 /// This option is allowed only for [secondary worker]
5473 /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5474 /// groups. Spot VMs are the latest version of [preemptible VMs]
5475 /// (<https://cloud.google.com/compute/docs/instances/preemptible>), and
5476 /// provide additional features.
5477 Spot,
5478 /// If set, the enum was initialized with an unknown value.
5479 ///
5480 /// Applications can examine the value using [Preemptibility::value] or
5481 /// [Preemptibility::name].
5482 UnknownValue(preemptibility::UnknownValue),
5483 }
5484
5485 #[doc(hidden)]
5486 pub mod preemptibility {
5487 #[allow(unused_imports)]
5488 use super::*;
5489 #[derive(Clone, Debug, PartialEq)]
5490 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5491 }
5492
5493 impl Preemptibility {
5494 /// Gets the enum value.
5495 ///
5496 /// Returns `None` if the enum contains an unknown value deserialized from
5497 /// the string representation of enums.
5498 pub fn value(&self) -> std::option::Option<i32> {
5499 match self {
5500 Self::Unspecified => std::option::Option::Some(0),
5501 Self::NonPreemptible => std::option::Option::Some(1),
5502 Self::Preemptible => std::option::Option::Some(2),
5503 Self::Spot => std::option::Option::Some(3),
5504 Self::UnknownValue(u) => u.0.value(),
5505 }
5506 }
5507
5508 /// Gets the enum value as a string.
5509 ///
5510 /// Returns `None` if the enum contains an unknown value deserialized from
5511 /// the integer representation of enums.
5512 pub fn name(&self) -> std::option::Option<&str> {
5513 match self {
5514 Self::Unspecified => std::option::Option::Some("PREEMPTIBILITY_UNSPECIFIED"),
5515 Self::NonPreemptible => std::option::Option::Some("NON_PREEMPTIBLE"),
5516 Self::Preemptible => std::option::Option::Some("PREEMPTIBLE"),
5517 Self::Spot => std::option::Option::Some("SPOT"),
5518 Self::UnknownValue(u) => u.0.name(),
5519 }
5520 }
5521 }
5522
5523 impl std::default::Default for Preemptibility {
5524 fn default() -> Self {
5525 use std::convert::From;
5526 Self::from(0)
5527 }
5528 }
5529
5530 impl std::fmt::Display for Preemptibility {
5531 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5532 wkt::internal::display_enum(f, self.name(), self.value())
5533 }
5534 }
5535
5536 impl std::convert::From<i32> for Preemptibility {
5537 fn from(value: i32) -> Self {
5538 match value {
5539 0 => Self::Unspecified,
5540 1 => Self::NonPreemptible,
5541 2 => Self::Preemptible,
5542 3 => Self::Spot,
5543 _ => Self::UnknownValue(preemptibility::UnknownValue(
5544 wkt::internal::UnknownEnumValue::Integer(value),
5545 )),
5546 }
5547 }
5548 }
5549
5550 impl std::convert::From<&str> for Preemptibility {
5551 fn from(value: &str) -> Self {
5552 use std::string::ToString;
5553 match value {
5554 "PREEMPTIBILITY_UNSPECIFIED" => Self::Unspecified,
5555 "NON_PREEMPTIBLE" => Self::NonPreemptible,
5556 "PREEMPTIBLE" => Self::Preemptible,
5557 "SPOT" => Self::Spot,
5558 _ => Self::UnknownValue(preemptibility::UnknownValue(
5559 wkt::internal::UnknownEnumValue::String(value.to_string()),
5560 )),
5561 }
5562 }
5563 }
5564
5565 impl serde::ser::Serialize for Preemptibility {
5566 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5567 where
5568 S: serde::Serializer,
5569 {
5570 match self {
5571 Self::Unspecified => serializer.serialize_i32(0),
5572 Self::NonPreemptible => serializer.serialize_i32(1),
5573 Self::Preemptible => serializer.serialize_i32(2),
5574 Self::Spot => serializer.serialize_i32(3),
5575 Self::UnknownValue(u) => u.0.serialize(serializer),
5576 }
5577 }
5578 }
5579
5580 impl<'de> serde::de::Deserialize<'de> for Preemptibility {
5581 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5582 where
5583 D: serde::Deserializer<'de>,
5584 {
5585 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Preemptibility>::new(
5586 ".google.cloud.dataproc.v1.InstanceGroupConfig.Preemptibility",
5587 ))
5588 }
5589 }
5590}
5591
5592/// Configuration to handle the startup of instances during cluster create and
5593/// update process.
5594#[derive(Clone, Default, PartialEq)]
5595#[non_exhaustive]
5596pub struct StartupConfig {
5597 /// Optional. The config setting to enable cluster creation/ updation to be
5598 /// successful only after required_registration_fraction of instances are up
5599 /// and running. This configuration is applicable to only secondary workers for
5600 /// now. The cluster will fail if required_registration_fraction of instances
5601 /// are not available. This will include instance creation, agent registration,
5602 /// and service registration (if enabled).
5603 pub required_registration_fraction: std::option::Option<f64>,
5604
5605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5606}
5607
5608impl StartupConfig {
5609 pub fn new() -> Self {
5610 std::default::Default::default()
5611 }
5612
5613 /// Sets the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
5614 ///
5615 /// # Example
5616 /// ```ignore,no_run
5617 /// # use google_cloud_dataproc_v1::model::StartupConfig;
5618 /// let x = StartupConfig::new().set_required_registration_fraction(42.0);
5619 /// ```
5620 pub fn set_required_registration_fraction<T>(mut self, v: T) -> Self
5621 where
5622 T: std::convert::Into<f64>,
5623 {
5624 self.required_registration_fraction = std::option::Option::Some(v.into());
5625 self
5626 }
5627
5628 /// Sets or clears the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
5629 ///
5630 /// # Example
5631 /// ```ignore,no_run
5632 /// # use google_cloud_dataproc_v1::model::StartupConfig;
5633 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(Some(42.0));
5634 /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(None::<f32>);
5635 /// ```
5636 pub fn set_or_clear_required_registration_fraction<T>(
5637 mut self,
5638 v: std::option::Option<T>,
5639 ) -> Self
5640 where
5641 T: std::convert::Into<f64>,
5642 {
5643 self.required_registration_fraction = v.map(|x| x.into());
5644 self
5645 }
5646}
5647
5648impl wkt::message::Message for StartupConfig {
5649 fn typename() -> &'static str {
5650 "type.googleapis.com/google.cloud.dataproc.v1.StartupConfig"
5651 }
5652}
5653
5654/// A reference to a Compute Engine instance.
5655#[derive(Clone, Default, PartialEq)]
5656#[non_exhaustive]
5657pub struct InstanceReference {
5658 /// The user-friendly name of the Compute Engine instance.
5659 pub instance_name: std::string::String,
5660
5661 /// The unique identifier of the Compute Engine instance.
5662 pub instance_id: std::string::String,
5663
5664 /// The public RSA key used for sharing data with this instance.
5665 pub public_key: std::string::String,
5666
5667 /// The public ECIES key used for sharing data with this instance.
5668 pub public_ecies_key: std::string::String,
5669
5670 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5671}
5672
5673impl InstanceReference {
5674 pub fn new() -> Self {
5675 std::default::Default::default()
5676 }
5677
5678 /// Sets the value of [instance_name][crate::model::InstanceReference::instance_name].
5679 ///
5680 /// # Example
5681 /// ```ignore,no_run
5682 /// # use google_cloud_dataproc_v1::model::InstanceReference;
5683 /// let x = InstanceReference::new().set_instance_name("example");
5684 /// ```
5685 pub fn set_instance_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5686 self.instance_name = v.into();
5687 self
5688 }
5689
5690 /// Sets the value of [instance_id][crate::model::InstanceReference::instance_id].
5691 ///
5692 /// # Example
5693 /// ```ignore,no_run
5694 /// # use google_cloud_dataproc_v1::model::InstanceReference;
5695 /// let x = InstanceReference::new().set_instance_id("example");
5696 /// ```
5697 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5698 self.instance_id = v.into();
5699 self
5700 }
5701
5702 /// Sets the value of [public_key][crate::model::InstanceReference::public_key].
5703 ///
5704 /// # Example
5705 /// ```ignore,no_run
5706 /// # use google_cloud_dataproc_v1::model::InstanceReference;
5707 /// let x = InstanceReference::new().set_public_key("example");
5708 /// ```
5709 pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5710 self.public_key = v.into();
5711 self
5712 }
5713
5714 /// Sets the value of [public_ecies_key][crate::model::InstanceReference::public_ecies_key].
5715 ///
5716 /// # Example
5717 /// ```ignore,no_run
5718 /// # use google_cloud_dataproc_v1::model::InstanceReference;
5719 /// let x = InstanceReference::new().set_public_ecies_key("example");
5720 /// ```
5721 pub fn set_public_ecies_key<T: std::convert::Into<std::string::String>>(
5722 mut self,
5723 v: T,
5724 ) -> Self {
5725 self.public_ecies_key = v.into();
5726 self
5727 }
5728}
5729
5730impl wkt::message::Message for InstanceReference {
5731 fn typename() -> &'static str {
5732 "type.googleapis.com/google.cloud.dataproc.v1.InstanceReference"
5733 }
5734}
5735
5736/// Specifies the resources used to actively manage an instance group.
5737#[derive(Clone, Default, PartialEq)]
5738#[non_exhaustive]
5739pub struct ManagedGroupConfig {
5740 /// Output only. The name of the Instance Template used for the Managed
5741 /// Instance Group.
5742 pub instance_template_name: std::string::String,
5743
5744 /// Output only. The name of the Instance Group Manager for this group.
5745 pub instance_group_manager_name: std::string::String,
5746
5747 /// Output only. The partial URI to the instance group manager for this group.
5748 /// E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm.
5749 pub instance_group_manager_uri: std::string::String,
5750
5751 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5752}
5753
5754impl ManagedGroupConfig {
5755 pub fn new() -> Self {
5756 std::default::Default::default()
5757 }
5758
5759 /// Sets the value of [instance_template_name][crate::model::ManagedGroupConfig::instance_template_name].
5760 ///
5761 /// # Example
5762 /// ```ignore,no_run
5763 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5764 /// let x = ManagedGroupConfig::new().set_instance_template_name("example");
5765 /// ```
5766 pub fn set_instance_template_name<T: std::convert::Into<std::string::String>>(
5767 mut self,
5768 v: T,
5769 ) -> Self {
5770 self.instance_template_name = v.into();
5771 self
5772 }
5773
5774 /// Sets the value of [instance_group_manager_name][crate::model::ManagedGroupConfig::instance_group_manager_name].
5775 ///
5776 /// # Example
5777 /// ```ignore,no_run
5778 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5779 /// let x = ManagedGroupConfig::new().set_instance_group_manager_name("example");
5780 /// ```
5781 pub fn set_instance_group_manager_name<T: std::convert::Into<std::string::String>>(
5782 mut self,
5783 v: T,
5784 ) -> Self {
5785 self.instance_group_manager_name = v.into();
5786 self
5787 }
5788
5789 /// Sets the value of [instance_group_manager_uri][crate::model::ManagedGroupConfig::instance_group_manager_uri].
5790 ///
5791 /// # Example
5792 /// ```ignore,no_run
5793 /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5794 /// let x = ManagedGroupConfig::new().set_instance_group_manager_uri("example");
5795 /// ```
5796 pub fn set_instance_group_manager_uri<T: std::convert::Into<std::string::String>>(
5797 mut self,
5798 v: T,
5799 ) -> Self {
5800 self.instance_group_manager_uri = v.into();
5801 self
5802 }
5803}
5804
5805impl wkt::message::Message for ManagedGroupConfig {
5806 fn typename() -> &'static str {
5807 "type.googleapis.com/google.cloud.dataproc.v1.ManagedGroupConfig"
5808 }
5809}
5810
5811/// Instance flexibility Policy allowing a mixture of VM shapes and provisioning
5812/// models.
5813#[derive(Clone, Default, PartialEq)]
5814#[non_exhaustive]
5815pub struct InstanceFlexibilityPolicy {
5816 /// Optional. Defines how the Group selects the provisioning model to ensure
5817 /// required reliability.
5818 pub provisioning_model_mix:
5819 std::option::Option<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
5820
5821 /// Optional. List of instance selection options that the group will use when
5822 /// creating new VMs.
5823 pub instance_selection_list:
5824 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelection>,
5825
5826 /// Output only. A list of instance selection results in the group.
5827 pub instance_selection_results:
5828 std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
5829
5830 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5831}
5832
5833impl InstanceFlexibilityPolicy {
5834 pub fn new() -> Self {
5835 std::default::Default::default()
5836 }
5837
5838 /// Sets the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
5839 ///
5840 /// # Example
5841 /// ```ignore,no_run
5842 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5843 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5844 /// let x = InstanceFlexibilityPolicy::new().set_provisioning_model_mix(ProvisioningModelMix::default()/* use setters */);
5845 /// ```
5846 pub fn set_provisioning_model_mix<T>(mut self, v: T) -> Self
5847 where
5848 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
5849 {
5850 self.provisioning_model_mix = std::option::Option::Some(v.into());
5851 self
5852 }
5853
5854 /// Sets or clears the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
5855 ///
5856 /// # Example
5857 /// ```ignore,no_run
5858 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5859 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5860 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(Some(ProvisioningModelMix::default()/* use setters */));
5861 /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(None::<ProvisioningModelMix>);
5862 /// ```
5863 pub fn set_or_clear_provisioning_model_mix<T>(mut self, v: std::option::Option<T>) -> Self
5864 where
5865 T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
5866 {
5867 self.provisioning_model_mix = v.map(|x| x.into());
5868 self
5869 }
5870
5871 /// Sets the value of [instance_selection_list][crate::model::InstanceFlexibilityPolicy::instance_selection_list].
5872 ///
5873 /// # Example
5874 /// ```ignore,no_run
5875 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5876 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
5877 /// let x = InstanceFlexibilityPolicy::new()
5878 /// .set_instance_selection_list([
5879 /// InstanceSelection::default()/* use setters */,
5880 /// InstanceSelection::default()/* use (different) setters */,
5881 /// ]);
5882 /// ```
5883 pub fn set_instance_selection_list<T, V>(mut self, v: T) -> Self
5884 where
5885 T: std::iter::IntoIterator<Item = V>,
5886 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelection>,
5887 {
5888 use std::iter::Iterator;
5889 self.instance_selection_list = v.into_iter().map(|i| i.into()).collect();
5890 self
5891 }
5892
5893 /// Sets the value of [instance_selection_results][crate::model::InstanceFlexibilityPolicy::instance_selection_results].
5894 ///
5895 /// # Example
5896 /// ```ignore,no_run
5897 /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5898 /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
5899 /// let x = InstanceFlexibilityPolicy::new()
5900 /// .set_instance_selection_results([
5901 /// InstanceSelectionResult::default()/* use setters */,
5902 /// InstanceSelectionResult::default()/* use (different) setters */,
5903 /// ]);
5904 /// ```
5905 pub fn set_instance_selection_results<T, V>(mut self, v: T) -> Self
5906 where
5907 T: std::iter::IntoIterator<Item = V>,
5908 V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
5909 {
5910 use std::iter::Iterator;
5911 self.instance_selection_results = v.into_iter().map(|i| i.into()).collect();
5912 self
5913 }
5914}
5915
5916impl wkt::message::Message for InstanceFlexibilityPolicy {
5917 fn typename() -> &'static str {
5918 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy"
5919 }
5920}
5921
5922/// Defines additional types related to [InstanceFlexibilityPolicy].
5923pub mod instance_flexibility_policy {
5924 #[allow(unused_imports)]
5925 use super::*;
5926
5927 /// Defines how Dataproc should create VMs with a mixture of provisioning
5928 /// models.
5929 #[derive(Clone, Default, PartialEq)]
5930 #[non_exhaustive]
5931 pub struct ProvisioningModelMix {
5932 /// Optional. The base capacity that will always use Standard VMs to avoid
5933 /// risk of more preemption than the minimum capacity you need. Dataproc will
5934 /// create only standard VMs until it reaches standard_capacity_base, then it
5935 /// will start using standard_capacity_percent_above_base to mix Spot with
5936 /// Standard VMs. eg. If 15 instances are requested and
5937 /// standard_capacity_base is 5, Dataproc will create 5 standard VMs and then
5938 /// start mixing spot and standard VMs for remaining 10 instances.
5939 pub standard_capacity_base: std::option::Option<i32>,
5940
5941 /// Optional. The percentage of target capacity that should use Standard VM.
5942 /// The remaining percentage will use Spot VMs. The percentage applies only
5943 /// to the capacity above standard_capacity_base. eg. If 15 instances are
5944 /// requested and standard_capacity_base is 5 and
5945 /// standard_capacity_percent_above_base is 30, Dataproc will create 5
5946 /// standard VMs and then start mixing spot and standard VMs for remaining 10
5947 /// instances. The mix will be 30% standard and 70% spot.
5948 pub standard_capacity_percent_above_base: std::option::Option<i32>,
5949
5950 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5951 }
5952
5953 impl ProvisioningModelMix {
5954 pub fn new() -> Self {
5955 std::default::Default::default()
5956 }
5957
5958 /// Sets the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
5959 ///
5960 /// # Example
5961 /// ```ignore,no_run
5962 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5963 /// let x = ProvisioningModelMix::new().set_standard_capacity_base(42);
5964 /// ```
5965 pub fn set_standard_capacity_base<T>(mut self, v: T) -> Self
5966 where
5967 T: std::convert::Into<i32>,
5968 {
5969 self.standard_capacity_base = std::option::Option::Some(v.into());
5970 self
5971 }
5972
5973 /// Sets or clears the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
5974 ///
5975 /// # Example
5976 /// ```ignore,no_run
5977 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5978 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(Some(42));
5979 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(None::<i32>);
5980 /// ```
5981 pub fn set_or_clear_standard_capacity_base<T>(mut self, v: std::option::Option<T>) -> Self
5982 where
5983 T: std::convert::Into<i32>,
5984 {
5985 self.standard_capacity_base = v.map(|x| x.into());
5986 self
5987 }
5988
5989 /// Sets the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
5990 ///
5991 /// # Example
5992 /// ```ignore,no_run
5993 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
5994 /// let x = ProvisioningModelMix::new().set_standard_capacity_percent_above_base(42);
5995 /// ```
5996 pub fn set_standard_capacity_percent_above_base<T>(mut self, v: T) -> Self
5997 where
5998 T: std::convert::Into<i32>,
5999 {
6000 self.standard_capacity_percent_above_base = std::option::Option::Some(v.into());
6001 self
6002 }
6003
6004 /// Sets or clears the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6005 ///
6006 /// # Example
6007 /// ```ignore,no_run
6008 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6009 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(Some(42));
6010 /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(None::<i32>);
6011 /// ```
6012 pub fn set_or_clear_standard_capacity_percent_above_base<T>(
6013 mut self,
6014 v: std::option::Option<T>,
6015 ) -> Self
6016 where
6017 T: std::convert::Into<i32>,
6018 {
6019 self.standard_capacity_percent_above_base = v.map(|x| x.into());
6020 self
6021 }
6022 }
6023
6024 impl wkt::message::Message for ProvisioningModelMix {
6025 fn typename() -> &'static str {
6026 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.ProvisioningModelMix"
6027 }
6028 }
6029
6030 /// Defines machines types and a rank to which the machines types belong.
6031 #[derive(Clone, Default, PartialEq)]
6032 #[non_exhaustive]
6033 pub struct InstanceSelection {
6034 /// Optional. Full machine-type names, e.g. "n1-standard-16".
6035 pub machine_types: std::vec::Vec<std::string::String>,
6036
6037 /// Optional. Preference of this instance selection. Lower number means
6038 /// higher preference. Dataproc will first try to create a VM based on the
6039 /// machine-type with priority rank and fallback to next rank based on
6040 /// availability. Machine types and instance selections with the same
6041 /// priority have the same preference.
6042 pub rank: i32,
6043
6044 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6045 }
6046
6047 impl InstanceSelection {
6048 pub fn new() -> Self {
6049 std::default::Default::default()
6050 }
6051
6052 /// Sets the value of [machine_types][crate::model::instance_flexibility_policy::InstanceSelection::machine_types].
6053 ///
6054 /// # Example
6055 /// ```ignore,no_run
6056 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6057 /// let x = InstanceSelection::new().set_machine_types(["a", "b", "c"]);
6058 /// ```
6059 pub fn set_machine_types<T, V>(mut self, v: T) -> Self
6060 where
6061 T: std::iter::IntoIterator<Item = V>,
6062 V: std::convert::Into<std::string::String>,
6063 {
6064 use std::iter::Iterator;
6065 self.machine_types = v.into_iter().map(|i| i.into()).collect();
6066 self
6067 }
6068
6069 /// Sets the value of [rank][crate::model::instance_flexibility_policy::InstanceSelection::rank].
6070 ///
6071 /// # Example
6072 /// ```ignore,no_run
6073 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6074 /// let x = InstanceSelection::new().set_rank(42);
6075 /// ```
6076 pub fn set_rank<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6077 self.rank = v.into();
6078 self
6079 }
6080 }
6081
6082 impl wkt::message::Message for InstanceSelection {
6083 fn typename() -> &'static str {
6084 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelection"
6085 }
6086 }
6087
6088 /// Defines a mapping from machine types to the number of VMs that are created
6089 /// with each machine type.
6090 #[derive(Clone, Default, PartialEq)]
6091 #[non_exhaustive]
6092 pub struct InstanceSelectionResult {
6093 /// Output only. Full machine-type names, e.g. "n1-standard-16".
6094 pub machine_type: std::option::Option<std::string::String>,
6095
6096 /// Output only. Number of VM provisioned with the machine_type.
6097 pub vm_count: std::option::Option<i32>,
6098
6099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6100 }
6101
6102 impl InstanceSelectionResult {
6103 pub fn new() -> Self {
6104 std::default::Default::default()
6105 }
6106
6107 /// Sets the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6108 ///
6109 /// # Example
6110 /// ```ignore,no_run
6111 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6112 /// let x = InstanceSelectionResult::new().set_machine_type("example");
6113 /// ```
6114 pub fn set_machine_type<T>(mut self, v: T) -> Self
6115 where
6116 T: std::convert::Into<std::string::String>,
6117 {
6118 self.machine_type = std::option::Option::Some(v.into());
6119 self
6120 }
6121
6122 /// Sets or clears the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6123 ///
6124 /// # Example
6125 /// ```ignore,no_run
6126 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6127 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(Some("example"));
6128 /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(None::<String>);
6129 /// ```
6130 pub fn set_or_clear_machine_type<T>(mut self, v: std::option::Option<T>) -> Self
6131 where
6132 T: std::convert::Into<std::string::String>,
6133 {
6134 self.machine_type = v.map(|x| x.into());
6135 self
6136 }
6137
6138 /// Sets the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6139 ///
6140 /// # Example
6141 /// ```ignore,no_run
6142 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6143 /// let x = InstanceSelectionResult::new().set_vm_count(42);
6144 /// ```
6145 pub fn set_vm_count<T>(mut self, v: T) -> Self
6146 where
6147 T: std::convert::Into<i32>,
6148 {
6149 self.vm_count = std::option::Option::Some(v.into());
6150 self
6151 }
6152
6153 /// Sets or clears the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6154 ///
6155 /// # Example
6156 /// ```ignore,no_run
6157 /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6158 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(Some(42));
6159 /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(None::<i32>);
6160 /// ```
6161 pub fn set_or_clear_vm_count<T>(mut self, v: std::option::Option<T>) -> Self
6162 where
6163 T: std::convert::Into<i32>,
6164 {
6165 self.vm_count = v.map(|x| x.into());
6166 self
6167 }
6168 }
6169
6170 impl wkt::message::Message for InstanceSelectionResult {
6171 fn typename() -> &'static str {
6172 "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelectionResult"
6173 }
6174 }
6175}
6176
6177/// Specifies the type and number of accelerator cards attached to the instances
6178/// of an instance. See [GPUs on Compute
6179/// Engine](https://cloud.google.com/compute/docs/gpus/).
6180#[derive(Clone, Default, PartialEq)]
6181#[non_exhaustive]
6182pub struct AcceleratorConfig {
6183 /// Full URL, partial URI, or short name of the accelerator type resource to
6184 /// expose to this instance. See
6185 /// [Compute Engine
6186 /// AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes).
6187 ///
6188 /// Examples:
6189 ///
6190 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6191 /// * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6192 /// * `nvidia-tesla-t4`
6193 ///
6194 /// **Auto Zone Exception**: If you are using the Dataproc
6195 /// [Auto Zone
6196 /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
6197 /// feature, you must use the short name of the accelerator type
6198 /// resource, for example, `nvidia-tesla-t4`.
6199 pub accelerator_type_uri: std::string::String,
6200
6201 /// The number of the accelerator cards of this type exposed to this instance.
6202 pub accelerator_count: i32,
6203
6204 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6205}
6206
6207impl AcceleratorConfig {
6208 pub fn new() -> Self {
6209 std::default::Default::default()
6210 }
6211
6212 /// Sets the value of [accelerator_type_uri][crate::model::AcceleratorConfig::accelerator_type_uri].
6213 ///
6214 /// # Example
6215 /// ```ignore,no_run
6216 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6217 /// let x = AcceleratorConfig::new().set_accelerator_type_uri("example");
6218 /// ```
6219 pub fn set_accelerator_type_uri<T: std::convert::Into<std::string::String>>(
6220 mut self,
6221 v: T,
6222 ) -> Self {
6223 self.accelerator_type_uri = v.into();
6224 self
6225 }
6226
6227 /// Sets the value of [accelerator_count][crate::model::AcceleratorConfig::accelerator_count].
6228 ///
6229 /// # Example
6230 /// ```ignore,no_run
6231 /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6232 /// let x = AcceleratorConfig::new().set_accelerator_count(42);
6233 /// ```
6234 pub fn set_accelerator_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6235 self.accelerator_count = v.into();
6236 self
6237 }
6238}
6239
6240impl wkt::message::Message for AcceleratorConfig {
6241 fn typename() -> &'static str {
6242 "type.googleapis.com/google.cloud.dataproc.v1.AcceleratorConfig"
6243 }
6244}
6245
6246/// Specifies the config of disk options for a group of VM instances.
6247#[derive(Clone, Default, PartialEq)]
6248#[non_exhaustive]
6249pub struct DiskConfig {
6250 /// Optional. Type of the boot disk (default is "pd-standard").
6251 /// Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive),
6252 /// "pd-ssd" (Persistent Disk Solid State Drive),
6253 /// or "pd-standard" (Persistent Disk Hard Disk Drive).
6254 /// See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types).
6255 pub boot_disk_type: std::string::String,
6256
6257 /// Optional. Size in GB of the boot disk (default is 500GB).
6258 pub boot_disk_size_gb: i32,
6259
6260 /// Optional. Number of attached SSDs, from 0 to 8 (default is 0).
6261 /// If SSDs are not attached, the boot disk is used to store runtime logs and
6262 /// [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data.
6263 /// If one or more SSDs are attached, this runtime bulk
6264 /// data is spread across them, and the boot disk contains only basic
6265 /// config and installed binaries.
6266 ///
6267 /// Note: Local SSD options may vary by machine type and number of vCPUs
6268 /// selected.
6269 pub num_local_ssds: i32,
6270
6271 /// Optional. Interface type of local SSDs (default is "scsi").
6272 /// Valid values: "scsi" (Small Computer System Interface),
6273 /// "nvme" (Non-Volatile Memory Express).
6274 /// See [local SSD
6275 /// performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance).
6276 pub local_ssd_interface: std::string::String,
6277
6278 /// Optional. Indicates how many IOPS to provision for the disk. This sets the
6279 /// number of I/O operations per second that the disk can handle. Note: This
6280 /// field is only supported if boot_disk_type is hyperdisk-balanced.
6281 pub boot_disk_provisioned_iops: std::option::Option<i64>,
6282
6283 /// Optional. Indicates how much throughput to provision for the disk. This
6284 /// sets the number of throughput mb per second that the disk can handle.
6285 /// Values must be greater than or equal to 1. Note: This field is only
6286 /// supported if boot_disk_type is hyperdisk-balanced.
6287 pub boot_disk_provisioned_throughput: std::option::Option<i64>,
6288
6289 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6290}
6291
6292impl DiskConfig {
6293 pub fn new() -> Self {
6294 std::default::Default::default()
6295 }
6296
6297 /// Sets the value of [boot_disk_type][crate::model::DiskConfig::boot_disk_type].
6298 ///
6299 /// # Example
6300 /// ```ignore,no_run
6301 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6302 /// let x = DiskConfig::new().set_boot_disk_type("example");
6303 /// ```
6304 pub fn set_boot_disk_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6305 self.boot_disk_type = v.into();
6306 self
6307 }
6308
6309 /// Sets the value of [boot_disk_size_gb][crate::model::DiskConfig::boot_disk_size_gb].
6310 ///
6311 /// # Example
6312 /// ```ignore,no_run
6313 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6314 /// let x = DiskConfig::new().set_boot_disk_size_gb(42);
6315 /// ```
6316 pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6317 self.boot_disk_size_gb = v.into();
6318 self
6319 }
6320
6321 /// Sets the value of [num_local_ssds][crate::model::DiskConfig::num_local_ssds].
6322 ///
6323 /// # Example
6324 /// ```ignore,no_run
6325 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6326 /// let x = DiskConfig::new().set_num_local_ssds(42);
6327 /// ```
6328 pub fn set_num_local_ssds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6329 self.num_local_ssds = v.into();
6330 self
6331 }
6332
6333 /// Sets the value of [local_ssd_interface][crate::model::DiskConfig::local_ssd_interface].
6334 ///
6335 /// # Example
6336 /// ```ignore,no_run
6337 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6338 /// let x = DiskConfig::new().set_local_ssd_interface("example");
6339 /// ```
6340 pub fn set_local_ssd_interface<T: std::convert::Into<std::string::String>>(
6341 mut self,
6342 v: T,
6343 ) -> Self {
6344 self.local_ssd_interface = v.into();
6345 self
6346 }
6347
6348 /// Sets the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6349 ///
6350 /// # Example
6351 /// ```ignore,no_run
6352 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6353 /// let x = DiskConfig::new().set_boot_disk_provisioned_iops(42);
6354 /// ```
6355 pub fn set_boot_disk_provisioned_iops<T>(mut self, v: T) -> Self
6356 where
6357 T: std::convert::Into<i64>,
6358 {
6359 self.boot_disk_provisioned_iops = std::option::Option::Some(v.into());
6360 self
6361 }
6362
6363 /// Sets or clears the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6364 ///
6365 /// # Example
6366 /// ```ignore,no_run
6367 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6368 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(Some(42));
6369 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(None::<i32>);
6370 /// ```
6371 pub fn set_or_clear_boot_disk_provisioned_iops<T>(mut self, v: std::option::Option<T>) -> Self
6372 where
6373 T: std::convert::Into<i64>,
6374 {
6375 self.boot_disk_provisioned_iops = v.map(|x| x.into());
6376 self
6377 }
6378
6379 /// Sets the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6380 ///
6381 /// # Example
6382 /// ```ignore,no_run
6383 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6384 /// let x = DiskConfig::new().set_boot_disk_provisioned_throughput(42);
6385 /// ```
6386 pub fn set_boot_disk_provisioned_throughput<T>(mut self, v: T) -> Self
6387 where
6388 T: std::convert::Into<i64>,
6389 {
6390 self.boot_disk_provisioned_throughput = std::option::Option::Some(v.into());
6391 self
6392 }
6393
6394 /// Sets or clears the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6395 ///
6396 /// # Example
6397 /// ```ignore,no_run
6398 /// # use google_cloud_dataproc_v1::model::DiskConfig;
6399 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(Some(42));
6400 /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(None::<i32>);
6401 /// ```
6402 pub fn set_or_clear_boot_disk_provisioned_throughput<T>(
6403 mut self,
6404 v: std::option::Option<T>,
6405 ) -> Self
6406 where
6407 T: std::convert::Into<i64>,
6408 {
6409 self.boot_disk_provisioned_throughput = v.map(|x| x.into());
6410 self
6411 }
6412}
6413
6414impl wkt::message::Message for DiskConfig {
6415 fn typename() -> &'static str {
6416 "type.googleapis.com/google.cloud.dataproc.v1.DiskConfig"
6417 }
6418}
6419
6420/// Node group identification and configuration information.
6421#[derive(Clone, Default, PartialEq)]
6422#[non_exhaustive]
6423pub struct AuxiliaryNodeGroup {
6424 /// Required. Node group configuration.
6425 pub node_group: std::option::Option<crate::model::NodeGroup>,
6426
6427 /// Optional. A node group ID. Generated if not specified.
6428 ///
6429 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
6430 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
6431 /// or hyphen. Must consist of from 3 to 33 characters.
6432 pub node_group_id: std::string::String,
6433
6434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6435}
6436
6437impl AuxiliaryNodeGroup {
6438 pub fn new() -> Self {
6439 std::default::Default::default()
6440 }
6441
6442 /// Sets the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6443 ///
6444 /// # Example
6445 /// ```ignore,no_run
6446 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6447 /// use google_cloud_dataproc_v1::model::NodeGroup;
6448 /// let x = AuxiliaryNodeGroup::new().set_node_group(NodeGroup::default()/* use setters */);
6449 /// ```
6450 pub fn set_node_group<T>(mut self, v: T) -> Self
6451 where
6452 T: std::convert::Into<crate::model::NodeGroup>,
6453 {
6454 self.node_group = std::option::Option::Some(v.into());
6455 self
6456 }
6457
6458 /// Sets or clears the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6459 ///
6460 /// # Example
6461 /// ```ignore,no_run
6462 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6463 /// use google_cloud_dataproc_v1::model::NodeGroup;
6464 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
6465 /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(None::<NodeGroup>);
6466 /// ```
6467 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
6468 where
6469 T: std::convert::Into<crate::model::NodeGroup>,
6470 {
6471 self.node_group = v.map(|x| x.into());
6472 self
6473 }
6474
6475 /// Sets the value of [node_group_id][crate::model::AuxiliaryNodeGroup::node_group_id].
6476 ///
6477 /// # Example
6478 /// ```ignore,no_run
6479 /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6480 /// let x = AuxiliaryNodeGroup::new().set_node_group_id("example");
6481 /// ```
6482 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6483 self.node_group_id = v.into();
6484 self
6485 }
6486}
6487
6488impl wkt::message::Message for AuxiliaryNodeGroup {
6489 fn typename() -> &'static str {
6490 "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryNodeGroup"
6491 }
6492}
6493
6494/// Dataproc Node Group.
6495/// **The Dataproc `NodeGroup` resource is not related to the
6496/// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity]
6497/// resource.**
6498///
6499/// [google.cloud.dataproc.v1.NodeGroupAffinity]: crate::model::NodeGroupAffinity
6500#[derive(Clone, Default, PartialEq)]
6501#[non_exhaustive]
6502pub struct NodeGroup {
6503 /// The Node group [resource name](https://aip.dev/122).
6504 pub name: std::string::String,
6505
6506 /// Required. Node group roles.
6507 pub roles: std::vec::Vec<crate::model::node_group::Role>,
6508
6509 /// Optional. The node group instance group configuration.
6510 pub node_group_config: std::option::Option<crate::model::InstanceGroupConfig>,
6511
6512 /// Optional. Node group labels.
6513 ///
6514 /// * Label **keys** must consist of from 1 to 63 characters and conform to
6515 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
6516 /// * Label **values** can be empty. If specified, they must consist of from
6517 /// 1 to 63 characters and conform to [RFC 1035]
6518 /// (<https://www.ietf.org/rfc/rfc1035.txt>).
6519 /// * The node group must have no more than 32 labels.
6520 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6521
6522 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6523}
6524
6525impl NodeGroup {
6526 pub fn new() -> Self {
6527 std::default::Default::default()
6528 }
6529
6530 /// Sets the value of [name][crate::model::NodeGroup::name].
6531 ///
6532 /// # Example
6533 /// ```ignore,no_run
6534 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6535 /// let x = NodeGroup::new().set_name("example");
6536 /// ```
6537 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6538 self.name = v.into();
6539 self
6540 }
6541
6542 /// Sets the value of [roles][crate::model::NodeGroup::roles].
6543 ///
6544 /// # Example
6545 /// ```ignore,no_run
6546 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6547 /// use google_cloud_dataproc_v1::model::node_group::Role;
6548 /// let x = NodeGroup::new().set_roles([
6549 /// Role::Driver,
6550 /// ]);
6551 /// ```
6552 pub fn set_roles<T, V>(mut self, v: T) -> Self
6553 where
6554 T: std::iter::IntoIterator<Item = V>,
6555 V: std::convert::Into<crate::model::node_group::Role>,
6556 {
6557 use std::iter::Iterator;
6558 self.roles = v.into_iter().map(|i| i.into()).collect();
6559 self
6560 }
6561
6562 /// Sets the value of [node_group_config][crate::model::NodeGroup::node_group_config].
6563 ///
6564 /// # Example
6565 /// ```ignore,no_run
6566 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6567 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6568 /// let x = NodeGroup::new().set_node_group_config(InstanceGroupConfig::default()/* use setters */);
6569 /// ```
6570 pub fn set_node_group_config<T>(mut self, v: T) -> Self
6571 where
6572 T: std::convert::Into<crate::model::InstanceGroupConfig>,
6573 {
6574 self.node_group_config = std::option::Option::Some(v.into());
6575 self
6576 }
6577
6578 /// Sets or clears the value of [node_group_config][crate::model::NodeGroup::node_group_config].
6579 ///
6580 /// # Example
6581 /// ```ignore,no_run
6582 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6583 /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6584 /// let x = NodeGroup::new().set_or_clear_node_group_config(Some(InstanceGroupConfig::default()/* use setters */));
6585 /// let x = NodeGroup::new().set_or_clear_node_group_config(None::<InstanceGroupConfig>);
6586 /// ```
6587 pub fn set_or_clear_node_group_config<T>(mut self, v: std::option::Option<T>) -> Self
6588 where
6589 T: std::convert::Into<crate::model::InstanceGroupConfig>,
6590 {
6591 self.node_group_config = v.map(|x| x.into());
6592 self
6593 }
6594
6595 /// Sets the value of [labels][crate::model::NodeGroup::labels].
6596 ///
6597 /// # Example
6598 /// ```ignore,no_run
6599 /// # use google_cloud_dataproc_v1::model::NodeGroup;
6600 /// let x = NodeGroup::new().set_labels([
6601 /// ("key0", "abc"),
6602 /// ("key1", "xyz"),
6603 /// ]);
6604 /// ```
6605 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6606 where
6607 T: std::iter::IntoIterator<Item = (K, V)>,
6608 K: std::convert::Into<std::string::String>,
6609 V: std::convert::Into<std::string::String>,
6610 {
6611 use std::iter::Iterator;
6612 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6613 self
6614 }
6615}
6616
6617impl wkt::message::Message for NodeGroup {
6618 fn typename() -> &'static str {
6619 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroup"
6620 }
6621}
6622
6623/// Defines additional types related to [NodeGroup].
6624pub mod node_group {
6625 #[allow(unused_imports)]
6626 use super::*;
6627
6628 /// Node pool roles.
6629 ///
6630 /// # Working with unknown values
6631 ///
6632 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6633 /// additional enum variants at any time. Adding new variants is not considered
6634 /// a breaking change. Applications should write their code in anticipation of:
6635 ///
6636 /// - New values appearing in future releases of the client library, **and**
6637 /// - New values received dynamically, without application changes.
6638 ///
6639 /// Please consult the [Working with enums] section in the user guide for some
6640 /// guidelines.
6641 ///
6642 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6643 #[derive(Clone, Debug, PartialEq)]
6644 #[non_exhaustive]
6645 pub enum Role {
6646 /// Required unspecified role.
6647 Unspecified,
6648 /// Job drivers run on the node pool.
6649 Driver,
6650 /// If set, the enum was initialized with an unknown value.
6651 ///
6652 /// Applications can examine the value using [Role::value] or
6653 /// [Role::name].
6654 UnknownValue(role::UnknownValue),
6655 }
6656
6657 #[doc(hidden)]
6658 pub mod role {
6659 #[allow(unused_imports)]
6660 use super::*;
6661 #[derive(Clone, Debug, PartialEq)]
6662 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6663 }
6664
6665 impl Role {
6666 /// Gets the enum value.
6667 ///
6668 /// Returns `None` if the enum contains an unknown value deserialized from
6669 /// the string representation of enums.
6670 pub fn value(&self) -> std::option::Option<i32> {
6671 match self {
6672 Self::Unspecified => std::option::Option::Some(0),
6673 Self::Driver => std::option::Option::Some(1),
6674 Self::UnknownValue(u) => u.0.value(),
6675 }
6676 }
6677
6678 /// Gets the enum value as a string.
6679 ///
6680 /// Returns `None` if the enum contains an unknown value deserialized from
6681 /// the integer representation of enums.
6682 pub fn name(&self) -> std::option::Option<&str> {
6683 match self {
6684 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
6685 Self::Driver => std::option::Option::Some("DRIVER"),
6686 Self::UnknownValue(u) => u.0.name(),
6687 }
6688 }
6689 }
6690
6691 impl std::default::Default for Role {
6692 fn default() -> Self {
6693 use std::convert::From;
6694 Self::from(0)
6695 }
6696 }
6697
6698 impl std::fmt::Display for Role {
6699 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6700 wkt::internal::display_enum(f, self.name(), self.value())
6701 }
6702 }
6703
6704 impl std::convert::From<i32> for Role {
6705 fn from(value: i32) -> Self {
6706 match value {
6707 0 => Self::Unspecified,
6708 1 => Self::Driver,
6709 _ => Self::UnknownValue(role::UnknownValue(
6710 wkt::internal::UnknownEnumValue::Integer(value),
6711 )),
6712 }
6713 }
6714 }
6715
6716 impl std::convert::From<&str> for Role {
6717 fn from(value: &str) -> Self {
6718 use std::string::ToString;
6719 match value {
6720 "ROLE_UNSPECIFIED" => Self::Unspecified,
6721 "DRIVER" => Self::Driver,
6722 _ => Self::UnknownValue(role::UnknownValue(
6723 wkt::internal::UnknownEnumValue::String(value.to_string()),
6724 )),
6725 }
6726 }
6727 }
6728
6729 impl serde::ser::Serialize for Role {
6730 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6731 where
6732 S: serde::Serializer,
6733 {
6734 match self {
6735 Self::Unspecified => serializer.serialize_i32(0),
6736 Self::Driver => serializer.serialize_i32(1),
6737 Self::UnknownValue(u) => u.0.serialize(serializer),
6738 }
6739 }
6740 }
6741
6742 impl<'de> serde::de::Deserialize<'de> for Role {
6743 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6744 where
6745 D: serde::Deserializer<'de>,
6746 {
6747 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
6748 ".google.cloud.dataproc.v1.NodeGroup.Role",
6749 ))
6750 }
6751 }
6752}
6753
6754/// Specifies an executable to run on a fully configured node and a
6755/// timeout period for executable completion.
6756#[derive(Clone, Default, PartialEq)]
6757#[non_exhaustive]
6758pub struct NodeInitializationAction {
6759 /// Required. Cloud Storage URI of executable file.
6760 pub executable_file: std::string::String,
6761
6762 /// Optional. Amount of time executable has to complete. Default is
6763 /// 10 minutes (see JSON representation of
6764 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
6765 ///
6766 /// Cluster creation fails with an explanatory error message (the
6767 /// name of the executable that caused the error and the exceeded timeout
6768 /// period) if the executable is not completed at end of the timeout period.
6769 pub execution_timeout: std::option::Option<wkt::Duration>,
6770
6771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6772}
6773
6774impl NodeInitializationAction {
6775 pub fn new() -> Self {
6776 std::default::Default::default()
6777 }
6778
6779 /// Sets the value of [executable_file][crate::model::NodeInitializationAction::executable_file].
6780 ///
6781 /// # Example
6782 /// ```ignore,no_run
6783 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
6784 /// let x = NodeInitializationAction::new().set_executable_file("example");
6785 /// ```
6786 pub fn set_executable_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6787 self.executable_file = v.into();
6788 self
6789 }
6790
6791 /// Sets the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
6792 ///
6793 /// # Example
6794 /// ```ignore,no_run
6795 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
6796 /// use wkt::Duration;
6797 /// let x = NodeInitializationAction::new().set_execution_timeout(Duration::default()/* use setters */);
6798 /// ```
6799 pub fn set_execution_timeout<T>(mut self, v: T) -> Self
6800 where
6801 T: std::convert::Into<wkt::Duration>,
6802 {
6803 self.execution_timeout = std::option::Option::Some(v.into());
6804 self
6805 }
6806
6807 /// Sets or clears the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
6808 ///
6809 /// # Example
6810 /// ```ignore,no_run
6811 /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
6812 /// use wkt::Duration;
6813 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(Some(Duration::default()/* use setters */));
6814 /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(None::<Duration>);
6815 /// ```
6816 pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6817 where
6818 T: std::convert::Into<wkt::Duration>,
6819 {
6820 self.execution_timeout = v.map(|x| x.into());
6821 self
6822 }
6823}
6824
6825impl wkt::message::Message for NodeInitializationAction {
6826 fn typename() -> &'static str {
6827 "type.googleapis.com/google.cloud.dataproc.v1.NodeInitializationAction"
6828 }
6829}
6830
6831/// The status of a cluster and its instances.
6832#[derive(Clone, Default, PartialEq)]
6833#[non_exhaustive]
6834pub struct ClusterStatus {
6835 /// Output only. The cluster's state.
6836 pub state: crate::model::cluster_status::State,
6837
6838 /// Optional. Output only. Details of cluster's state.
6839 pub detail: std::string::String,
6840
6841 /// Output only. Time when this state was entered (see JSON representation of
6842 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
6843 pub state_start_time: std::option::Option<wkt::Timestamp>,
6844
6845 /// Output only. Additional state information that includes
6846 /// status reported by the agent.
6847 pub substate: crate::model::cluster_status::Substate,
6848
6849 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6850}
6851
6852impl ClusterStatus {
6853 pub fn new() -> Self {
6854 std::default::Default::default()
6855 }
6856
6857 /// Sets the value of [state][crate::model::ClusterStatus::state].
6858 ///
6859 /// # Example
6860 /// ```ignore,no_run
6861 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6862 /// use google_cloud_dataproc_v1::model::cluster_status::State;
6863 /// let x0 = ClusterStatus::new().set_state(State::Creating);
6864 /// let x1 = ClusterStatus::new().set_state(State::Running);
6865 /// let x2 = ClusterStatus::new().set_state(State::Error);
6866 /// ```
6867 pub fn set_state<T: std::convert::Into<crate::model::cluster_status::State>>(
6868 mut self,
6869 v: T,
6870 ) -> Self {
6871 self.state = v.into();
6872 self
6873 }
6874
6875 /// Sets the value of [detail][crate::model::ClusterStatus::detail].
6876 ///
6877 /// # Example
6878 /// ```ignore,no_run
6879 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6880 /// let x = ClusterStatus::new().set_detail("example");
6881 /// ```
6882 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6883 self.detail = v.into();
6884 self
6885 }
6886
6887 /// Sets the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
6888 ///
6889 /// # Example
6890 /// ```ignore,no_run
6891 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6892 /// use wkt::Timestamp;
6893 /// let x = ClusterStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
6894 /// ```
6895 pub fn set_state_start_time<T>(mut self, v: T) -> Self
6896 where
6897 T: std::convert::Into<wkt::Timestamp>,
6898 {
6899 self.state_start_time = std::option::Option::Some(v.into());
6900 self
6901 }
6902
6903 /// Sets or clears the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
6904 ///
6905 /// # Example
6906 /// ```ignore,no_run
6907 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6908 /// use wkt::Timestamp;
6909 /// let x = ClusterStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
6910 /// let x = ClusterStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
6911 /// ```
6912 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6913 where
6914 T: std::convert::Into<wkt::Timestamp>,
6915 {
6916 self.state_start_time = v.map(|x| x.into());
6917 self
6918 }
6919
6920 /// Sets the value of [substate][crate::model::ClusterStatus::substate].
6921 ///
6922 /// # Example
6923 /// ```ignore,no_run
6924 /// # use google_cloud_dataproc_v1::model::ClusterStatus;
6925 /// use google_cloud_dataproc_v1::model::cluster_status::Substate;
6926 /// let x0 = ClusterStatus::new().set_substate(Substate::Unhealthy);
6927 /// let x1 = ClusterStatus::new().set_substate(Substate::StaleStatus);
6928 /// ```
6929 pub fn set_substate<T: std::convert::Into<crate::model::cluster_status::Substate>>(
6930 mut self,
6931 v: T,
6932 ) -> Self {
6933 self.substate = v.into();
6934 self
6935 }
6936}
6937
6938impl wkt::message::Message for ClusterStatus {
6939 fn typename() -> &'static str {
6940 "type.googleapis.com/google.cloud.dataproc.v1.ClusterStatus"
6941 }
6942}
6943
6944/// Defines additional types related to [ClusterStatus].
6945pub mod cluster_status {
6946 #[allow(unused_imports)]
6947 use super::*;
6948
6949 /// The cluster state.
6950 ///
6951 /// # Working with unknown values
6952 ///
6953 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6954 /// additional enum variants at any time. Adding new variants is not considered
6955 /// a breaking change. Applications should write their code in anticipation of:
6956 ///
6957 /// - New values appearing in future releases of the client library, **and**
6958 /// - New values received dynamically, without application changes.
6959 ///
6960 /// Please consult the [Working with enums] section in the user guide for some
6961 /// guidelines.
6962 ///
6963 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6964 #[derive(Clone, Debug, PartialEq)]
6965 #[non_exhaustive]
6966 pub enum State {
6967 /// The cluster state is unknown.
6968 Unknown,
6969 /// The cluster is being created and set up. It is not ready for use.
6970 Creating,
6971 /// The cluster is currently running and healthy. It is ready for use.
6972 ///
6973 /// **Note:** The cluster state changes from "creating" to "running" status
6974 /// after the master node(s), first two primary worker nodes (and the last
6975 /// primary worker node if primary workers > 2) are running.
6976 Running,
6977 /// The cluster encountered an error. It is not ready for use.
6978 Error,
6979 /// The cluster has encountered an error while being updated. Jobs can
6980 /// be submitted to the cluster, but the cluster cannot be updated.
6981 ErrorDueToUpdate,
6982 /// The cluster is being deleted. It cannot be used.
6983 Deleting,
6984 /// The cluster is being updated. It continues to accept and process jobs.
6985 Updating,
6986 /// The cluster is being stopped. It cannot be used.
6987 Stopping,
6988 /// The cluster is currently stopped. It is not ready for use.
6989 Stopped,
6990 /// The cluster is being started. It is not ready for use.
6991 Starting,
6992 /// The cluster is being repaired. It is not ready for use.
6993 Repairing,
6994 /// If set, the enum was initialized with an unknown value.
6995 ///
6996 /// Applications can examine the value using [State::value] or
6997 /// [State::name].
6998 UnknownValue(state::UnknownValue),
6999 }
7000
7001 #[doc(hidden)]
7002 pub mod state {
7003 #[allow(unused_imports)]
7004 use super::*;
7005 #[derive(Clone, Debug, PartialEq)]
7006 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7007 }
7008
7009 impl State {
7010 /// Gets the enum value.
7011 ///
7012 /// Returns `None` if the enum contains an unknown value deserialized from
7013 /// the string representation of enums.
7014 pub fn value(&self) -> std::option::Option<i32> {
7015 match self {
7016 Self::Unknown => std::option::Option::Some(0),
7017 Self::Creating => std::option::Option::Some(1),
7018 Self::Running => std::option::Option::Some(2),
7019 Self::Error => std::option::Option::Some(3),
7020 Self::ErrorDueToUpdate => std::option::Option::Some(9),
7021 Self::Deleting => std::option::Option::Some(4),
7022 Self::Updating => std::option::Option::Some(5),
7023 Self::Stopping => std::option::Option::Some(6),
7024 Self::Stopped => std::option::Option::Some(7),
7025 Self::Starting => std::option::Option::Some(8),
7026 Self::Repairing => std::option::Option::Some(10),
7027 Self::UnknownValue(u) => u.0.value(),
7028 }
7029 }
7030
7031 /// Gets the enum value as a string.
7032 ///
7033 /// Returns `None` if the enum contains an unknown value deserialized from
7034 /// the integer representation of enums.
7035 pub fn name(&self) -> std::option::Option<&str> {
7036 match self {
7037 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7038 Self::Creating => std::option::Option::Some("CREATING"),
7039 Self::Running => std::option::Option::Some("RUNNING"),
7040 Self::Error => std::option::Option::Some("ERROR"),
7041 Self::ErrorDueToUpdate => std::option::Option::Some("ERROR_DUE_TO_UPDATE"),
7042 Self::Deleting => std::option::Option::Some("DELETING"),
7043 Self::Updating => std::option::Option::Some("UPDATING"),
7044 Self::Stopping => std::option::Option::Some("STOPPING"),
7045 Self::Stopped => std::option::Option::Some("STOPPED"),
7046 Self::Starting => std::option::Option::Some("STARTING"),
7047 Self::Repairing => std::option::Option::Some("REPAIRING"),
7048 Self::UnknownValue(u) => u.0.name(),
7049 }
7050 }
7051 }
7052
7053 impl std::default::Default for State {
7054 fn default() -> Self {
7055 use std::convert::From;
7056 Self::from(0)
7057 }
7058 }
7059
7060 impl std::fmt::Display for State {
7061 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7062 wkt::internal::display_enum(f, self.name(), self.value())
7063 }
7064 }
7065
7066 impl std::convert::From<i32> for State {
7067 fn from(value: i32) -> Self {
7068 match value {
7069 0 => Self::Unknown,
7070 1 => Self::Creating,
7071 2 => Self::Running,
7072 3 => Self::Error,
7073 4 => Self::Deleting,
7074 5 => Self::Updating,
7075 6 => Self::Stopping,
7076 7 => Self::Stopped,
7077 8 => Self::Starting,
7078 9 => Self::ErrorDueToUpdate,
7079 10 => Self::Repairing,
7080 _ => Self::UnknownValue(state::UnknownValue(
7081 wkt::internal::UnknownEnumValue::Integer(value),
7082 )),
7083 }
7084 }
7085 }
7086
7087 impl std::convert::From<&str> for State {
7088 fn from(value: &str) -> Self {
7089 use std::string::ToString;
7090 match value {
7091 "UNKNOWN" => Self::Unknown,
7092 "CREATING" => Self::Creating,
7093 "RUNNING" => Self::Running,
7094 "ERROR" => Self::Error,
7095 "ERROR_DUE_TO_UPDATE" => Self::ErrorDueToUpdate,
7096 "DELETING" => Self::Deleting,
7097 "UPDATING" => Self::Updating,
7098 "STOPPING" => Self::Stopping,
7099 "STOPPED" => Self::Stopped,
7100 "STARTING" => Self::Starting,
7101 "REPAIRING" => Self::Repairing,
7102 _ => Self::UnknownValue(state::UnknownValue(
7103 wkt::internal::UnknownEnumValue::String(value.to_string()),
7104 )),
7105 }
7106 }
7107 }
7108
7109 impl serde::ser::Serialize for State {
7110 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7111 where
7112 S: serde::Serializer,
7113 {
7114 match self {
7115 Self::Unknown => serializer.serialize_i32(0),
7116 Self::Creating => serializer.serialize_i32(1),
7117 Self::Running => serializer.serialize_i32(2),
7118 Self::Error => serializer.serialize_i32(3),
7119 Self::ErrorDueToUpdate => serializer.serialize_i32(9),
7120 Self::Deleting => serializer.serialize_i32(4),
7121 Self::Updating => serializer.serialize_i32(5),
7122 Self::Stopping => serializer.serialize_i32(6),
7123 Self::Stopped => serializer.serialize_i32(7),
7124 Self::Starting => serializer.serialize_i32(8),
7125 Self::Repairing => serializer.serialize_i32(10),
7126 Self::UnknownValue(u) => u.0.serialize(serializer),
7127 }
7128 }
7129 }
7130
7131 impl<'de> serde::de::Deserialize<'de> for State {
7132 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7133 where
7134 D: serde::Deserializer<'de>,
7135 {
7136 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7137 ".google.cloud.dataproc.v1.ClusterStatus.State",
7138 ))
7139 }
7140 }
7141
7142 /// The cluster substate.
7143 ///
7144 /// # Working with unknown values
7145 ///
7146 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7147 /// additional enum variants at any time. Adding new variants is not considered
7148 /// a breaking change. Applications should write their code in anticipation of:
7149 ///
7150 /// - New values appearing in future releases of the client library, **and**
7151 /// - New values received dynamically, without application changes.
7152 ///
7153 /// Please consult the [Working with enums] section in the user guide for some
7154 /// guidelines.
7155 ///
7156 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7157 #[derive(Clone, Debug, PartialEq)]
7158 #[non_exhaustive]
7159 pub enum Substate {
7160 /// The cluster substate is unknown.
7161 Unspecified,
7162 /// The cluster is known to be in an unhealthy state
7163 /// (for example, critical daemons are not running or HDFS capacity is
7164 /// exhausted).
7165 ///
7166 /// Applies to RUNNING state.
7167 Unhealthy,
7168 /// The agent-reported status is out of date (may occur if
7169 /// Dataproc loses communication with Agent).
7170 ///
7171 /// Applies to RUNNING state.
7172 StaleStatus,
7173 /// If set, the enum was initialized with an unknown value.
7174 ///
7175 /// Applications can examine the value using [Substate::value] or
7176 /// [Substate::name].
7177 UnknownValue(substate::UnknownValue),
7178 }
7179
7180 #[doc(hidden)]
7181 pub mod substate {
7182 #[allow(unused_imports)]
7183 use super::*;
7184 #[derive(Clone, Debug, PartialEq)]
7185 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7186 }
7187
7188 impl Substate {
7189 /// Gets the enum value.
7190 ///
7191 /// Returns `None` if the enum contains an unknown value deserialized from
7192 /// the string representation of enums.
7193 pub fn value(&self) -> std::option::Option<i32> {
7194 match self {
7195 Self::Unspecified => std::option::Option::Some(0),
7196 Self::Unhealthy => std::option::Option::Some(1),
7197 Self::StaleStatus => std::option::Option::Some(2),
7198 Self::UnknownValue(u) => u.0.value(),
7199 }
7200 }
7201
7202 /// Gets the enum value as a string.
7203 ///
7204 /// Returns `None` if the enum contains an unknown value deserialized from
7205 /// the integer representation of enums.
7206 pub fn name(&self) -> std::option::Option<&str> {
7207 match self {
7208 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
7209 Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
7210 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
7211 Self::UnknownValue(u) => u.0.name(),
7212 }
7213 }
7214 }
7215
7216 impl std::default::Default for Substate {
7217 fn default() -> Self {
7218 use std::convert::From;
7219 Self::from(0)
7220 }
7221 }
7222
7223 impl std::fmt::Display for Substate {
7224 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7225 wkt::internal::display_enum(f, self.name(), self.value())
7226 }
7227 }
7228
7229 impl std::convert::From<i32> for Substate {
7230 fn from(value: i32) -> Self {
7231 match value {
7232 0 => Self::Unspecified,
7233 1 => Self::Unhealthy,
7234 2 => Self::StaleStatus,
7235 _ => Self::UnknownValue(substate::UnknownValue(
7236 wkt::internal::UnknownEnumValue::Integer(value),
7237 )),
7238 }
7239 }
7240 }
7241
7242 impl std::convert::From<&str> for Substate {
7243 fn from(value: &str) -> Self {
7244 use std::string::ToString;
7245 match value {
7246 "UNSPECIFIED" => Self::Unspecified,
7247 "UNHEALTHY" => Self::Unhealthy,
7248 "STALE_STATUS" => Self::StaleStatus,
7249 _ => Self::UnknownValue(substate::UnknownValue(
7250 wkt::internal::UnknownEnumValue::String(value.to_string()),
7251 )),
7252 }
7253 }
7254 }
7255
7256 impl serde::ser::Serialize for Substate {
7257 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7258 where
7259 S: serde::Serializer,
7260 {
7261 match self {
7262 Self::Unspecified => serializer.serialize_i32(0),
7263 Self::Unhealthy => serializer.serialize_i32(1),
7264 Self::StaleStatus => serializer.serialize_i32(2),
7265 Self::UnknownValue(u) => u.0.serialize(serializer),
7266 }
7267 }
7268 }
7269
7270 impl<'de> serde::de::Deserialize<'de> for Substate {
7271 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7272 where
7273 D: serde::Deserializer<'de>,
7274 {
7275 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
7276 ".google.cloud.dataproc.v1.ClusterStatus.Substate",
7277 ))
7278 }
7279 }
7280}
7281
7282/// Security related configuration, including encryption, Kerberos, etc.
7283#[derive(Clone, Default, PartialEq)]
7284#[non_exhaustive]
7285pub struct SecurityConfig {
7286 /// Optional. Kerberos related configuration.
7287 pub kerberos_config: std::option::Option<crate::model::KerberosConfig>,
7288
7289 /// Optional. Identity related configuration, including service account based
7290 /// secure multi-tenancy user mappings.
7291 pub identity_config: std::option::Option<crate::model::IdentityConfig>,
7292
7293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7294}
7295
7296impl SecurityConfig {
7297 pub fn new() -> Self {
7298 std::default::Default::default()
7299 }
7300
7301 /// Sets the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7302 ///
7303 /// # Example
7304 /// ```ignore,no_run
7305 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7306 /// use google_cloud_dataproc_v1::model::KerberosConfig;
7307 /// let x = SecurityConfig::new().set_kerberos_config(KerberosConfig::default()/* use setters */);
7308 /// ```
7309 pub fn set_kerberos_config<T>(mut self, v: T) -> Self
7310 where
7311 T: std::convert::Into<crate::model::KerberosConfig>,
7312 {
7313 self.kerberos_config = std::option::Option::Some(v.into());
7314 self
7315 }
7316
7317 /// Sets or clears the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7318 ///
7319 /// # Example
7320 /// ```ignore,no_run
7321 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7322 /// use google_cloud_dataproc_v1::model::KerberosConfig;
7323 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(Some(KerberosConfig::default()/* use setters */));
7324 /// let x = SecurityConfig::new().set_or_clear_kerberos_config(None::<KerberosConfig>);
7325 /// ```
7326 pub fn set_or_clear_kerberos_config<T>(mut self, v: std::option::Option<T>) -> Self
7327 where
7328 T: std::convert::Into<crate::model::KerberosConfig>,
7329 {
7330 self.kerberos_config = v.map(|x| x.into());
7331 self
7332 }
7333
7334 /// Sets the value of [identity_config][crate::model::SecurityConfig::identity_config].
7335 ///
7336 /// # Example
7337 /// ```ignore,no_run
7338 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7339 /// use google_cloud_dataproc_v1::model::IdentityConfig;
7340 /// let x = SecurityConfig::new().set_identity_config(IdentityConfig::default()/* use setters */);
7341 /// ```
7342 pub fn set_identity_config<T>(mut self, v: T) -> Self
7343 where
7344 T: std::convert::Into<crate::model::IdentityConfig>,
7345 {
7346 self.identity_config = std::option::Option::Some(v.into());
7347 self
7348 }
7349
7350 /// Sets or clears the value of [identity_config][crate::model::SecurityConfig::identity_config].
7351 ///
7352 /// # Example
7353 /// ```ignore,no_run
7354 /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7355 /// use google_cloud_dataproc_v1::model::IdentityConfig;
7356 /// let x = SecurityConfig::new().set_or_clear_identity_config(Some(IdentityConfig::default()/* use setters */));
7357 /// let x = SecurityConfig::new().set_or_clear_identity_config(None::<IdentityConfig>);
7358 /// ```
7359 pub fn set_or_clear_identity_config<T>(mut self, v: std::option::Option<T>) -> Self
7360 where
7361 T: std::convert::Into<crate::model::IdentityConfig>,
7362 {
7363 self.identity_config = v.map(|x| x.into());
7364 self
7365 }
7366}
7367
7368impl wkt::message::Message for SecurityConfig {
7369 fn typename() -> &'static str {
7370 "type.googleapis.com/google.cloud.dataproc.v1.SecurityConfig"
7371 }
7372}
7373
7374/// Specifies Kerberos related configuration.
7375#[derive(Clone, Default, PartialEq)]
7376#[non_exhaustive]
7377pub struct KerberosConfig {
7378 /// Optional. Flag to indicate whether to Kerberize the cluster (default:
7379 /// false). Set this field to true to enable Kerberos on a cluster.
7380 pub enable_kerberos: bool,
7381
7382 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the root
7383 /// principal password.
7384 pub root_principal_password_uri: std::string::String,
7385
7386 /// Optional. The URI of the KMS key used to encrypt sensitive
7387 /// files.
7388 pub kms_key_uri: std::string::String,
7389
7390 /// Optional. The Cloud Storage URI of the keystore file used for SSL
7391 /// encryption. If not provided, Dataproc will provide a self-signed
7392 /// certificate.
7393 pub keystore_uri: std::string::String,
7394
7395 /// Optional. The Cloud Storage URI of the truststore file used for SSL
7396 /// encryption. If not provided, Dataproc will provide a self-signed
7397 /// certificate.
7398 pub truststore_uri: std::string::String,
7399
7400 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7401 /// password to the user provided keystore. For the self-signed certificate,
7402 /// this password is generated by Dataproc.
7403 pub keystore_password_uri: std::string::String,
7404
7405 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7406 /// password to the user provided key. For the self-signed certificate, this
7407 /// password is generated by Dataproc.
7408 pub key_password_uri: std::string::String,
7409
7410 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7411 /// password to the user provided truststore. For the self-signed certificate,
7412 /// this password is generated by Dataproc.
7413 pub truststore_password_uri: std::string::String,
7414
7415 /// Optional. The remote realm the Dataproc on-cluster KDC will trust, should
7416 /// the user enable cross realm trust.
7417 pub cross_realm_trust_realm: std::string::String,
7418
7419 /// Optional. The KDC (IP or hostname) for the remote trusted realm in a cross
7420 /// realm trust relationship.
7421 pub cross_realm_trust_kdc: std::string::String,
7422
7423 /// Optional. The admin server (IP or hostname) for the remote trusted realm in
7424 /// a cross realm trust relationship.
7425 pub cross_realm_trust_admin_server: std::string::String,
7426
7427 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7428 /// shared password between the on-cluster Kerberos realm and the remote
7429 /// trusted realm, in a cross realm trust relationship.
7430 pub cross_realm_trust_shared_password_uri: std::string::String,
7431
7432 /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7433 /// master key of the KDC database.
7434 pub kdc_db_key_uri: std::string::String,
7435
7436 /// Optional. The lifetime of the ticket granting ticket, in hours.
7437 /// If not specified, or user specifies 0, then default value 10
7438 /// will be used.
7439 pub tgt_lifetime_hours: i32,
7440
7441 /// Optional. The name of the on-cluster Kerberos realm.
7442 /// If not specified, the uppercased domain of hostnames will be the realm.
7443 pub realm: std::string::String,
7444
7445 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7446}
7447
7448impl KerberosConfig {
7449 pub fn new() -> Self {
7450 std::default::Default::default()
7451 }
7452
7453 /// Sets the value of [enable_kerberos][crate::model::KerberosConfig::enable_kerberos].
7454 ///
7455 /// # Example
7456 /// ```ignore,no_run
7457 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7458 /// let x = KerberosConfig::new().set_enable_kerberos(true);
7459 /// ```
7460 pub fn set_enable_kerberos<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7461 self.enable_kerberos = v.into();
7462 self
7463 }
7464
7465 /// Sets the value of [root_principal_password_uri][crate::model::KerberosConfig::root_principal_password_uri].
7466 ///
7467 /// # Example
7468 /// ```ignore,no_run
7469 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7470 /// let x = KerberosConfig::new().set_root_principal_password_uri("example");
7471 /// ```
7472 pub fn set_root_principal_password_uri<T: std::convert::Into<std::string::String>>(
7473 mut self,
7474 v: T,
7475 ) -> Self {
7476 self.root_principal_password_uri = v.into();
7477 self
7478 }
7479
7480 /// Sets the value of [kms_key_uri][crate::model::KerberosConfig::kms_key_uri].
7481 ///
7482 /// # Example
7483 /// ```ignore,no_run
7484 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7485 /// let x = KerberosConfig::new().set_kms_key_uri("example");
7486 /// ```
7487 pub fn set_kms_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7488 self.kms_key_uri = v.into();
7489 self
7490 }
7491
7492 /// Sets the value of [keystore_uri][crate::model::KerberosConfig::keystore_uri].
7493 ///
7494 /// # Example
7495 /// ```ignore,no_run
7496 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7497 /// let x = KerberosConfig::new().set_keystore_uri("example");
7498 /// ```
7499 pub fn set_keystore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7500 self.keystore_uri = v.into();
7501 self
7502 }
7503
7504 /// Sets the value of [truststore_uri][crate::model::KerberosConfig::truststore_uri].
7505 ///
7506 /// # Example
7507 /// ```ignore,no_run
7508 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7509 /// let x = KerberosConfig::new().set_truststore_uri("example");
7510 /// ```
7511 pub fn set_truststore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7512 self.truststore_uri = v.into();
7513 self
7514 }
7515
7516 /// Sets the value of [keystore_password_uri][crate::model::KerberosConfig::keystore_password_uri].
7517 ///
7518 /// # Example
7519 /// ```ignore,no_run
7520 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7521 /// let x = KerberosConfig::new().set_keystore_password_uri("example");
7522 /// ```
7523 pub fn set_keystore_password_uri<T: std::convert::Into<std::string::String>>(
7524 mut self,
7525 v: T,
7526 ) -> Self {
7527 self.keystore_password_uri = v.into();
7528 self
7529 }
7530
7531 /// Sets the value of [key_password_uri][crate::model::KerberosConfig::key_password_uri].
7532 ///
7533 /// # Example
7534 /// ```ignore,no_run
7535 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7536 /// let x = KerberosConfig::new().set_key_password_uri("example");
7537 /// ```
7538 pub fn set_key_password_uri<T: std::convert::Into<std::string::String>>(
7539 mut self,
7540 v: T,
7541 ) -> Self {
7542 self.key_password_uri = v.into();
7543 self
7544 }
7545
7546 /// Sets the value of [truststore_password_uri][crate::model::KerberosConfig::truststore_password_uri].
7547 ///
7548 /// # Example
7549 /// ```ignore,no_run
7550 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7551 /// let x = KerberosConfig::new().set_truststore_password_uri("example");
7552 /// ```
7553 pub fn set_truststore_password_uri<T: std::convert::Into<std::string::String>>(
7554 mut self,
7555 v: T,
7556 ) -> Self {
7557 self.truststore_password_uri = v.into();
7558 self
7559 }
7560
7561 /// Sets the value of [cross_realm_trust_realm][crate::model::KerberosConfig::cross_realm_trust_realm].
7562 ///
7563 /// # Example
7564 /// ```ignore,no_run
7565 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7566 /// let x = KerberosConfig::new().set_cross_realm_trust_realm("example");
7567 /// ```
7568 pub fn set_cross_realm_trust_realm<T: std::convert::Into<std::string::String>>(
7569 mut self,
7570 v: T,
7571 ) -> Self {
7572 self.cross_realm_trust_realm = v.into();
7573 self
7574 }
7575
7576 /// Sets the value of [cross_realm_trust_kdc][crate::model::KerberosConfig::cross_realm_trust_kdc].
7577 ///
7578 /// # Example
7579 /// ```ignore,no_run
7580 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7581 /// let x = KerberosConfig::new().set_cross_realm_trust_kdc("example");
7582 /// ```
7583 pub fn set_cross_realm_trust_kdc<T: std::convert::Into<std::string::String>>(
7584 mut self,
7585 v: T,
7586 ) -> Self {
7587 self.cross_realm_trust_kdc = v.into();
7588 self
7589 }
7590
7591 /// Sets the value of [cross_realm_trust_admin_server][crate::model::KerberosConfig::cross_realm_trust_admin_server].
7592 ///
7593 /// # Example
7594 /// ```ignore,no_run
7595 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7596 /// let x = KerberosConfig::new().set_cross_realm_trust_admin_server("example");
7597 /// ```
7598 pub fn set_cross_realm_trust_admin_server<T: std::convert::Into<std::string::String>>(
7599 mut self,
7600 v: T,
7601 ) -> Self {
7602 self.cross_realm_trust_admin_server = v.into();
7603 self
7604 }
7605
7606 /// Sets the value of [cross_realm_trust_shared_password_uri][crate::model::KerberosConfig::cross_realm_trust_shared_password_uri].
7607 ///
7608 /// # Example
7609 /// ```ignore,no_run
7610 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7611 /// let x = KerberosConfig::new().set_cross_realm_trust_shared_password_uri("example");
7612 /// ```
7613 pub fn set_cross_realm_trust_shared_password_uri<T: std::convert::Into<std::string::String>>(
7614 mut self,
7615 v: T,
7616 ) -> Self {
7617 self.cross_realm_trust_shared_password_uri = v.into();
7618 self
7619 }
7620
7621 /// Sets the value of [kdc_db_key_uri][crate::model::KerberosConfig::kdc_db_key_uri].
7622 ///
7623 /// # Example
7624 /// ```ignore,no_run
7625 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7626 /// let x = KerberosConfig::new().set_kdc_db_key_uri("example");
7627 /// ```
7628 pub fn set_kdc_db_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7629 self.kdc_db_key_uri = v.into();
7630 self
7631 }
7632
7633 /// Sets the value of [tgt_lifetime_hours][crate::model::KerberosConfig::tgt_lifetime_hours].
7634 ///
7635 /// # Example
7636 /// ```ignore,no_run
7637 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7638 /// let x = KerberosConfig::new().set_tgt_lifetime_hours(42);
7639 /// ```
7640 pub fn set_tgt_lifetime_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7641 self.tgt_lifetime_hours = v.into();
7642 self
7643 }
7644
7645 /// Sets the value of [realm][crate::model::KerberosConfig::realm].
7646 ///
7647 /// # Example
7648 /// ```ignore,no_run
7649 /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7650 /// let x = KerberosConfig::new().set_realm("example");
7651 /// ```
7652 pub fn set_realm<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7653 self.realm = v.into();
7654 self
7655 }
7656}
7657
7658impl wkt::message::Message for KerberosConfig {
7659 fn typename() -> &'static str {
7660 "type.googleapis.com/google.cloud.dataproc.v1.KerberosConfig"
7661 }
7662}
7663
7664/// Identity related configuration, including service account based
7665/// secure multi-tenancy user mappings.
7666#[derive(Clone, Default, PartialEq)]
7667#[non_exhaustive]
7668pub struct IdentityConfig {
7669 /// Required. Map of user to service account.
7670 pub user_service_account_mapping:
7671 std::collections::HashMap<std::string::String, std::string::String>,
7672
7673 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7674}
7675
7676impl IdentityConfig {
7677 pub fn new() -> Self {
7678 std::default::Default::default()
7679 }
7680
7681 /// Sets the value of [user_service_account_mapping][crate::model::IdentityConfig::user_service_account_mapping].
7682 ///
7683 /// # Example
7684 /// ```ignore,no_run
7685 /// # use google_cloud_dataproc_v1::model::IdentityConfig;
7686 /// let x = IdentityConfig::new().set_user_service_account_mapping([
7687 /// ("key0", "abc"),
7688 /// ("key1", "xyz"),
7689 /// ]);
7690 /// ```
7691 pub fn set_user_service_account_mapping<T, K, V>(mut self, v: T) -> Self
7692 where
7693 T: std::iter::IntoIterator<Item = (K, V)>,
7694 K: std::convert::Into<std::string::String>,
7695 V: std::convert::Into<std::string::String>,
7696 {
7697 use std::iter::Iterator;
7698 self.user_service_account_mapping =
7699 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7700 self
7701 }
7702}
7703
7704impl wkt::message::Message for IdentityConfig {
7705 fn typename() -> &'static str {
7706 "type.googleapis.com/google.cloud.dataproc.v1.IdentityConfig"
7707 }
7708}
7709
7710/// Specifies the selection and config of software inside the cluster.
7711#[derive(Clone, Default, PartialEq)]
7712#[non_exhaustive]
7713pub struct SoftwareConfig {
7714 /// Optional. The version of software inside the cluster. It must be one of the
7715 /// supported [Dataproc
7716 /// Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported-dataproc-image-versions),
7717 /// such as "1.2" (including a subminor version, such as "1.2.29"), or the
7718 /// ["preview"
7719 /// version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
7720 /// If unspecified, it defaults to the latest Debian version.
7721 pub image_version: std::string::String,
7722
7723 /// Optional. The properties to set on daemon config files.
7724 ///
7725 /// Property keys are specified in `prefix:property` format, for example
7726 /// `core:hadoop.tmp.dir`. The following are supported prefixes
7727 /// and their mappings:
7728 ///
7729 /// * capacity-scheduler: `capacity-scheduler.xml`
7730 /// * core: `core-site.xml`
7731 /// * distcp: `distcp-default.xml`
7732 /// * hdfs: `hdfs-site.xml`
7733 /// * hive: `hive-site.xml`
7734 /// * mapred: `mapred-site.xml`
7735 /// * pig: `pig.properties`
7736 /// * spark: `spark-defaults.conf`
7737 /// * yarn: `yarn-site.xml`
7738 ///
7739 /// For more information, see [Cluster
7740 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
7741 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
7742
7743 /// Optional. The set of components to activate on the cluster.
7744 pub optional_components: std::vec::Vec<crate::model::Component>,
7745
7746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7747}
7748
7749impl SoftwareConfig {
7750 pub fn new() -> Self {
7751 std::default::Default::default()
7752 }
7753
7754 /// Sets the value of [image_version][crate::model::SoftwareConfig::image_version].
7755 ///
7756 /// # Example
7757 /// ```ignore,no_run
7758 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
7759 /// let x = SoftwareConfig::new().set_image_version("example");
7760 /// ```
7761 pub fn set_image_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7762 self.image_version = v.into();
7763 self
7764 }
7765
7766 /// Sets the value of [properties][crate::model::SoftwareConfig::properties].
7767 ///
7768 /// # Example
7769 /// ```ignore,no_run
7770 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
7771 /// let x = SoftwareConfig::new().set_properties([
7772 /// ("key0", "abc"),
7773 /// ("key1", "xyz"),
7774 /// ]);
7775 /// ```
7776 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
7777 where
7778 T: std::iter::IntoIterator<Item = (K, V)>,
7779 K: std::convert::Into<std::string::String>,
7780 V: std::convert::Into<std::string::String>,
7781 {
7782 use std::iter::Iterator;
7783 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7784 self
7785 }
7786
7787 /// Sets the value of [optional_components][crate::model::SoftwareConfig::optional_components].
7788 ///
7789 /// # Example
7790 /// ```ignore,no_run
7791 /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
7792 /// use google_cloud_dataproc_v1::model::Component;
7793 /// let x = SoftwareConfig::new().set_optional_components([
7794 /// Component::Anaconda,
7795 /// Component::Delta,
7796 /// Component::Docker,
7797 /// ]);
7798 /// ```
7799 pub fn set_optional_components<T, V>(mut self, v: T) -> Self
7800 where
7801 T: std::iter::IntoIterator<Item = V>,
7802 V: std::convert::Into<crate::model::Component>,
7803 {
7804 use std::iter::Iterator;
7805 self.optional_components = v.into_iter().map(|i| i.into()).collect();
7806 self
7807 }
7808}
7809
7810impl wkt::message::Message for SoftwareConfig {
7811 fn typename() -> &'static str {
7812 "type.googleapis.com/google.cloud.dataproc.v1.SoftwareConfig"
7813 }
7814}
7815
7816/// Specifies the cluster auto-delete schedule configuration.
7817#[derive(Clone, Default, PartialEq)]
7818#[non_exhaustive]
7819pub struct LifecycleConfig {
7820 /// Optional. The duration to keep the cluster alive while idling (when no jobs
7821 /// are running). Passing this threshold will cause the cluster to be
7822 /// deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON
7823 /// representation of
7824 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7825 pub idle_delete_ttl: std::option::Option<wkt::Duration>,
7826
7827 /// Output only. The time when cluster became idle (most recent job finished)
7828 /// and became eligible for deletion due to idleness (see JSON representation
7829 /// of
7830 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7831 pub idle_start_time: std::option::Option<wkt::Timestamp>,
7832
7833 /// Either the exact time the cluster should be deleted at or
7834 /// the cluster maximum age.
7835 pub ttl: std::option::Option<crate::model::lifecycle_config::Ttl>,
7836
7837 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7838}
7839
7840impl LifecycleConfig {
7841 pub fn new() -> Self {
7842 std::default::Default::default()
7843 }
7844
7845 /// Sets the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
7846 ///
7847 /// # Example
7848 /// ```ignore,no_run
7849 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7850 /// use wkt::Duration;
7851 /// let x = LifecycleConfig::new().set_idle_delete_ttl(Duration::default()/* use setters */);
7852 /// ```
7853 pub fn set_idle_delete_ttl<T>(mut self, v: T) -> Self
7854 where
7855 T: std::convert::Into<wkt::Duration>,
7856 {
7857 self.idle_delete_ttl = std::option::Option::Some(v.into());
7858 self
7859 }
7860
7861 /// Sets or clears the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
7862 ///
7863 /// # Example
7864 /// ```ignore,no_run
7865 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7866 /// use wkt::Duration;
7867 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(Some(Duration::default()/* use setters */));
7868 /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(None::<Duration>);
7869 /// ```
7870 pub fn set_or_clear_idle_delete_ttl<T>(mut self, v: std::option::Option<T>) -> Self
7871 where
7872 T: std::convert::Into<wkt::Duration>,
7873 {
7874 self.idle_delete_ttl = v.map(|x| x.into());
7875 self
7876 }
7877
7878 /// Sets the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
7879 ///
7880 /// # Example
7881 /// ```ignore,no_run
7882 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7883 /// use wkt::Timestamp;
7884 /// let x = LifecycleConfig::new().set_idle_start_time(Timestamp::default()/* use setters */);
7885 /// ```
7886 pub fn set_idle_start_time<T>(mut self, v: T) -> Self
7887 where
7888 T: std::convert::Into<wkt::Timestamp>,
7889 {
7890 self.idle_start_time = std::option::Option::Some(v.into());
7891 self
7892 }
7893
7894 /// Sets or clears the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
7895 ///
7896 /// # Example
7897 /// ```ignore,no_run
7898 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7899 /// use wkt::Timestamp;
7900 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(Some(Timestamp::default()/* use setters */));
7901 /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(None::<Timestamp>);
7902 /// ```
7903 pub fn set_or_clear_idle_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7904 where
7905 T: std::convert::Into<wkt::Timestamp>,
7906 {
7907 self.idle_start_time = v.map(|x| x.into());
7908 self
7909 }
7910
7911 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl].
7912 ///
7913 /// Note that all the setters affecting `ttl` are mutually
7914 /// exclusive.
7915 ///
7916 /// # Example
7917 /// ```ignore,no_run
7918 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7919 /// use wkt::Timestamp;
7920 /// let x = LifecycleConfig::new().set_ttl(Some(
7921 /// google_cloud_dataproc_v1::model::lifecycle_config::Ttl::AutoDeleteTime(Timestamp::default().into())));
7922 /// ```
7923 pub fn set_ttl<
7924 T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::Ttl>>,
7925 >(
7926 mut self,
7927 v: T,
7928 ) -> Self {
7929 self.ttl = v.into();
7930 self
7931 }
7932
7933 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
7934 /// if it holds a `AutoDeleteTime`, `None` if the field is not set or
7935 /// holds a different branch.
7936 pub fn auto_delete_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
7937 #[allow(unreachable_patterns)]
7938 self.ttl.as_ref().and_then(|v| match v {
7939 crate::model::lifecycle_config::Ttl::AutoDeleteTime(v) => std::option::Option::Some(v),
7940 _ => std::option::Option::None,
7941 })
7942 }
7943
7944 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
7945 /// to hold a `AutoDeleteTime`.
7946 ///
7947 /// Note that all the setters affecting `ttl` are
7948 /// mutually exclusive.
7949 ///
7950 /// # Example
7951 /// ```ignore,no_run
7952 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7953 /// use wkt::Timestamp;
7954 /// let x = LifecycleConfig::new().set_auto_delete_time(Timestamp::default()/* use setters */);
7955 /// assert!(x.auto_delete_time().is_some());
7956 /// assert!(x.auto_delete_ttl().is_none());
7957 /// ```
7958 pub fn set_auto_delete_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
7959 mut self,
7960 v: T,
7961 ) -> Self {
7962 self.ttl = std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTime(
7963 v.into(),
7964 ));
7965 self
7966 }
7967
7968 /// The value of [ttl][crate::model::LifecycleConfig::ttl]
7969 /// if it holds a `AutoDeleteTtl`, `None` if the field is not set or
7970 /// holds a different branch.
7971 pub fn auto_delete_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
7972 #[allow(unreachable_patterns)]
7973 self.ttl.as_ref().and_then(|v| match v {
7974 crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v) => std::option::Option::Some(v),
7975 _ => std::option::Option::None,
7976 })
7977 }
7978
7979 /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
7980 /// to hold a `AutoDeleteTtl`.
7981 ///
7982 /// Note that all the setters affecting `ttl` are
7983 /// mutually exclusive.
7984 ///
7985 /// # Example
7986 /// ```ignore,no_run
7987 /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
7988 /// use wkt::Duration;
7989 /// let x = LifecycleConfig::new().set_auto_delete_ttl(Duration::default()/* use setters */);
7990 /// assert!(x.auto_delete_ttl().is_some());
7991 /// assert!(x.auto_delete_time().is_none());
7992 /// ```
7993 pub fn set_auto_delete_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
7994 mut self,
7995 v: T,
7996 ) -> Self {
7997 self.ttl =
7998 std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v.into()));
7999 self
8000 }
8001}
8002
8003impl wkt::message::Message for LifecycleConfig {
8004 fn typename() -> &'static str {
8005 "type.googleapis.com/google.cloud.dataproc.v1.LifecycleConfig"
8006 }
8007}
8008
8009/// Defines additional types related to [LifecycleConfig].
8010pub mod lifecycle_config {
8011 #[allow(unused_imports)]
8012 use super::*;
8013
8014 /// Either the exact time the cluster should be deleted at or
8015 /// the cluster maximum age.
8016 #[derive(Clone, Debug, PartialEq)]
8017 #[non_exhaustive]
8018 pub enum Ttl {
8019 /// Optional. The time when cluster will be auto-deleted (see JSON
8020 /// representation of
8021 /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8022 AutoDeleteTime(std::boxed::Box<wkt::Timestamp>),
8023 /// Optional. The lifetime duration of cluster. The cluster will be
8024 /// auto-deleted at the end of this period. Minimum value is 10 minutes;
8025 /// maximum value is 14 days (see JSON representation of
8026 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8027 AutoDeleteTtl(std::boxed::Box<wkt::Duration>),
8028 }
8029}
8030
8031/// Specifies a Metastore configuration.
8032#[derive(Clone, Default, PartialEq)]
8033#[non_exhaustive]
8034pub struct MetastoreConfig {
8035 /// Required. Resource name of an existing Dataproc Metastore service.
8036 ///
8037 /// Example:
8038 ///
8039 /// * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]`
8040 pub dataproc_metastore_service: std::string::String,
8041
8042 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8043}
8044
8045impl MetastoreConfig {
8046 pub fn new() -> Self {
8047 std::default::Default::default()
8048 }
8049
8050 /// Sets the value of [dataproc_metastore_service][crate::model::MetastoreConfig::dataproc_metastore_service].
8051 ///
8052 /// # Example
8053 /// ```ignore,no_run
8054 /// # use google_cloud_dataproc_v1::model::MetastoreConfig;
8055 /// let x = MetastoreConfig::new().set_dataproc_metastore_service("example");
8056 /// ```
8057 pub fn set_dataproc_metastore_service<T: std::convert::Into<std::string::String>>(
8058 mut self,
8059 v: T,
8060 ) -> Self {
8061 self.dataproc_metastore_service = v.into();
8062 self
8063 }
8064}
8065
8066impl wkt::message::Message for MetastoreConfig {
8067 fn typename() -> &'static str {
8068 "type.googleapis.com/google.cloud.dataproc.v1.MetastoreConfig"
8069 }
8070}
8071
8072/// Contains cluster daemon metrics, such as HDFS and YARN stats.
8073///
8074/// **Beta Feature**: This report is available for testing purposes only. It may
8075/// be changed before final release.
8076#[derive(Clone, Default, PartialEq)]
8077#[non_exhaustive]
8078pub struct ClusterMetrics {
8079 /// The HDFS metrics.
8080 pub hdfs_metrics: std::collections::HashMap<std::string::String, i64>,
8081
8082 /// YARN metrics.
8083 pub yarn_metrics: std::collections::HashMap<std::string::String, i64>,
8084
8085 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8086}
8087
8088impl ClusterMetrics {
8089 pub fn new() -> Self {
8090 std::default::Default::default()
8091 }
8092
8093 /// Sets the value of [hdfs_metrics][crate::model::ClusterMetrics::hdfs_metrics].
8094 ///
8095 /// # Example
8096 /// ```ignore,no_run
8097 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8098 /// let x = ClusterMetrics::new().set_hdfs_metrics([
8099 /// ("key0", 123),
8100 /// ("key1", 456),
8101 /// ]);
8102 /// ```
8103 pub fn set_hdfs_metrics<T, K, V>(mut self, v: T) -> Self
8104 where
8105 T: std::iter::IntoIterator<Item = (K, V)>,
8106 K: std::convert::Into<std::string::String>,
8107 V: std::convert::Into<i64>,
8108 {
8109 use std::iter::Iterator;
8110 self.hdfs_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8111 self
8112 }
8113
8114 /// Sets the value of [yarn_metrics][crate::model::ClusterMetrics::yarn_metrics].
8115 ///
8116 /// # Example
8117 /// ```ignore,no_run
8118 /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8119 /// let x = ClusterMetrics::new().set_yarn_metrics([
8120 /// ("key0", 123),
8121 /// ("key1", 456),
8122 /// ]);
8123 /// ```
8124 pub fn set_yarn_metrics<T, K, V>(mut self, v: T) -> Self
8125 where
8126 T: std::iter::IntoIterator<Item = (K, V)>,
8127 K: std::convert::Into<std::string::String>,
8128 V: std::convert::Into<i64>,
8129 {
8130 use std::iter::Iterator;
8131 self.yarn_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8132 self
8133 }
8134}
8135
8136impl wkt::message::Message for ClusterMetrics {
8137 fn typename() -> &'static str {
8138 "type.googleapis.com/google.cloud.dataproc.v1.ClusterMetrics"
8139 }
8140}
8141
8142/// Dataproc metric config.
8143#[derive(Clone, Default, PartialEq)]
8144#[non_exhaustive]
8145pub struct DataprocMetricConfig {
8146 /// Required. Metrics sources to enable.
8147 pub metrics: std::vec::Vec<crate::model::dataproc_metric_config::Metric>,
8148
8149 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8150}
8151
8152impl DataprocMetricConfig {
8153 pub fn new() -> Self {
8154 std::default::Default::default()
8155 }
8156
8157 /// Sets the value of [metrics][crate::model::DataprocMetricConfig::metrics].
8158 ///
8159 /// # Example
8160 /// ```ignore,no_run
8161 /// # use google_cloud_dataproc_v1::model::DataprocMetricConfig;
8162 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8163 /// let x = DataprocMetricConfig::new()
8164 /// .set_metrics([
8165 /// Metric::default()/* use setters */,
8166 /// Metric::default()/* use (different) setters */,
8167 /// ]);
8168 /// ```
8169 pub fn set_metrics<T, V>(mut self, v: T) -> Self
8170 where
8171 T: std::iter::IntoIterator<Item = V>,
8172 V: std::convert::Into<crate::model::dataproc_metric_config::Metric>,
8173 {
8174 use std::iter::Iterator;
8175 self.metrics = v.into_iter().map(|i| i.into()).collect();
8176 self
8177 }
8178}
8179
8180impl wkt::message::Message for DataprocMetricConfig {
8181 fn typename() -> &'static str {
8182 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig"
8183 }
8184}
8185
8186/// Defines additional types related to [DataprocMetricConfig].
8187pub mod dataproc_metric_config {
8188 #[allow(unused_imports)]
8189 use super::*;
8190
8191 /// A Dataproc custom metric.
8192 #[derive(Clone, Default, PartialEq)]
8193 #[non_exhaustive]
8194 pub struct Metric {
8195 /// Required. A standard set of metrics is collected unless `metricOverrides`
8196 /// are specified for the metric source (see [Custom metrics]
8197 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8198 /// for more information).
8199 pub metric_source: crate::model::dataproc_metric_config::MetricSource,
8200
8201 /// Optional. Specify one or more [Custom metrics]
8202 /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8203 /// to collect for the metric course (for the `SPARK` metric source (any
8204 /// [Spark metric]
8205 /// (<https://spark.apache.org/docs/latest/monitoring.html#metrics>) can be
8206 /// specified).
8207 ///
8208 /// Provide metrics in the following format:
8209 /// \<code\>\<var\>METRIC_SOURCE\</var\>:\<var\>INSTANCE\</var\>:\<var\>GROUP\</var\>:\<var\>METRIC\</var\>\</code\>
8210 /// Use camelcase as appropriate.
8211 ///
8212 /// Examples:
8213 ///
8214 /// ```norust
8215 /// yarn:ResourceManager:QueueMetrics:AppsCompleted
8216 /// spark:driver:DAGScheduler:job.allJobs
8217 /// sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed
8218 /// hiveserver2:JVM:Memory:NonHeapMemoryUsage.used
8219 /// ```
8220 ///
8221 /// Notes:
8222 ///
8223 /// * Only the specified overridden metrics are collected for the
8224 /// metric source. For example, if one or more `spark:executive` metrics
8225 /// are listed as metric overrides, other `SPARK` metrics are not
8226 /// collected. The collection of the metrics for other enabled custom
8227 /// metric sources is unaffected. For example, if both `SPARK` andd `YARN`
8228 /// metric sources are enabled, and overrides are provided for Spark
8229 /// metrics only, all YARN metrics are collected.
8230 pub metric_overrides: std::vec::Vec<std::string::String>,
8231
8232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8233 }
8234
8235 impl Metric {
8236 pub fn new() -> Self {
8237 std::default::Default::default()
8238 }
8239
8240 /// Sets the value of [metric_source][crate::model::dataproc_metric_config::Metric::metric_source].
8241 ///
8242 /// # Example
8243 /// ```ignore,no_run
8244 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8245 /// use google_cloud_dataproc_v1::model::dataproc_metric_config::MetricSource;
8246 /// let x0 = Metric::new().set_metric_source(MetricSource::MonitoringAgentDefaults);
8247 /// let x1 = Metric::new().set_metric_source(MetricSource::Hdfs);
8248 /// let x2 = Metric::new().set_metric_source(MetricSource::Spark);
8249 /// ```
8250 pub fn set_metric_source<
8251 T: std::convert::Into<crate::model::dataproc_metric_config::MetricSource>,
8252 >(
8253 mut self,
8254 v: T,
8255 ) -> Self {
8256 self.metric_source = v.into();
8257 self
8258 }
8259
8260 /// Sets the value of [metric_overrides][crate::model::dataproc_metric_config::Metric::metric_overrides].
8261 ///
8262 /// # Example
8263 /// ```ignore,no_run
8264 /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8265 /// let x = Metric::new().set_metric_overrides(["a", "b", "c"]);
8266 /// ```
8267 pub fn set_metric_overrides<T, V>(mut self, v: T) -> Self
8268 where
8269 T: std::iter::IntoIterator<Item = V>,
8270 V: std::convert::Into<std::string::String>,
8271 {
8272 use std::iter::Iterator;
8273 self.metric_overrides = v.into_iter().map(|i| i.into()).collect();
8274 self
8275 }
8276 }
8277
8278 impl wkt::message::Message for Metric {
8279 fn typename() -> &'static str {
8280 "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig.Metric"
8281 }
8282 }
8283
8284 /// A source for the collection of Dataproc custom metrics (see [Custom
8285 /// metrics]
8286 /// (<https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics>)).
8287 ///
8288 /// # Working with unknown values
8289 ///
8290 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8291 /// additional enum variants at any time. Adding new variants is not considered
8292 /// a breaking change. Applications should write their code in anticipation of:
8293 ///
8294 /// - New values appearing in future releases of the client library, **and**
8295 /// - New values received dynamically, without application changes.
8296 ///
8297 /// Please consult the [Working with enums] section in the user guide for some
8298 /// guidelines.
8299 ///
8300 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8301 #[derive(Clone, Debug, PartialEq)]
8302 #[non_exhaustive]
8303 pub enum MetricSource {
8304 /// Required unspecified metric source.
8305 Unspecified,
8306 /// Monitoring agent metrics. If this source is enabled,
8307 /// Dataproc enables the monitoring agent in Compute Engine,
8308 /// and collects monitoring agent metrics, which are published
8309 /// with an `agent.googleapis.com` prefix.
8310 MonitoringAgentDefaults,
8311 /// HDFS metric source.
8312 Hdfs,
8313 /// Spark metric source.
8314 Spark,
8315 /// YARN metric source.
8316 Yarn,
8317 /// Spark History Server metric source.
8318 SparkHistoryServer,
8319 /// Hiveserver2 metric source.
8320 Hiveserver2,
8321 /// hivemetastore metric source
8322 Hivemetastore,
8323 /// flink metric source
8324 Flink,
8325 /// If set, the enum was initialized with an unknown value.
8326 ///
8327 /// Applications can examine the value using [MetricSource::value] or
8328 /// [MetricSource::name].
8329 UnknownValue(metric_source::UnknownValue),
8330 }
8331
8332 #[doc(hidden)]
8333 pub mod metric_source {
8334 #[allow(unused_imports)]
8335 use super::*;
8336 #[derive(Clone, Debug, PartialEq)]
8337 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8338 }
8339
8340 impl MetricSource {
8341 /// Gets the enum value.
8342 ///
8343 /// Returns `None` if the enum contains an unknown value deserialized from
8344 /// the string representation of enums.
8345 pub fn value(&self) -> std::option::Option<i32> {
8346 match self {
8347 Self::Unspecified => std::option::Option::Some(0),
8348 Self::MonitoringAgentDefaults => std::option::Option::Some(1),
8349 Self::Hdfs => std::option::Option::Some(2),
8350 Self::Spark => std::option::Option::Some(3),
8351 Self::Yarn => std::option::Option::Some(4),
8352 Self::SparkHistoryServer => std::option::Option::Some(5),
8353 Self::Hiveserver2 => std::option::Option::Some(6),
8354 Self::Hivemetastore => std::option::Option::Some(7),
8355 Self::Flink => std::option::Option::Some(8),
8356 Self::UnknownValue(u) => u.0.value(),
8357 }
8358 }
8359
8360 /// Gets the enum value as a string.
8361 ///
8362 /// Returns `None` if the enum contains an unknown value deserialized from
8363 /// the integer representation of enums.
8364 pub fn name(&self) -> std::option::Option<&str> {
8365 match self {
8366 Self::Unspecified => std::option::Option::Some("METRIC_SOURCE_UNSPECIFIED"),
8367 Self::MonitoringAgentDefaults => {
8368 std::option::Option::Some("MONITORING_AGENT_DEFAULTS")
8369 }
8370 Self::Hdfs => std::option::Option::Some("HDFS"),
8371 Self::Spark => std::option::Option::Some("SPARK"),
8372 Self::Yarn => std::option::Option::Some("YARN"),
8373 Self::SparkHistoryServer => std::option::Option::Some("SPARK_HISTORY_SERVER"),
8374 Self::Hiveserver2 => std::option::Option::Some("HIVESERVER2"),
8375 Self::Hivemetastore => std::option::Option::Some("HIVEMETASTORE"),
8376 Self::Flink => std::option::Option::Some("FLINK"),
8377 Self::UnknownValue(u) => u.0.name(),
8378 }
8379 }
8380 }
8381
8382 impl std::default::Default for MetricSource {
8383 fn default() -> Self {
8384 use std::convert::From;
8385 Self::from(0)
8386 }
8387 }
8388
8389 impl std::fmt::Display for MetricSource {
8390 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8391 wkt::internal::display_enum(f, self.name(), self.value())
8392 }
8393 }
8394
8395 impl std::convert::From<i32> for MetricSource {
8396 fn from(value: i32) -> Self {
8397 match value {
8398 0 => Self::Unspecified,
8399 1 => Self::MonitoringAgentDefaults,
8400 2 => Self::Hdfs,
8401 3 => Self::Spark,
8402 4 => Self::Yarn,
8403 5 => Self::SparkHistoryServer,
8404 6 => Self::Hiveserver2,
8405 7 => Self::Hivemetastore,
8406 8 => Self::Flink,
8407 _ => Self::UnknownValue(metric_source::UnknownValue(
8408 wkt::internal::UnknownEnumValue::Integer(value),
8409 )),
8410 }
8411 }
8412 }
8413
8414 impl std::convert::From<&str> for MetricSource {
8415 fn from(value: &str) -> Self {
8416 use std::string::ToString;
8417 match value {
8418 "METRIC_SOURCE_UNSPECIFIED" => Self::Unspecified,
8419 "MONITORING_AGENT_DEFAULTS" => Self::MonitoringAgentDefaults,
8420 "HDFS" => Self::Hdfs,
8421 "SPARK" => Self::Spark,
8422 "YARN" => Self::Yarn,
8423 "SPARK_HISTORY_SERVER" => Self::SparkHistoryServer,
8424 "HIVESERVER2" => Self::Hiveserver2,
8425 "HIVEMETASTORE" => Self::Hivemetastore,
8426 "FLINK" => Self::Flink,
8427 _ => Self::UnknownValue(metric_source::UnknownValue(
8428 wkt::internal::UnknownEnumValue::String(value.to_string()),
8429 )),
8430 }
8431 }
8432 }
8433
8434 impl serde::ser::Serialize for MetricSource {
8435 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8436 where
8437 S: serde::Serializer,
8438 {
8439 match self {
8440 Self::Unspecified => serializer.serialize_i32(0),
8441 Self::MonitoringAgentDefaults => serializer.serialize_i32(1),
8442 Self::Hdfs => serializer.serialize_i32(2),
8443 Self::Spark => serializer.serialize_i32(3),
8444 Self::Yarn => serializer.serialize_i32(4),
8445 Self::SparkHistoryServer => serializer.serialize_i32(5),
8446 Self::Hiveserver2 => serializer.serialize_i32(6),
8447 Self::Hivemetastore => serializer.serialize_i32(7),
8448 Self::Flink => serializer.serialize_i32(8),
8449 Self::UnknownValue(u) => u.0.serialize(serializer),
8450 }
8451 }
8452 }
8453
8454 impl<'de> serde::de::Deserialize<'de> for MetricSource {
8455 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8456 where
8457 D: serde::Deserializer<'de>,
8458 {
8459 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricSource>::new(
8460 ".google.cloud.dataproc.v1.DataprocMetricConfig.MetricSource",
8461 ))
8462 }
8463 }
8464}
8465
8466/// A request to create a cluster.
8467#[derive(Clone, Default, PartialEq)]
8468#[non_exhaustive]
8469pub struct CreateClusterRequest {
8470 /// Required. The ID of the Google Cloud Platform project that the cluster
8471 /// belongs to.
8472 pub project_id: std::string::String,
8473
8474 /// Required. The Dataproc region in which to handle the request.
8475 pub region: std::string::String,
8476
8477 /// Required. The cluster to create.
8478 pub cluster: std::option::Option<crate::model::Cluster>,
8479
8480 /// Optional. A unique ID used to identify the request. If the server receives
8481 /// two
8482 /// [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
8483 /// with the same id, then the second request will be ignored and the
8484 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8485 /// and stored in the backend is returned.
8486 ///
8487 /// It is recommended to always set this value to a
8488 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8489 ///
8490 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8491 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8492 ///
8493 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8494 pub request_id: std::string::String,
8495
8496 /// Optional. Failure action when primary worker creation fails.
8497 pub action_on_failed_primary_workers: crate::model::FailureAction,
8498
8499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8500}
8501
8502impl CreateClusterRequest {
8503 pub fn new() -> Self {
8504 std::default::Default::default()
8505 }
8506
8507 /// Sets the value of [project_id][crate::model::CreateClusterRequest::project_id].
8508 ///
8509 /// # Example
8510 /// ```ignore,no_run
8511 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8512 /// let x = CreateClusterRequest::new().set_project_id("example");
8513 /// ```
8514 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8515 self.project_id = v.into();
8516 self
8517 }
8518
8519 /// Sets the value of [region][crate::model::CreateClusterRequest::region].
8520 ///
8521 /// # Example
8522 /// ```ignore,no_run
8523 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8524 /// let x = CreateClusterRequest::new().set_region("example");
8525 /// ```
8526 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8527 self.region = v.into();
8528 self
8529 }
8530
8531 /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
8532 ///
8533 /// # Example
8534 /// ```ignore,no_run
8535 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8536 /// use google_cloud_dataproc_v1::model::Cluster;
8537 /// let x = CreateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
8538 /// ```
8539 pub fn set_cluster<T>(mut self, v: T) -> Self
8540 where
8541 T: std::convert::Into<crate::model::Cluster>,
8542 {
8543 self.cluster = std::option::Option::Some(v.into());
8544 self
8545 }
8546
8547 /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
8548 ///
8549 /// # Example
8550 /// ```ignore,no_run
8551 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8552 /// use google_cloud_dataproc_v1::model::Cluster;
8553 /// let x = CreateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
8554 /// let x = CreateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
8555 /// ```
8556 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
8557 where
8558 T: std::convert::Into<crate::model::Cluster>,
8559 {
8560 self.cluster = v.map(|x| x.into());
8561 self
8562 }
8563
8564 /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
8565 ///
8566 /// # Example
8567 /// ```ignore,no_run
8568 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8569 /// let x = CreateClusterRequest::new().set_request_id("example");
8570 /// ```
8571 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8572 self.request_id = v.into();
8573 self
8574 }
8575
8576 /// Sets the value of [action_on_failed_primary_workers][crate::model::CreateClusterRequest::action_on_failed_primary_workers].
8577 ///
8578 /// # Example
8579 /// ```ignore,no_run
8580 /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8581 /// use google_cloud_dataproc_v1::model::FailureAction;
8582 /// let x0 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::NoAction);
8583 /// let x1 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::Delete);
8584 /// ```
8585 pub fn set_action_on_failed_primary_workers<
8586 T: std::convert::Into<crate::model::FailureAction>,
8587 >(
8588 mut self,
8589 v: T,
8590 ) -> Self {
8591 self.action_on_failed_primary_workers = v.into();
8592 self
8593 }
8594}
8595
8596impl wkt::message::Message for CreateClusterRequest {
8597 fn typename() -> &'static str {
8598 "type.googleapis.com/google.cloud.dataproc.v1.CreateClusterRequest"
8599 }
8600}
8601
8602/// A request to update a cluster.
8603#[derive(Clone, Default, PartialEq)]
8604#[non_exhaustive]
8605pub struct UpdateClusterRequest {
8606 /// Required. The ID of the Google Cloud Platform project the
8607 /// cluster belongs to.
8608 pub project_id: std::string::String,
8609
8610 /// Required. The Dataproc region in which to handle the request.
8611 pub region: std::string::String,
8612
8613 /// Required. The cluster name.
8614 pub cluster_name: std::string::String,
8615
8616 /// Required. The changes to the cluster.
8617 pub cluster: std::option::Option<crate::model::Cluster>,
8618
8619 /// Optional. Timeout for graceful YARN decommissioning. Graceful
8620 /// decommissioning allows removing nodes from the cluster without
8621 /// interrupting jobs in progress. Timeout specifies how long to wait for jobs
8622 /// in progress to finish before forcefully removing nodes (and potentially
8623 /// interrupting jobs). Default timeout is 0 (for forceful decommission), and
8624 /// the maximum allowed timeout is 1 day. (see JSON representation of
8625 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8626 ///
8627 /// Only supported on Dataproc image versions 1.2 and higher.
8628 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
8629
8630 /// Required. Specifies the path, relative to `Cluster`, of
8631 /// the field to update. For example, to change the number of workers
8632 /// in a cluster to 5, the `update_mask` parameter would be
8633 /// specified as `config.worker_config.num_instances`,
8634 /// and the `PATCH` request body would specify the new value, as follows:
8635 ///
8636 /// ```norust
8637 /// {
8638 /// "config":{
8639 /// "workerConfig":{
8640 /// "numInstances":"5"
8641 /// }
8642 /// }
8643 /// }
8644 /// ```
8645 ///
8646 /// Similarly, to change the number of preemptible workers in a cluster to 5,
8647 /// the `update_mask` parameter would be
8648 /// `config.secondary_worker_config.num_instances`, and the `PATCH` request
8649 /// body would be set as follows:
8650 ///
8651 /// ```norust
8652 /// {
8653 /// "config":{
8654 /// "secondaryWorkerConfig":{
8655 /// "numInstances":"5"
8656 /// }
8657 /// }
8658 /// }
8659 /// ```
8660 ///
8661 /// \<strong\>Note:\</strong\> Currently, only the following fields can be updated:
8662 pub update_mask: std::option::Option<wkt::FieldMask>,
8663
8664 /// Optional. A unique ID used to identify the request. If the server
8665 /// receives two
8666 /// [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
8667 /// with the same id, then the second request will be ignored and the
8668 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8669 /// and stored in the backend is returned.
8670 ///
8671 /// It is recommended to always set this value to a
8672 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8673 ///
8674 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8675 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8676 ///
8677 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8678 pub request_id: std::string::String,
8679
8680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8681}
8682
8683impl UpdateClusterRequest {
8684 pub fn new() -> Self {
8685 std::default::Default::default()
8686 }
8687
8688 /// Sets the value of [project_id][crate::model::UpdateClusterRequest::project_id].
8689 ///
8690 /// # Example
8691 /// ```ignore,no_run
8692 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8693 /// let x = UpdateClusterRequest::new().set_project_id("example");
8694 /// ```
8695 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8696 self.project_id = v.into();
8697 self
8698 }
8699
8700 /// Sets the value of [region][crate::model::UpdateClusterRequest::region].
8701 ///
8702 /// # Example
8703 /// ```ignore,no_run
8704 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8705 /// let x = UpdateClusterRequest::new().set_region("example");
8706 /// ```
8707 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8708 self.region = v.into();
8709 self
8710 }
8711
8712 /// Sets the value of [cluster_name][crate::model::UpdateClusterRequest::cluster_name].
8713 ///
8714 /// # Example
8715 /// ```ignore,no_run
8716 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8717 /// let x = UpdateClusterRequest::new().set_cluster_name("example");
8718 /// ```
8719 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8720 self.cluster_name = v.into();
8721 self
8722 }
8723
8724 /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
8725 ///
8726 /// # Example
8727 /// ```ignore,no_run
8728 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8729 /// use google_cloud_dataproc_v1::model::Cluster;
8730 /// let x = UpdateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
8731 /// ```
8732 pub fn set_cluster<T>(mut self, v: T) -> Self
8733 where
8734 T: std::convert::Into<crate::model::Cluster>,
8735 {
8736 self.cluster = std::option::Option::Some(v.into());
8737 self
8738 }
8739
8740 /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
8741 ///
8742 /// # Example
8743 /// ```ignore,no_run
8744 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8745 /// use google_cloud_dataproc_v1::model::Cluster;
8746 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
8747 /// let x = UpdateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
8748 /// ```
8749 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
8750 where
8751 T: std::convert::Into<crate::model::Cluster>,
8752 {
8753 self.cluster = v.map(|x| x.into());
8754 self
8755 }
8756
8757 /// Sets the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
8758 ///
8759 /// # Example
8760 /// ```ignore,no_run
8761 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8762 /// use wkt::Duration;
8763 /// let x = UpdateClusterRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
8764 /// ```
8765 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
8766 where
8767 T: std::convert::Into<wkt::Duration>,
8768 {
8769 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
8770 self
8771 }
8772
8773 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
8774 ///
8775 /// # Example
8776 /// ```ignore,no_run
8777 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8778 /// use wkt::Duration;
8779 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
8780 /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
8781 /// ```
8782 pub fn set_or_clear_graceful_decommission_timeout<T>(
8783 mut self,
8784 v: std::option::Option<T>,
8785 ) -> Self
8786 where
8787 T: std::convert::Into<wkt::Duration>,
8788 {
8789 self.graceful_decommission_timeout = v.map(|x| x.into());
8790 self
8791 }
8792
8793 /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
8794 ///
8795 /// # Example
8796 /// ```ignore,no_run
8797 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8798 /// use wkt::FieldMask;
8799 /// let x = UpdateClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8800 /// ```
8801 pub fn set_update_mask<T>(mut self, v: T) -> Self
8802 where
8803 T: std::convert::Into<wkt::FieldMask>,
8804 {
8805 self.update_mask = std::option::Option::Some(v.into());
8806 self
8807 }
8808
8809 /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
8810 ///
8811 /// # Example
8812 /// ```ignore,no_run
8813 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8814 /// use wkt::FieldMask;
8815 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8816 /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8817 /// ```
8818 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8819 where
8820 T: std::convert::Into<wkt::FieldMask>,
8821 {
8822 self.update_mask = v.map(|x| x.into());
8823 self
8824 }
8825
8826 /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
8827 ///
8828 /// # Example
8829 /// ```ignore,no_run
8830 /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
8831 /// let x = UpdateClusterRequest::new().set_request_id("example");
8832 /// ```
8833 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8834 self.request_id = v.into();
8835 self
8836 }
8837}
8838
8839impl wkt::message::Message for UpdateClusterRequest {
8840 fn typename() -> &'static str {
8841 "type.googleapis.com/google.cloud.dataproc.v1.UpdateClusterRequest"
8842 }
8843}
8844
8845/// A request to stop a cluster.
8846#[derive(Clone, Default, PartialEq)]
8847#[non_exhaustive]
8848pub struct StopClusterRequest {
8849 /// Required. The ID of the Google Cloud Platform project the
8850 /// cluster belongs to.
8851 pub project_id: std::string::String,
8852
8853 /// Required. The Dataproc region in which to handle the request.
8854 pub region: std::string::String,
8855
8856 /// Required. The cluster name.
8857 pub cluster_name: std::string::String,
8858
8859 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
8860 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
8861 pub cluster_uuid: std::string::String,
8862
8863 /// Optional. A unique ID used to identify the request. If the server
8864 /// receives two
8865 /// [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
8866 /// with the same id, then the second request will be ignored and the
8867 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8868 /// and stored in the backend is returned.
8869 ///
8870 /// Recommendation: Set this value to a
8871 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8872 ///
8873 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8874 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8875 ///
8876 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8877 pub request_id: std::string::String,
8878
8879 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8880}
8881
8882impl StopClusterRequest {
8883 pub fn new() -> Self {
8884 std::default::Default::default()
8885 }
8886
8887 /// Sets the value of [project_id][crate::model::StopClusterRequest::project_id].
8888 ///
8889 /// # Example
8890 /// ```ignore,no_run
8891 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8892 /// let x = StopClusterRequest::new().set_project_id("example");
8893 /// ```
8894 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8895 self.project_id = v.into();
8896 self
8897 }
8898
8899 /// Sets the value of [region][crate::model::StopClusterRequest::region].
8900 ///
8901 /// # Example
8902 /// ```ignore,no_run
8903 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8904 /// let x = StopClusterRequest::new().set_region("example");
8905 /// ```
8906 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8907 self.region = v.into();
8908 self
8909 }
8910
8911 /// Sets the value of [cluster_name][crate::model::StopClusterRequest::cluster_name].
8912 ///
8913 /// # Example
8914 /// ```ignore,no_run
8915 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8916 /// let x = StopClusterRequest::new().set_cluster_name("example");
8917 /// ```
8918 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8919 self.cluster_name = v.into();
8920 self
8921 }
8922
8923 /// Sets the value of [cluster_uuid][crate::model::StopClusterRequest::cluster_uuid].
8924 ///
8925 /// # Example
8926 /// ```ignore,no_run
8927 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8928 /// let x = StopClusterRequest::new().set_cluster_uuid("example");
8929 /// ```
8930 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8931 self.cluster_uuid = v.into();
8932 self
8933 }
8934
8935 /// Sets the value of [request_id][crate::model::StopClusterRequest::request_id].
8936 ///
8937 /// # Example
8938 /// ```ignore,no_run
8939 /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
8940 /// let x = StopClusterRequest::new().set_request_id("example");
8941 /// ```
8942 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8943 self.request_id = v.into();
8944 self
8945 }
8946}
8947
8948impl wkt::message::Message for StopClusterRequest {
8949 fn typename() -> &'static str {
8950 "type.googleapis.com/google.cloud.dataproc.v1.StopClusterRequest"
8951 }
8952}
8953
8954/// A request to start a cluster.
8955#[derive(Clone, Default, PartialEq)]
8956#[non_exhaustive]
8957pub struct StartClusterRequest {
8958 /// Required. The ID of the Google Cloud Platform project the
8959 /// cluster belongs to.
8960 pub project_id: std::string::String,
8961
8962 /// Required. The Dataproc region in which to handle the request.
8963 pub region: std::string::String,
8964
8965 /// Required. The cluster name.
8966 pub cluster_name: std::string::String,
8967
8968 /// Optional. Specifying the `cluster_uuid` means the RPC will fail
8969 /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
8970 pub cluster_uuid: std::string::String,
8971
8972 /// Optional. A unique ID used to identify the request. If the server
8973 /// receives two
8974 /// [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
8975 /// with the same id, then the second request will be ignored and the
8976 /// first [google.longrunning.Operation][google.longrunning.Operation] created
8977 /// and stored in the backend is returned.
8978 ///
8979 /// Recommendation: Set this value to a
8980 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8981 ///
8982 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8983 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8984 ///
8985 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8986 pub request_id: std::string::String,
8987
8988 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8989}
8990
8991impl StartClusterRequest {
8992 pub fn new() -> Self {
8993 std::default::Default::default()
8994 }
8995
8996 /// Sets the value of [project_id][crate::model::StartClusterRequest::project_id].
8997 ///
8998 /// # Example
8999 /// ```ignore,no_run
9000 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9001 /// let x = StartClusterRequest::new().set_project_id("example");
9002 /// ```
9003 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9004 self.project_id = v.into();
9005 self
9006 }
9007
9008 /// Sets the value of [region][crate::model::StartClusterRequest::region].
9009 ///
9010 /// # Example
9011 /// ```ignore,no_run
9012 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9013 /// let x = StartClusterRequest::new().set_region("example");
9014 /// ```
9015 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9016 self.region = v.into();
9017 self
9018 }
9019
9020 /// Sets the value of [cluster_name][crate::model::StartClusterRequest::cluster_name].
9021 ///
9022 /// # Example
9023 /// ```ignore,no_run
9024 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9025 /// let x = StartClusterRequest::new().set_cluster_name("example");
9026 /// ```
9027 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9028 self.cluster_name = v.into();
9029 self
9030 }
9031
9032 /// Sets the value of [cluster_uuid][crate::model::StartClusterRequest::cluster_uuid].
9033 ///
9034 /// # Example
9035 /// ```ignore,no_run
9036 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9037 /// let x = StartClusterRequest::new().set_cluster_uuid("example");
9038 /// ```
9039 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9040 self.cluster_uuid = v.into();
9041 self
9042 }
9043
9044 /// Sets the value of [request_id][crate::model::StartClusterRequest::request_id].
9045 ///
9046 /// # Example
9047 /// ```ignore,no_run
9048 /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9049 /// let x = StartClusterRequest::new().set_request_id("example");
9050 /// ```
9051 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9052 self.request_id = v.into();
9053 self
9054 }
9055}
9056
9057impl wkt::message::Message for StartClusterRequest {
9058 fn typename() -> &'static str {
9059 "type.googleapis.com/google.cloud.dataproc.v1.StartClusterRequest"
9060 }
9061}
9062
9063/// A request to delete a cluster.
9064#[derive(Clone, Default, PartialEq)]
9065#[non_exhaustive]
9066pub struct DeleteClusterRequest {
9067 /// Required. The ID of the Google Cloud Platform project that the cluster
9068 /// belongs to.
9069 pub project_id: std::string::String,
9070
9071 /// Required. The Dataproc region in which to handle the request.
9072 pub region: std::string::String,
9073
9074 /// Required. The cluster name.
9075 pub cluster_name: std::string::String,
9076
9077 /// Optional. Specifying the `cluster_uuid` means the RPC should fail
9078 /// (with error NOT_FOUND) if cluster with specified UUID does not exist.
9079 pub cluster_uuid: std::string::String,
9080
9081 /// Optional. A unique ID used to identify the request. If the server
9082 /// receives two
9083 /// [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
9084 /// with the same id, then the second request will be ignored and the
9085 /// first [google.longrunning.Operation][google.longrunning.Operation] created
9086 /// and stored in the backend is returned.
9087 ///
9088 /// It is recommended to always set this value to a
9089 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9090 ///
9091 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9092 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9093 ///
9094 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9095 pub request_id: std::string::String,
9096
9097 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9098}
9099
9100impl DeleteClusterRequest {
9101 pub fn new() -> Self {
9102 std::default::Default::default()
9103 }
9104
9105 /// Sets the value of [project_id][crate::model::DeleteClusterRequest::project_id].
9106 ///
9107 /// # Example
9108 /// ```ignore,no_run
9109 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9110 /// let x = DeleteClusterRequest::new().set_project_id("example");
9111 /// ```
9112 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9113 self.project_id = v.into();
9114 self
9115 }
9116
9117 /// Sets the value of [region][crate::model::DeleteClusterRequest::region].
9118 ///
9119 /// # Example
9120 /// ```ignore,no_run
9121 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9122 /// let x = DeleteClusterRequest::new().set_region("example");
9123 /// ```
9124 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9125 self.region = v.into();
9126 self
9127 }
9128
9129 /// Sets the value of [cluster_name][crate::model::DeleteClusterRequest::cluster_name].
9130 ///
9131 /// # Example
9132 /// ```ignore,no_run
9133 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9134 /// let x = DeleteClusterRequest::new().set_cluster_name("example");
9135 /// ```
9136 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9137 self.cluster_name = v.into();
9138 self
9139 }
9140
9141 /// Sets the value of [cluster_uuid][crate::model::DeleteClusterRequest::cluster_uuid].
9142 ///
9143 /// # Example
9144 /// ```ignore,no_run
9145 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9146 /// let x = DeleteClusterRequest::new().set_cluster_uuid("example");
9147 /// ```
9148 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9149 self.cluster_uuid = v.into();
9150 self
9151 }
9152
9153 /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
9154 ///
9155 /// # Example
9156 /// ```ignore,no_run
9157 /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9158 /// let x = DeleteClusterRequest::new().set_request_id("example");
9159 /// ```
9160 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9161 self.request_id = v.into();
9162 self
9163 }
9164}
9165
9166impl wkt::message::Message for DeleteClusterRequest {
9167 fn typename() -> &'static str {
9168 "type.googleapis.com/google.cloud.dataproc.v1.DeleteClusterRequest"
9169 }
9170}
9171
9172/// Request to get the resource representation for a cluster in a project.
9173#[derive(Clone, Default, PartialEq)]
9174#[non_exhaustive]
9175pub struct GetClusterRequest {
9176 /// Required. The ID of the Google Cloud Platform project that the cluster
9177 /// belongs to.
9178 pub project_id: std::string::String,
9179
9180 /// Required. The Dataproc region in which to handle the request.
9181 pub region: std::string::String,
9182
9183 /// Required. The cluster name.
9184 pub cluster_name: std::string::String,
9185
9186 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9187}
9188
9189impl GetClusterRequest {
9190 pub fn new() -> Self {
9191 std::default::Default::default()
9192 }
9193
9194 /// Sets the value of [project_id][crate::model::GetClusterRequest::project_id].
9195 ///
9196 /// # Example
9197 /// ```ignore,no_run
9198 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9199 /// let x = GetClusterRequest::new().set_project_id("example");
9200 /// ```
9201 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9202 self.project_id = v.into();
9203 self
9204 }
9205
9206 /// Sets the value of [region][crate::model::GetClusterRequest::region].
9207 ///
9208 /// # Example
9209 /// ```ignore,no_run
9210 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9211 /// let x = GetClusterRequest::new().set_region("example");
9212 /// ```
9213 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9214 self.region = v.into();
9215 self
9216 }
9217
9218 /// Sets the value of [cluster_name][crate::model::GetClusterRequest::cluster_name].
9219 ///
9220 /// # Example
9221 /// ```ignore,no_run
9222 /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9223 /// let x = GetClusterRequest::new().set_cluster_name("example");
9224 /// ```
9225 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9226 self.cluster_name = v.into();
9227 self
9228 }
9229}
9230
9231impl wkt::message::Message for GetClusterRequest {
9232 fn typename() -> &'static str {
9233 "type.googleapis.com/google.cloud.dataproc.v1.GetClusterRequest"
9234 }
9235}
9236
9237/// A request to list the clusters in a project.
9238#[derive(Clone, Default, PartialEq)]
9239#[non_exhaustive]
9240pub struct ListClustersRequest {
9241 /// Required. The ID of the Google Cloud Platform project that the cluster
9242 /// belongs to.
9243 pub project_id: std::string::String,
9244
9245 /// Required. The Dataproc region in which to handle the request.
9246 pub region: std::string::String,
9247
9248 /// Optional. A filter constraining the clusters to list. Filters are
9249 /// case-sensitive and have the following syntax:
9250 ///
9251 /// field = value [AND [field = value]] ...
9252 ///
9253 /// where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
9254 /// and `[KEY]` is a label key. **value** can be `*` to match all values.
9255 /// `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
9256 /// `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or
9257 /// `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING`
9258 /// states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and
9259 /// `STOPPED` states. `clusterName` is the name of the cluster provided at
9260 /// creation time. Only the logical `AND` operator is supported;
9261 /// space-separated items are treated as having an implicit `AND` operator.
9262 ///
9263 /// Example filter:
9264 ///
9265 /// status.state = ACTIVE AND clusterName = mycluster
9266 /// AND labels.env = staging AND labels.starred = *
9267 pub filter: std::string::String,
9268
9269 /// Optional. The standard List page size.
9270 pub page_size: i32,
9271
9272 /// Optional. The standard List page token.
9273 pub page_token: std::string::String,
9274
9275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9276}
9277
9278impl ListClustersRequest {
9279 pub fn new() -> Self {
9280 std::default::Default::default()
9281 }
9282
9283 /// Sets the value of [project_id][crate::model::ListClustersRequest::project_id].
9284 ///
9285 /// # Example
9286 /// ```ignore,no_run
9287 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9288 /// let x = ListClustersRequest::new().set_project_id("example");
9289 /// ```
9290 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9291 self.project_id = v.into();
9292 self
9293 }
9294
9295 /// Sets the value of [region][crate::model::ListClustersRequest::region].
9296 ///
9297 /// # Example
9298 /// ```ignore,no_run
9299 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9300 /// let x = ListClustersRequest::new().set_region("example");
9301 /// ```
9302 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9303 self.region = v.into();
9304 self
9305 }
9306
9307 /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
9308 ///
9309 /// # Example
9310 /// ```ignore,no_run
9311 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9312 /// let x = ListClustersRequest::new().set_filter("example");
9313 /// ```
9314 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9315 self.filter = v.into();
9316 self
9317 }
9318
9319 /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
9320 ///
9321 /// # Example
9322 /// ```ignore,no_run
9323 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9324 /// let x = ListClustersRequest::new().set_page_size(42);
9325 /// ```
9326 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9327 self.page_size = v.into();
9328 self
9329 }
9330
9331 /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
9332 ///
9333 /// # Example
9334 /// ```ignore,no_run
9335 /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9336 /// let x = ListClustersRequest::new().set_page_token("example");
9337 /// ```
9338 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9339 self.page_token = v.into();
9340 self
9341 }
9342}
9343
9344impl wkt::message::Message for ListClustersRequest {
9345 fn typename() -> &'static str {
9346 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersRequest"
9347 }
9348}
9349
9350/// The list of all clusters in a project.
9351#[derive(Clone, Default, PartialEq)]
9352#[non_exhaustive]
9353pub struct ListClustersResponse {
9354 /// Output only. The clusters in the project.
9355 pub clusters: std::vec::Vec<crate::model::Cluster>,
9356
9357 /// Output only. This token is included in the response if there are more
9358 /// results to fetch. To fetch additional results, provide this value as the
9359 /// `page_token` in a subsequent `ListClustersRequest`.
9360 pub next_page_token: std::string::String,
9361
9362 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9363}
9364
9365impl ListClustersResponse {
9366 pub fn new() -> Self {
9367 std::default::Default::default()
9368 }
9369
9370 /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
9371 ///
9372 /// # Example
9373 /// ```ignore,no_run
9374 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
9375 /// use google_cloud_dataproc_v1::model::Cluster;
9376 /// let x = ListClustersResponse::new()
9377 /// .set_clusters([
9378 /// Cluster::default()/* use setters */,
9379 /// Cluster::default()/* use (different) setters */,
9380 /// ]);
9381 /// ```
9382 pub fn set_clusters<T, V>(mut self, v: T) -> Self
9383 where
9384 T: std::iter::IntoIterator<Item = V>,
9385 V: std::convert::Into<crate::model::Cluster>,
9386 {
9387 use std::iter::Iterator;
9388 self.clusters = v.into_iter().map(|i| i.into()).collect();
9389 self
9390 }
9391
9392 /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
9393 ///
9394 /// # Example
9395 /// ```ignore,no_run
9396 /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
9397 /// let x = ListClustersResponse::new().set_next_page_token("example");
9398 /// ```
9399 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9400 self.next_page_token = v.into();
9401 self
9402 }
9403}
9404
9405impl wkt::message::Message for ListClustersResponse {
9406 fn typename() -> &'static str {
9407 "type.googleapis.com/google.cloud.dataproc.v1.ListClustersResponse"
9408 }
9409}
9410
9411#[doc(hidden)]
9412impl google_cloud_gax::paginator::internal::PageableResponse for ListClustersResponse {
9413 type PageItem = crate::model::Cluster;
9414
9415 fn items(self) -> std::vec::Vec<Self::PageItem> {
9416 self.clusters
9417 }
9418
9419 fn next_page_token(&self) -> std::string::String {
9420 use std::clone::Clone;
9421 self.next_page_token.clone()
9422 }
9423}
9424
9425/// A request to collect cluster diagnostic information.
9426#[derive(Clone, Default, PartialEq)]
9427#[non_exhaustive]
9428pub struct DiagnoseClusterRequest {
9429 /// Required. The ID of the Google Cloud Platform project that the cluster
9430 /// belongs to.
9431 pub project_id: std::string::String,
9432
9433 /// Required. The Dataproc region in which to handle the request.
9434 pub region: std::string::String,
9435
9436 /// Required. The cluster name.
9437 pub cluster_name: std::string::String,
9438
9439 /// Optional. (Optional) The output Cloud Storage directory for the diagnostic
9440 /// tarball. If not specified, a task-specific directory in the cluster's
9441 /// staging bucket will be used.
9442 pub tarball_gcs_dir: std::string::String,
9443
9444 /// Optional. (Optional) The access type to the diagnostic tarball. If not
9445 /// specified, falls back to default access of the bucket
9446 pub tarball_access: crate::model::diagnose_cluster_request::TarballAccess,
9447
9448 /// Optional. Time interval in which diagnosis should be carried out on the
9449 /// cluster.
9450 pub diagnosis_interval: std::option::Option<google_cloud_type::model::Interval>,
9451
9452 /// Optional. Specifies a list of jobs on which diagnosis is to be performed.
9453 /// Format: projects/{project}/regions/{region}/jobs/{job}
9454 pub jobs: std::vec::Vec<std::string::String>,
9455
9456 /// Optional. Specifies a list of yarn applications on which diagnosis is to be
9457 /// performed.
9458 pub yarn_application_ids: std::vec::Vec<std::string::String>,
9459
9460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9461}
9462
9463impl DiagnoseClusterRequest {
9464 pub fn new() -> Self {
9465 std::default::Default::default()
9466 }
9467
9468 /// Sets the value of [project_id][crate::model::DiagnoseClusterRequest::project_id].
9469 ///
9470 /// # Example
9471 /// ```ignore,no_run
9472 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9473 /// let x = DiagnoseClusterRequest::new().set_project_id("example");
9474 /// ```
9475 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9476 self.project_id = v.into();
9477 self
9478 }
9479
9480 /// Sets the value of [region][crate::model::DiagnoseClusterRequest::region].
9481 ///
9482 /// # Example
9483 /// ```ignore,no_run
9484 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9485 /// let x = DiagnoseClusterRequest::new().set_region("example");
9486 /// ```
9487 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9488 self.region = v.into();
9489 self
9490 }
9491
9492 /// Sets the value of [cluster_name][crate::model::DiagnoseClusterRequest::cluster_name].
9493 ///
9494 /// # Example
9495 /// ```ignore,no_run
9496 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9497 /// let x = DiagnoseClusterRequest::new().set_cluster_name("example");
9498 /// ```
9499 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9500 self.cluster_name = v.into();
9501 self
9502 }
9503
9504 /// Sets the value of [tarball_gcs_dir][crate::model::DiagnoseClusterRequest::tarball_gcs_dir].
9505 ///
9506 /// # Example
9507 /// ```ignore,no_run
9508 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9509 /// let x = DiagnoseClusterRequest::new().set_tarball_gcs_dir("example");
9510 /// ```
9511 pub fn set_tarball_gcs_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9512 self.tarball_gcs_dir = v.into();
9513 self
9514 }
9515
9516 /// Sets the value of [tarball_access][crate::model::DiagnoseClusterRequest::tarball_access].
9517 ///
9518 /// # Example
9519 /// ```ignore,no_run
9520 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9521 /// use google_cloud_dataproc_v1::model::diagnose_cluster_request::TarballAccess;
9522 /// let x0 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleCloudSupport);
9523 /// let x1 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleDataprocDiagnose);
9524 /// ```
9525 pub fn set_tarball_access<
9526 T: std::convert::Into<crate::model::diagnose_cluster_request::TarballAccess>,
9527 >(
9528 mut self,
9529 v: T,
9530 ) -> Self {
9531 self.tarball_access = v.into();
9532 self
9533 }
9534
9535 /// Sets the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
9536 ///
9537 /// # Example
9538 /// ```ignore,no_run
9539 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9540 /// use google_cloud_type::model::Interval;
9541 /// let x = DiagnoseClusterRequest::new().set_diagnosis_interval(Interval::default()/* use setters */);
9542 /// ```
9543 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
9544 where
9545 T: std::convert::Into<google_cloud_type::model::Interval>,
9546 {
9547 self.diagnosis_interval = std::option::Option::Some(v.into());
9548 self
9549 }
9550
9551 /// Sets or clears the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
9552 ///
9553 /// # Example
9554 /// ```ignore,no_run
9555 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9556 /// use google_cloud_type::model::Interval;
9557 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(Some(Interval::default()/* use setters */));
9558 /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(None::<Interval>);
9559 /// ```
9560 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
9561 where
9562 T: std::convert::Into<google_cloud_type::model::Interval>,
9563 {
9564 self.diagnosis_interval = v.map(|x| x.into());
9565 self
9566 }
9567
9568 /// Sets the value of [jobs][crate::model::DiagnoseClusterRequest::jobs].
9569 ///
9570 /// # Example
9571 /// ```ignore,no_run
9572 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9573 /// let x = DiagnoseClusterRequest::new().set_jobs(["a", "b", "c"]);
9574 /// ```
9575 pub fn set_jobs<T, V>(mut self, v: T) -> Self
9576 where
9577 T: std::iter::IntoIterator<Item = V>,
9578 V: std::convert::Into<std::string::String>,
9579 {
9580 use std::iter::Iterator;
9581 self.jobs = v.into_iter().map(|i| i.into()).collect();
9582 self
9583 }
9584
9585 /// Sets the value of [yarn_application_ids][crate::model::DiagnoseClusterRequest::yarn_application_ids].
9586 ///
9587 /// # Example
9588 /// ```ignore,no_run
9589 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9590 /// let x = DiagnoseClusterRequest::new().set_yarn_application_ids(["a", "b", "c"]);
9591 /// ```
9592 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
9593 where
9594 T: std::iter::IntoIterator<Item = V>,
9595 V: std::convert::Into<std::string::String>,
9596 {
9597 use std::iter::Iterator;
9598 self.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
9599 self
9600 }
9601}
9602
9603impl wkt::message::Message for DiagnoseClusterRequest {
9604 fn typename() -> &'static str {
9605 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterRequest"
9606 }
9607}
9608
9609/// Defines additional types related to [DiagnoseClusterRequest].
9610pub mod diagnose_cluster_request {
9611 #[allow(unused_imports)]
9612 use super::*;
9613
9614 /// Defines who has access to the diagnostic tarball
9615 ///
9616 /// # Working with unknown values
9617 ///
9618 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9619 /// additional enum variants at any time. Adding new variants is not considered
9620 /// a breaking change. Applications should write their code in anticipation of:
9621 ///
9622 /// - New values appearing in future releases of the client library, **and**
9623 /// - New values received dynamically, without application changes.
9624 ///
9625 /// Please consult the [Working with enums] section in the user guide for some
9626 /// guidelines.
9627 ///
9628 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9629 #[derive(Clone, Debug, PartialEq)]
9630 #[non_exhaustive]
9631 pub enum TarballAccess {
9632 /// Tarball Access unspecified. Falls back to default access of the bucket
9633 Unspecified,
9634 /// Google Cloud Support group has read access to the
9635 /// diagnostic tarball
9636 GoogleCloudSupport,
9637 /// Google Cloud Dataproc Diagnose service account has read access to the
9638 /// diagnostic tarball
9639 GoogleDataprocDiagnose,
9640 /// If set, the enum was initialized with an unknown value.
9641 ///
9642 /// Applications can examine the value using [TarballAccess::value] or
9643 /// [TarballAccess::name].
9644 UnknownValue(tarball_access::UnknownValue),
9645 }
9646
9647 #[doc(hidden)]
9648 pub mod tarball_access {
9649 #[allow(unused_imports)]
9650 use super::*;
9651 #[derive(Clone, Debug, PartialEq)]
9652 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9653 }
9654
9655 impl TarballAccess {
9656 /// Gets the enum value.
9657 ///
9658 /// Returns `None` if the enum contains an unknown value deserialized from
9659 /// the string representation of enums.
9660 pub fn value(&self) -> std::option::Option<i32> {
9661 match self {
9662 Self::Unspecified => std::option::Option::Some(0),
9663 Self::GoogleCloudSupport => std::option::Option::Some(1),
9664 Self::GoogleDataprocDiagnose => std::option::Option::Some(2),
9665 Self::UnknownValue(u) => u.0.value(),
9666 }
9667 }
9668
9669 /// Gets the enum value as a string.
9670 ///
9671 /// Returns `None` if the enum contains an unknown value deserialized from
9672 /// the integer representation of enums.
9673 pub fn name(&self) -> std::option::Option<&str> {
9674 match self {
9675 Self::Unspecified => std::option::Option::Some("TARBALL_ACCESS_UNSPECIFIED"),
9676 Self::GoogleCloudSupport => std::option::Option::Some("GOOGLE_CLOUD_SUPPORT"),
9677 Self::GoogleDataprocDiagnose => {
9678 std::option::Option::Some("GOOGLE_DATAPROC_DIAGNOSE")
9679 }
9680 Self::UnknownValue(u) => u.0.name(),
9681 }
9682 }
9683 }
9684
9685 impl std::default::Default for TarballAccess {
9686 fn default() -> Self {
9687 use std::convert::From;
9688 Self::from(0)
9689 }
9690 }
9691
9692 impl std::fmt::Display for TarballAccess {
9693 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9694 wkt::internal::display_enum(f, self.name(), self.value())
9695 }
9696 }
9697
9698 impl std::convert::From<i32> for TarballAccess {
9699 fn from(value: i32) -> Self {
9700 match value {
9701 0 => Self::Unspecified,
9702 1 => Self::GoogleCloudSupport,
9703 2 => Self::GoogleDataprocDiagnose,
9704 _ => Self::UnknownValue(tarball_access::UnknownValue(
9705 wkt::internal::UnknownEnumValue::Integer(value),
9706 )),
9707 }
9708 }
9709 }
9710
9711 impl std::convert::From<&str> for TarballAccess {
9712 fn from(value: &str) -> Self {
9713 use std::string::ToString;
9714 match value {
9715 "TARBALL_ACCESS_UNSPECIFIED" => Self::Unspecified,
9716 "GOOGLE_CLOUD_SUPPORT" => Self::GoogleCloudSupport,
9717 "GOOGLE_DATAPROC_DIAGNOSE" => Self::GoogleDataprocDiagnose,
9718 _ => Self::UnknownValue(tarball_access::UnknownValue(
9719 wkt::internal::UnknownEnumValue::String(value.to_string()),
9720 )),
9721 }
9722 }
9723 }
9724
9725 impl serde::ser::Serialize for TarballAccess {
9726 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9727 where
9728 S: serde::Serializer,
9729 {
9730 match self {
9731 Self::Unspecified => serializer.serialize_i32(0),
9732 Self::GoogleCloudSupport => serializer.serialize_i32(1),
9733 Self::GoogleDataprocDiagnose => serializer.serialize_i32(2),
9734 Self::UnknownValue(u) => u.0.serialize(serializer),
9735 }
9736 }
9737 }
9738
9739 impl<'de> serde::de::Deserialize<'de> for TarballAccess {
9740 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9741 where
9742 D: serde::Deserializer<'de>,
9743 {
9744 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TarballAccess>::new(
9745 ".google.cloud.dataproc.v1.DiagnoseClusterRequest.TarballAccess",
9746 ))
9747 }
9748 }
9749}
9750
9751/// The location of diagnostic output.
9752#[derive(Clone, Default, PartialEq)]
9753#[non_exhaustive]
9754pub struct DiagnoseClusterResults {
9755 /// Output only. The Cloud Storage URI of the diagnostic output.
9756 /// The output report is a plain text file with a summary of collected
9757 /// diagnostics.
9758 pub output_uri: std::string::String,
9759
9760 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9761}
9762
9763impl DiagnoseClusterResults {
9764 pub fn new() -> Self {
9765 std::default::Default::default()
9766 }
9767
9768 /// Sets the value of [output_uri][crate::model::DiagnoseClusterResults::output_uri].
9769 ///
9770 /// # Example
9771 /// ```ignore,no_run
9772 /// # use google_cloud_dataproc_v1::model::DiagnoseClusterResults;
9773 /// let x = DiagnoseClusterResults::new().set_output_uri("example");
9774 /// ```
9775 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9776 self.output_uri = v.into();
9777 self
9778 }
9779}
9780
9781impl wkt::message::Message for DiagnoseClusterResults {
9782 fn typename() -> &'static str {
9783 "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterResults"
9784 }
9785}
9786
9787/// Reservation Affinity for consuming Zonal reservation.
9788#[derive(Clone, Default, PartialEq)]
9789#[non_exhaustive]
9790pub struct ReservationAffinity {
9791 /// Optional. Type of reservation to consume
9792 pub consume_reservation_type: crate::model::reservation_affinity::Type,
9793
9794 /// Optional. Corresponds to the label key of reservation resource.
9795 pub key: std::string::String,
9796
9797 /// Optional. Corresponds to the label values of reservation resource.
9798 pub values: std::vec::Vec<std::string::String>,
9799
9800 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9801}
9802
9803impl ReservationAffinity {
9804 pub fn new() -> Self {
9805 std::default::Default::default()
9806 }
9807
9808 /// Sets the value of [consume_reservation_type][crate::model::ReservationAffinity::consume_reservation_type].
9809 ///
9810 /// # Example
9811 /// ```ignore,no_run
9812 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
9813 /// use google_cloud_dataproc_v1::model::reservation_affinity::Type;
9814 /// let x0 = ReservationAffinity::new().set_consume_reservation_type(Type::NoReservation);
9815 /// let x1 = ReservationAffinity::new().set_consume_reservation_type(Type::AnyReservation);
9816 /// let x2 = ReservationAffinity::new().set_consume_reservation_type(Type::SpecificReservation);
9817 /// ```
9818 pub fn set_consume_reservation_type<
9819 T: std::convert::Into<crate::model::reservation_affinity::Type>,
9820 >(
9821 mut self,
9822 v: T,
9823 ) -> Self {
9824 self.consume_reservation_type = v.into();
9825 self
9826 }
9827
9828 /// Sets the value of [key][crate::model::ReservationAffinity::key].
9829 ///
9830 /// # Example
9831 /// ```ignore,no_run
9832 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
9833 /// let x = ReservationAffinity::new().set_key("example");
9834 /// ```
9835 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9836 self.key = v.into();
9837 self
9838 }
9839
9840 /// Sets the value of [values][crate::model::ReservationAffinity::values].
9841 ///
9842 /// # Example
9843 /// ```ignore,no_run
9844 /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
9845 /// let x = ReservationAffinity::new().set_values(["a", "b", "c"]);
9846 /// ```
9847 pub fn set_values<T, V>(mut self, v: T) -> Self
9848 where
9849 T: std::iter::IntoIterator<Item = V>,
9850 V: std::convert::Into<std::string::String>,
9851 {
9852 use std::iter::Iterator;
9853 self.values = v.into_iter().map(|i| i.into()).collect();
9854 self
9855 }
9856}
9857
9858impl wkt::message::Message for ReservationAffinity {
9859 fn typename() -> &'static str {
9860 "type.googleapis.com/google.cloud.dataproc.v1.ReservationAffinity"
9861 }
9862}
9863
9864/// Defines additional types related to [ReservationAffinity].
9865pub mod reservation_affinity {
9866 #[allow(unused_imports)]
9867 use super::*;
9868
9869 /// Indicates whether to consume capacity from an reservation or not.
9870 ///
9871 /// # Working with unknown values
9872 ///
9873 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9874 /// additional enum variants at any time. Adding new variants is not considered
9875 /// a breaking change. Applications should write their code in anticipation of:
9876 ///
9877 /// - New values appearing in future releases of the client library, **and**
9878 /// - New values received dynamically, without application changes.
9879 ///
9880 /// Please consult the [Working with enums] section in the user guide for some
9881 /// guidelines.
9882 ///
9883 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9884 #[derive(Clone, Debug, PartialEq)]
9885 #[non_exhaustive]
9886 pub enum Type {
9887 Unspecified,
9888 /// Do not consume from any allocated capacity.
9889 NoReservation,
9890 /// Consume any reservation available.
9891 AnyReservation,
9892 /// Must consume from a specific reservation. Must specify key value fields
9893 /// for specifying the reservations.
9894 SpecificReservation,
9895 /// If set, the enum was initialized with an unknown value.
9896 ///
9897 /// Applications can examine the value using [Type::value] or
9898 /// [Type::name].
9899 UnknownValue(r#type::UnknownValue),
9900 }
9901
9902 #[doc(hidden)]
9903 pub mod r#type {
9904 #[allow(unused_imports)]
9905 use super::*;
9906 #[derive(Clone, Debug, PartialEq)]
9907 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9908 }
9909
9910 impl Type {
9911 /// Gets the enum value.
9912 ///
9913 /// Returns `None` if the enum contains an unknown value deserialized from
9914 /// the string representation of enums.
9915 pub fn value(&self) -> std::option::Option<i32> {
9916 match self {
9917 Self::Unspecified => std::option::Option::Some(0),
9918 Self::NoReservation => std::option::Option::Some(1),
9919 Self::AnyReservation => std::option::Option::Some(2),
9920 Self::SpecificReservation => std::option::Option::Some(3),
9921 Self::UnknownValue(u) => u.0.value(),
9922 }
9923 }
9924
9925 /// Gets the enum value as a string.
9926 ///
9927 /// Returns `None` if the enum contains an unknown value deserialized from
9928 /// the integer representation of enums.
9929 pub fn name(&self) -> std::option::Option<&str> {
9930 match self {
9931 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
9932 Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
9933 Self::AnyReservation => std::option::Option::Some("ANY_RESERVATION"),
9934 Self::SpecificReservation => std::option::Option::Some("SPECIFIC_RESERVATION"),
9935 Self::UnknownValue(u) => u.0.name(),
9936 }
9937 }
9938 }
9939
9940 impl std::default::Default for Type {
9941 fn default() -> Self {
9942 use std::convert::From;
9943 Self::from(0)
9944 }
9945 }
9946
9947 impl std::fmt::Display for Type {
9948 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9949 wkt::internal::display_enum(f, self.name(), self.value())
9950 }
9951 }
9952
9953 impl std::convert::From<i32> for Type {
9954 fn from(value: i32) -> Self {
9955 match value {
9956 0 => Self::Unspecified,
9957 1 => Self::NoReservation,
9958 2 => Self::AnyReservation,
9959 3 => Self::SpecificReservation,
9960 _ => Self::UnknownValue(r#type::UnknownValue(
9961 wkt::internal::UnknownEnumValue::Integer(value),
9962 )),
9963 }
9964 }
9965 }
9966
9967 impl std::convert::From<&str> for Type {
9968 fn from(value: &str) -> Self {
9969 use std::string::ToString;
9970 match value {
9971 "TYPE_UNSPECIFIED" => Self::Unspecified,
9972 "NO_RESERVATION" => Self::NoReservation,
9973 "ANY_RESERVATION" => Self::AnyReservation,
9974 "SPECIFIC_RESERVATION" => Self::SpecificReservation,
9975 _ => Self::UnknownValue(r#type::UnknownValue(
9976 wkt::internal::UnknownEnumValue::String(value.to_string()),
9977 )),
9978 }
9979 }
9980 }
9981
9982 impl serde::ser::Serialize for Type {
9983 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9984 where
9985 S: serde::Serializer,
9986 {
9987 match self {
9988 Self::Unspecified => serializer.serialize_i32(0),
9989 Self::NoReservation => serializer.serialize_i32(1),
9990 Self::AnyReservation => serializer.serialize_i32(2),
9991 Self::SpecificReservation => serializer.serialize_i32(3),
9992 Self::UnknownValue(u) => u.0.serialize(serializer),
9993 }
9994 }
9995 }
9996
9997 impl<'de> serde::de::Deserialize<'de> for Type {
9998 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9999 where
10000 D: serde::Deserializer<'de>,
10001 {
10002 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
10003 ".google.cloud.dataproc.v1.ReservationAffinity.Type",
10004 ))
10005 }
10006 }
10007}
10008
10009/// The runtime logging config of the job.
10010#[derive(Clone, Default, PartialEq)]
10011#[non_exhaustive]
10012pub struct LoggingConfig {
10013 /// The per-package log levels for the driver. This can include
10014 /// "root" package name to configure rootLogger.
10015 /// Examples:
10016 ///
10017 /// - 'com.google = FATAL'
10018 /// - 'root = INFO'
10019 /// - 'org.apache = DEBUG'
10020 pub driver_log_levels:
10021 std::collections::HashMap<std::string::String, crate::model::logging_config::Level>,
10022
10023 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10024}
10025
10026impl LoggingConfig {
10027 pub fn new() -> Self {
10028 std::default::Default::default()
10029 }
10030
10031 /// Sets the value of [driver_log_levels][crate::model::LoggingConfig::driver_log_levels].
10032 ///
10033 /// # Example
10034 /// ```ignore,no_run
10035 /// # use google_cloud_dataproc_v1::model::LoggingConfig;
10036 /// use google_cloud_dataproc_v1::model::logging_config::Level;
10037 /// let x = LoggingConfig::new().set_driver_log_levels([
10038 /// ("key0", Level::All),
10039 /// ("key1", Level::Trace),
10040 /// ("key2", Level::Debug),
10041 /// ]);
10042 /// ```
10043 pub fn set_driver_log_levels<T, K, V>(mut self, v: T) -> Self
10044 where
10045 T: std::iter::IntoIterator<Item = (K, V)>,
10046 K: std::convert::Into<std::string::String>,
10047 V: std::convert::Into<crate::model::logging_config::Level>,
10048 {
10049 use std::iter::Iterator;
10050 self.driver_log_levels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10051 self
10052 }
10053}
10054
10055impl wkt::message::Message for LoggingConfig {
10056 fn typename() -> &'static str {
10057 "type.googleapis.com/google.cloud.dataproc.v1.LoggingConfig"
10058 }
10059}
10060
10061/// Defines additional types related to [LoggingConfig].
10062pub mod logging_config {
10063 #[allow(unused_imports)]
10064 use super::*;
10065
10066 /// The Log4j level for job execution. When running an
10067 /// [Apache Hive](https://hive.apache.org/) job, Cloud
10068 /// Dataproc configures the Hive client to an equivalent verbosity level.
10069 ///
10070 /// # Working with unknown values
10071 ///
10072 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10073 /// additional enum variants at any time. Adding new variants is not considered
10074 /// a breaking change. Applications should write their code in anticipation of:
10075 ///
10076 /// - New values appearing in future releases of the client library, **and**
10077 /// - New values received dynamically, without application changes.
10078 ///
10079 /// Please consult the [Working with enums] section in the user guide for some
10080 /// guidelines.
10081 ///
10082 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10083 #[derive(Clone, Debug, PartialEq)]
10084 #[non_exhaustive]
10085 pub enum Level {
10086 /// Level is unspecified. Use default level for log4j.
10087 Unspecified,
10088 /// Use ALL level for log4j.
10089 All,
10090 /// Use TRACE level for log4j.
10091 Trace,
10092 /// Use DEBUG level for log4j.
10093 Debug,
10094 /// Use INFO level for log4j.
10095 Info,
10096 /// Use WARN level for log4j.
10097 Warn,
10098 /// Use ERROR level for log4j.
10099 Error,
10100 /// Use FATAL level for log4j.
10101 Fatal,
10102 /// Turn off log4j.
10103 Off,
10104 /// If set, the enum was initialized with an unknown value.
10105 ///
10106 /// Applications can examine the value using [Level::value] or
10107 /// [Level::name].
10108 UnknownValue(level::UnknownValue),
10109 }
10110
10111 #[doc(hidden)]
10112 pub mod level {
10113 #[allow(unused_imports)]
10114 use super::*;
10115 #[derive(Clone, Debug, PartialEq)]
10116 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10117 }
10118
10119 impl Level {
10120 /// Gets the enum value.
10121 ///
10122 /// Returns `None` if the enum contains an unknown value deserialized from
10123 /// the string representation of enums.
10124 pub fn value(&self) -> std::option::Option<i32> {
10125 match self {
10126 Self::Unspecified => std::option::Option::Some(0),
10127 Self::All => std::option::Option::Some(1),
10128 Self::Trace => std::option::Option::Some(2),
10129 Self::Debug => std::option::Option::Some(3),
10130 Self::Info => std::option::Option::Some(4),
10131 Self::Warn => std::option::Option::Some(5),
10132 Self::Error => std::option::Option::Some(6),
10133 Self::Fatal => std::option::Option::Some(7),
10134 Self::Off => std::option::Option::Some(8),
10135 Self::UnknownValue(u) => u.0.value(),
10136 }
10137 }
10138
10139 /// Gets the enum value as a string.
10140 ///
10141 /// Returns `None` if the enum contains an unknown value deserialized from
10142 /// the integer representation of enums.
10143 pub fn name(&self) -> std::option::Option<&str> {
10144 match self {
10145 Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
10146 Self::All => std::option::Option::Some("ALL"),
10147 Self::Trace => std::option::Option::Some("TRACE"),
10148 Self::Debug => std::option::Option::Some("DEBUG"),
10149 Self::Info => std::option::Option::Some("INFO"),
10150 Self::Warn => std::option::Option::Some("WARN"),
10151 Self::Error => std::option::Option::Some("ERROR"),
10152 Self::Fatal => std::option::Option::Some("FATAL"),
10153 Self::Off => std::option::Option::Some("OFF"),
10154 Self::UnknownValue(u) => u.0.name(),
10155 }
10156 }
10157 }
10158
10159 impl std::default::Default for Level {
10160 fn default() -> Self {
10161 use std::convert::From;
10162 Self::from(0)
10163 }
10164 }
10165
10166 impl std::fmt::Display for Level {
10167 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10168 wkt::internal::display_enum(f, self.name(), self.value())
10169 }
10170 }
10171
10172 impl std::convert::From<i32> for Level {
10173 fn from(value: i32) -> Self {
10174 match value {
10175 0 => Self::Unspecified,
10176 1 => Self::All,
10177 2 => Self::Trace,
10178 3 => Self::Debug,
10179 4 => Self::Info,
10180 5 => Self::Warn,
10181 6 => Self::Error,
10182 7 => Self::Fatal,
10183 8 => Self::Off,
10184 _ => Self::UnknownValue(level::UnknownValue(
10185 wkt::internal::UnknownEnumValue::Integer(value),
10186 )),
10187 }
10188 }
10189 }
10190
10191 impl std::convert::From<&str> for Level {
10192 fn from(value: &str) -> Self {
10193 use std::string::ToString;
10194 match value {
10195 "LEVEL_UNSPECIFIED" => Self::Unspecified,
10196 "ALL" => Self::All,
10197 "TRACE" => Self::Trace,
10198 "DEBUG" => Self::Debug,
10199 "INFO" => Self::Info,
10200 "WARN" => Self::Warn,
10201 "ERROR" => Self::Error,
10202 "FATAL" => Self::Fatal,
10203 "OFF" => Self::Off,
10204 _ => Self::UnknownValue(level::UnknownValue(
10205 wkt::internal::UnknownEnumValue::String(value.to_string()),
10206 )),
10207 }
10208 }
10209 }
10210
10211 impl serde::ser::Serialize for Level {
10212 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10213 where
10214 S: serde::Serializer,
10215 {
10216 match self {
10217 Self::Unspecified => serializer.serialize_i32(0),
10218 Self::All => serializer.serialize_i32(1),
10219 Self::Trace => serializer.serialize_i32(2),
10220 Self::Debug => serializer.serialize_i32(3),
10221 Self::Info => serializer.serialize_i32(4),
10222 Self::Warn => serializer.serialize_i32(5),
10223 Self::Error => serializer.serialize_i32(6),
10224 Self::Fatal => serializer.serialize_i32(7),
10225 Self::Off => serializer.serialize_i32(8),
10226 Self::UnknownValue(u) => u.0.serialize(serializer),
10227 }
10228 }
10229 }
10230
10231 impl<'de> serde::de::Deserialize<'de> for Level {
10232 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10233 where
10234 D: serde::Deserializer<'de>,
10235 {
10236 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
10237 ".google.cloud.dataproc.v1.LoggingConfig.Level",
10238 ))
10239 }
10240 }
10241}
10242
10243/// A Dataproc job for running
10244/// [Apache Hadoop
10245/// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html)
10246/// jobs on [Apache Hadoop
10247/// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).
10248#[derive(Clone, Default, PartialEq)]
10249#[non_exhaustive]
10250pub struct HadoopJob {
10251 /// Optional. The arguments to pass to the driver. Do not
10252 /// include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as
10253 /// job properties, since a collision might occur that causes an incorrect job
10254 /// submission.
10255 pub args: std::vec::Vec<std::string::String>,
10256
10257 /// Optional. Jar file URIs to add to the CLASSPATHs of the
10258 /// Hadoop driver and tasks.
10259 pub jar_file_uris: std::vec::Vec<std::string::String>,
10260
10261 /// Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied
10262 /// to the working directory of Hadoop drivers and distributed tasks. Useful
10263 /// for naively parallel tasks.
10264 pub file_uris: std::vec::Vec<std::string::String>,
10265
10266 /// Optional. HCFS URIs of archives to be extracted in the working directory of
10267 /// Hadoop drivers and tasks. Supported file types:
10268 /// .jar, .tar, .tar.gz, .tgz, or .zip.
10269 pub archive_uris: std::vec::Vec<std::string::String>,
10270
10271 /// Optional. A mapping of property names to values, used to configure Hadoop.
10272 /// Properties that conflict with values set by the Dataproc API might be
10273 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and
10274 /// classes in user code.
10275 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10276
10277 /// Optional. The runtime log config for job execution.
10278 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10279
10280 /// Required. Indicates the location of the driver's main class. Specify
10281 /// either the jar file that contains the main class or the main class name.
10282 /// To specify both, add the jar file to `jar_file_uris`, and then specify
10283 /// the main class name in this property.
10284 pub driver: std::option::Option<crate::model::hadoop_job::Driver>,
10285
10286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10287}
10288
10289impl HadoopJob {
10290 pub fn new() -> Self {
10291 std::default::Default::default()
10292 }
10293
10294 /// Sets the value of [args][crate::model::HadoopJob::args].
10295 ///
10296 /// # Example
10297 /// ```ignore,no_run
10298 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10299 /// let x = HadoopJob::new().set_args(["a", "b", "c"]);
10300 /// ```
10301 pub fn set_args<T, V>(mut self, v: T) -> Self
10302 where
10303 T: std::iter::IntoIterator<Item = V>,
10304 V: std::convert::Into<std::string::String>,
10305 {
10306 use std::iter::Iterator;
10307 self.args = v.into_iter().map(|i| i.into()).collect();
10308 self
10309 }
10310
10311 /// Sets the value of [jar_file_uris][crate::model::HadoopJob::jar_file_uris].
10312 ///
10313 /// # Example
10314 /// ```ignore,no_run
10315 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10316 /// let x = HadoopJob::new().set_jar_file_uris(["a", "b", "c"]);
10317 /// ```
10318 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10319 where
10320 T: std::iter::IntoIterator<Item = V>,
10321 V: std::convert::Into<std::string::String>,
10322 {
10323 use std::iter::Iterator;
10324 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10325 self
10326 }
10327
10328 /// Sets the value of [file_uris][crate::model::HadoopJob::file_uris].
10329 ///
10330 /// # Example
10331 /// ```ignore,no_run
10332 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10333 /// let x = HadoopJob::new().set_file_uris(["a", "b", "c"]);
10334 /// ```
10335 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10336 where
10337 T: std::iter::IntoIterator<Item = V>,
10338 V: std::convert::Into<std::string::String>,
10339 {
10340 use std::iter::Iterator;
10341 self.file_uris = v.into_iter().map(|i| i.into()).collect();
10342 self
10343 }
10344
10345 /// Sets the value of [archive_uris][crate::model::HadoopJob::archive_uris].
10346 ///
10347 /// # Example
10348 /// ```ignore,no_run
10349 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10350 /// let x = HadoopJob::new().set_archive_uris(["a", "b", "c"]);
10351 /// ```
10352 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10353 where
10354 T: std::iter::IntoIterator<Item = V>,
10355 V: std::convert::Into<std::string::String>,
10356 {
10357 use std::iter::Iterator;
10358 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10359 self
10360 }
10361
10362 /// Sets the value of [properties][crate::model::HadoopJob::properties].
10363 ///
10364 /// # Example
10365 /// ```ignore,no_run
10366 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10367 /// let x = HadoopJob::new().set_properties([
10368 /// ("key0", "abc"),
10369 /// ("key1", "xyz"),
10370 /// ]);
10371 /// ```
10372 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10373 where
10374 T: std::iter::IntoIterator<Item = (K, V)>,
10375 K: std::convert::Into<std::string::String>,
10376 V: std::convert::Into<std::string::String>,
10377 {
10378 use std::iter::Iterator;
10379 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10380 self
10381 }
10382
10383 /// Sets the value of [logging_config][crate::model::HadoopJob::logging_config].
10384 ///
10385 /// # Example
10386 /// ```ignore,no_run
10387 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10388 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10389 /// let x = HadoopJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10390 /// ```
10391 pub fn set_logging_config<T>(mut self, v: T) -> Self
10392 where
10393 T: std::convert::Into<crate::model::LoggingConfig>,
10394 {
10395 self.logging_config = std::option::Option::Some(v.into());
10396 self
10397 }
10398
10399 /// Sets or clears the value of [logging_config][crate::model::HadoopJob::logging_config].
10400 ///
10401 /// # Example
10402 /// ```ignore,no_run
10403 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10404 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10405 /// let x = HadoopJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
10406 /// let x = HadoopJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
10407 /// ```
10408 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
10409 where
10410 T: std::convert::Into<crate::model::LoggingConfig>,
10411 {
10412 self.logging_config = v.map(|x| x.into());
10413 self
10414 }
10415
10416 /// Sets the value of [driver][crate::model::HadoopJob::driver].
10417 ///
10418 /// Note that all the setters affecting `driver` are mutually
10419 /// exclusive.
10420 ///
10421 /// # Example
10422 /// ```ignore,no_run
10423 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10424 /// use google_cloud_dataproc_v1::model::hadoop_job::Driver;
10425 /// let x = HadoopJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
10426 /// ```
10427 pub fn set_driver<
10428 T: std::convert::Into<std::option::Option<crate::model::hadoop_job::Driver>>,
10429 >(
10430 mut self,
10431 v: T,
10432 ) -> Self {
10433 self.driver = v.into();
10434 self
10435 }
10436
10437 /// The value of [driver][crate::model::HadoopJob::driver]
10438 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
10439 /// holds a different branch.
10440 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
10441 #[allow(unreachable_patterns)]
10442 self.driver.as_ref().and_then(|v| match v {
10443 crate::model::hadoop_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
10444 _ => std::option::Option::None,
10445 })
10446 }
10447
10448 /// Sets the value of [driver][crate::model::HadoopJob::driver]
10449 /// to hold a `MainJarFileUri`.
10450 ///
10451 /// Note that all the setters affecting `driver` are
10452 /// mutually exclusive.
10453 ///
10454 /// # Example
10455 /// ```ignore,no_run
10456 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10457 /// let x = HadoopJob::new().set_main_jar_file_uri("example");
10458 /// assert!(x.main_jar_file_uri().is_some());
10459 /// assert!(x.main_class().is_none());
10460 /// ```
10461 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
10462 mut self,
10463 v: T,
10464 ) -> Self {
10465 self.driver =
10466 std::option::Option::Some(crate::model::hadoop_job::Driver::MainJarFileUri(v.into()));
10467 self
10468 }
10469
10470 /// The value of [driver][crate::model::HadoopJob::driver]
10471 /// if it holds a `MainClass`, `None` if the field is not set or
10472 /// holds a different branch.
10473 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
10474 #[allow(unreachable_patterns)]
10475 self.driver.as_ref().and_then(|v| match v {
10476 crate::model::hadoop_job::Driver::MainClass(v) => std::option::Option::Some(v),
10477 _ => std::option::Option::None,
10478 })
10479 }
10480
10481 /// Sets the value of [driver][crate::model::HadoopJob::driver]
10482 /// to hold a `MainClass`.
10483 ///
10484 /// Note that all the setters affecting `driver` are
10485 /// mutually exclusive.
10486 ///
10487 /// # Example
10488 /// ```ignore,no_run
10489 /// # use google_cloud_dataproc_v1::model::HadoopJob;
10490 /// let x = HadoopJob::new().set_main_class("example");
10491 /// assert!(x.main_class().is_some());
10492 /// assert!(x.main_jar_file_uri().is_none());
10493 /// ```
10494 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10495 self.driver =
10496 std::option::Option::Some(crate::model::hadoop_job::Driver::MainClass(v.into()));
10497 self
10498 }
10499}
10500
10501impl wkt::message::Message for HadoopJob {
10502 fn typename() -> &'static str {
10503 "type.googleapis.com/google.cloud.dataproc.v1.HadoopJob"
10504 }
10505}
10506
10507/// Defines additional types related to [HadoopJob].
10508pub mod hadoop_job {
10509 #[allow(unused_imports)]
10510 use super::*;
10511
10512 /// Required. Indicates the location of the driver's main class. Specify
10513 /// either the jar file that contains the main class or the main class name.
10514 /// To specify both, add the jar file to `jar_file_uris`, and then specify
10515 /// the main class name in this property.
10516 #[derive(Clone, Debug, PartialEq)]
10517 #[non_exhaustive]
10518 pub enum Driver {
10519 /// The HCFS URI of the jar file containing the main class.
10520 /// Examples:
10521 /// 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar'
10522 /// 'hdfs:/tmp/test-samples/custom-wordcount.jar'
10523 /// 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar'
10524 MainJarFileUri(std::string::String),
10525 /// The name of the driver's main class. The jar file containing the class
10526 /// must be in the default CLASSPATH or specified in `jar_file_uris`.
10527 MainClass(std::string::String),
10528 }
10529}
10530
10531/// A Dataproc job for running [Apache Spark](https://spark.apache.org/)
10532/// applications on YARN.
10533#[derive(Clone, Default, PartialEq)]
10534#[non_exhaustive]
10535pub struct SparkJob {
10536 /// Optional. The arguments to pass to the driver. Do not include arguments,
10537 /// such as `--conf`, that can be set as job properties, since a collision may
10538 /// occur that causes an incorrect job submission.
10539 pub args: std::vec::Vec<std::string::String>,
10540
10541 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
10542 /// Spark driver and tasks.
10543 pub jar_file_uris: std::vec::Vec<std::string::String>,
10544
10545 /// Optional. HCFS URIs of files to be placed in the working directory of
10546 /// each executor. Useful for naively parallel tasks.
10547 pub file_uris: std::vec::Vec<std::string::String>,
10548
10549 /// Optional. HCFS URIs of archives to be extracted into the working directory
10550 /// of each executor. Supported file types:
10551 /// .jar, .tar, .tar.gz, .tgz, and .zip.
10552 pub archive_uris: std::vec::Vec<std::string::String>,
10553
10554 /// Optional. A mapping of property names to values, used to configure Spark.
10555 /// Properties that conflict with values set by the Dataproc API might be
10556 /// overwritten. Can include properties set in
10557 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
10558 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10559
10560 /// Optional. The runtime log config for job execution.
10561 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10562
10563 /// Required. The specification of the main method to call to drive the job.
10564 /// Specify either the jar file that contains the main class or the main class
10565 /// name. To pass both a main jar and a main class in that jar, add the jar to
10566 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
10567 /// specify the main class name in
10568 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
10569 ///
10570 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
10571 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
10572 pub driver: std::option::Option<crate::model::spark_job::Driver>,
10573
10574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10575}
10576
10577impl SparkJob {
10578 pub fn new() -> Self {
10579 std::default::Default::default()
10580 }
10581
10582 /// Sets the value of [args][crate::model::SparkJob::args].
10583 ///
10584 /// # Example
10585 /// ```ignore,no_run
10586 /// # use google_cloud_dataproc_v1::model::SparkJob;
10587 /// let x = SparkJob::new().set_args(["a", "b", "c"]);
10588 /// ```
10589 pub fn set_args<T, V>(mut self, v: T) -> Self
10590 where
10591 T: std::iter::IntoIterator<Item = V>,
10592 V: std::convert::Into<std::string::String>,
10593 {
10594 use std::iter::Iterator;
10595 self.args = v.into_iter().map(|i| i.into()).collect();
10596 self
10597 }
10598
10599 /// Sets the value of [jar_file_uris][crate::model::SparkJob::jar_file_uris].
10600 ///
10601 /// # Example
10602 /// ```ignore,no_run
10603 /// # use google_cloud_dataproc_v1::model::SparkJob;
10604 /// let x = SparkJob::new().set_jar_file_uris(["a", "b", "c"]);
10605 /// ```
10606 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10607 where
10608 T: std::iter::IntoIterator<Item = V>,
10609 V: std::convert::Into<std::string::String>,
10610 {
10611 use std::iter::Iterator;
10612 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10613 self
10614 }
10615
10616 /// Sets the value of [file_uris][crate::model::SparkJob::file_uris].
10617 ///
10618 /// # Example
10619 /// ```ignore,no_run
10620 /// # use google_cloud_dataproc_v1::model::SparkJob;
10621 /// let x = SparkJob::new().set_file_uris(["a", "b", "c"]);
10622 /// ```
10623 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10624 where
10625 T: std::iter::IntoIterator<Item = V>,
10626 V: std::convert::Into<std::string::String>,
10627 {
10628 use std::iter::Iterator;
10629 self.file_uris = v.into_iter().map(|i| i.into()).collect();
10630 self
10631 }
10632
10633 /// Sets the value of [archive_uris][crate::model::SparkJob::archive_uris].
10634 ///
10635 /// # Example
10636 /// ```ignore,no_run
10637 /// # use google_cloud_dataproc_v1::model::SparkJob;
10638 /// let x = SparkJob::new().set_archive_uris(["a", "b", "c"]);
10639 /// ```
10640 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10641 where
10642 T: std::iter::IntoIterator<Item = V>,
10643 V: std::convert::Into<std::string::String>,
10644 {
10645 use std::iter::Iterator;
10646 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10647 self
10648 }
10649
10650 /// Sets the value of [properties][crate::model::SparkJob::properties].
10651 ///
10652 /// # Example
10653 /// ```ignore,no_run
10654 /// # use google_cloud_dataproc_v1::model::SparkJob;
10655 /// let x = SparkJob::new().set_properties([
10656 /// ("key0", "abc"),
10657 /// ("key1", "xyz"),
10658 /// ]);
10659 /// ```
10660 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10661 where
10662 T: std::iter::IntoIterator<Item = (K, V)>,
10663 K: std::convert::Into<std::string::String>,
10664 V: std::convert::Into<std::string::String>,
10665 {
10666 use std::iter::Iterator;
10667 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10668 self
10669 }
10670
10671 /// Sets the value of [logging_config][crate::model::SparkJob::logging_config].
10672 ///
10673 /// # Example
10674 /// ```ignore,no_run
10675 /// # use google_cloud_dataproc_v1::model::SparkJob;
10676 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10677 /// let x = SparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10678 /// ```
10679 pub fn set_logging_config<T>(mut self, v: T) -> Self
10680 where
10681 T: std::convert::Into<crate::model::LoggingConfig>,
10682 {
10683 self.logging_config = std::option::Option::Some(v.into());
10684 self
10685 }
10686
10687 /// Sets or clears the value of [logging_config][crate::model::SparkJob::logging_config].
10688 ///
10689 /// # Example
10690 /// ```ignore,no_run
10691 /// # use google_cloud_dataproc_v1::model::SparkJob;
10692 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10693 /// let x = SparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
10694 /// let x = SparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
10695 /// ```
10696 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
10697 where
10698 T: std::convert::Into<crate::model::LoggingConfig>,
10699 {
10700 self.logging_config = v.map(|x| x.into());
10701 self
10702 }
10703
10704 /// Sets the value of [driver][crate::model::SparkJob::driver].
10705 ///
10706 /// Note that all the setters affecting `driver` are mutually
10707 /// exclusive.
10708 ///
10709 /// # Example
10710 /// ```ignore,no_run
10711 /// # use google_cloud_dataproc_v1::model::SparkJob;
10712 /// use google_cloud_dataproc_v1::model::spark_job::Driver;
10713 /// let x = SparkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
10714 /// ```
10715 pub fn set_driver<
10716 T: std::convert::Into<std::option::Option<crate::model::spark_job::Driver>>,
10717 >(
10718 mut self,
10719 v: T,
10720 ) -> Self {
10721 self.driver = v.into();
10722 self
10723 }
10724
10725 /// The value of [driver][crate::model::SparkJob::driver]
10726 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
10727 /// holds a different branch.
10728 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
10729 #[allow(unreachable_patterns)]
10730 self.driver.as_ref().and_then(|v| match v {
10731 crate::model::spark_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
10732 _ => std::option::Option::None,
10733 })
10734 }
10735
10736 /// Sets the value of [driver][crate::model::SparkJob::driver]
10737 /// to hold a `MainJarFileUri`.
10738 ///
10739 /// Note that all the setters affecting `driver` are
10740 /// mutually exclusive.
10741 ///
10742 /// # Example
10743 /// ```ignore,no_run
10744 /// # use google_cloud_dataproc_v1::model::SparkJob;
10745 /// let x = SparkJob::new().set_main_jar_file_uri("example");
10746 /// assert!(x.main_jar_file_uri().is_some());
10747 /// assert!(x.main_class().is_none());
10748 /// ```
10749 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
10750 mut self,
10751 v: T,
10752 ) -> Self {
10753 self.driver =
10754 std::option::Option::Some(crate::model::spark_job::Driver::MainJarFileUri(v.into()));
10755 self
10756 }
10757
10758 /// The value of [driver][crate::model::SparkJob::driver]
10759 /// if it holds a `MainClass`, `None` if the field is not set or
10760 /// holds a different branch.
10761 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
10762 #[allow(unreachable_patterns)]
10763 self.driver.as_ref().and_then(|v| match v {
10764 crate::model::spark_job::Driver::MainClass(v) => std::option::Option::Some(v),
10765 _ => std::option::Option::None,
10766 })
10767 }
10768
10769 /// Sets the value of [driver][crate::model::SparkJob::driver]
10770 /// to hold a `MainClass`.
10771 ///
10772 /// Note that all the setters affecting `driver` are
10773 /// mutually exclusive.
10774 ///
10775 /// # Example
10776 /// ```ignore,no_run
10777 /// # use google_cloud_dataproc_v1::model::SparkJob;
10778 /// let x = SparkJob::new().set_main_class("example");
10779 /// assert!(x.main_class().is_some());
10780 /// assert!(x.main_jar_file_uri().is_none());
10781 /// ```
10782 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10783 self.driver =
10784 std::option::Option::Some(crate::model::spark_job::Driver::MainClass(v.into()));
10785 self
10786 }
10787}
10788
10789impl wkt::message::Message for SparkJob {
10790 fn typename() -> &'static str {
10791 "type.googleapis.com/google.cloud.dataproc.v1.SparkJob"
10792 }
10793}
10794
10795/// Defines additional types related to [SparkJob].
10796pub mod spark_job {
10797 #[allow(unused_imports)]
10798 use super::*;
10799
10800 /// Required. The specification of the main method to call to drive the job.
10801 /// Specify either the jar file that contains the main class or the main class
10802 /// name. To pass both a main jar and a main class in that jar, add the jar to
10803 /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
10804 /// specify the main class name in
10805 /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
10806 ///
10807 /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
10808 /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
10809 #[derive(Clone, Debug, PartialEq)]
10810 #[non_exhaustive]
10811 pub enum Driver {
10812 /// The HCFS URI of the jar file that contains the main class.
10813 MainJarFileUri(std::string::String),
10814 /// The name of the driver's main class. The jar file that contains the class
10815 /// must be in the default CLASSPATH or specified in
10816 /// SparkJob.jar_file_uris.
10817 MainClass(std::string::String),
10818 }
10819}
10820
10821/// A Dataproc job for running
10822/// [Apache
10823/// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html)
10824/// applications on YARN.
10825#[derive(Clone, Default, PartialEq)]
10826#[non_exhaustive]
10827pub struct PySparkJob {
10828 /// Required. The HCFS URI of the main Python file to use as the driver. Must
10829 /// be a .py file.
10830 pub main_python_file_uri: std::string::String,
10831
10832 /// Optional. The arguments to pass to the driver. Do not include arguments,
10833 /// such as `--conf`, that can be set as job properties, since a collision may
10834 /// occur that causes an incorrect job submission.
10835 pub args: std::vec::Vec<std::string::String>,
10836
10837 /// Optional. HCFS file URIs of Python files to pass to the PySpark
10838 /// framework. Supported file types: .py, .egg, and .zip.
10839 pub python_file_uris: std::vec::Vec<std::string::String>,
10840
10841 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
10842 /// Python driver and tasks.
10843 pub jar_file_uris: std::vec::Vec<std::string::String>,
10844
10845 /// Optional. HCFS URIs of files to be placed in the working directory of
10846 /// each executor. Useful for naively parallel tasks.
10847 pub file_uris: std::vec::Vec<std::string::String>,
10848
10849 /// Optional. HCFS URIs of archives to be extracted into the working directory
10850 /// of each executor. Supported file types:
10851 /// .jar, .tar, .tar.gz, .tgz, and .zip.
10852 pub archive_uris: std::vec::Vec<std::string::String>,
10853
10854 /// Optional. A mapping of property names to values, used to configure PySpark.
10855 /// Properties that conflict with values set by the Dataproc API might be
10856 /// overwritten. Can include properties set in
10857 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
10858 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10859
10860 /// Optional. The runtime log config for job execution.
10861 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10862
10863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10864}
10865
10866impl PySparkJob {
10867 pub fn new() -> Self {
10868 std::default::Default::default()
10869 }
10870
10871 /// Sets the value of [main_python_file_uri][crate::model::PySparkJob::main_python_file_uri].
10872 ///
10873 /// # Example
10874 /// ```ignore,no_run
10875 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10876 /// let x = PySparkJob::new().set_main_python_file_uri("example");
10877 /// ```
10878 pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
10879 mut self,
10880 v: T,
10881 ) -> Self {
10882 self.main_python_file_uri = v.into();
10883 self
10884 }
10885
10886 /// Sets the value of [args][crate::model::PySparkJob::args].
10887 ///
10888 /// # Example
10889 /// ```ignore,no_run
10890 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10891 /// let x = PySparkJob::new().set_args(["a", "b", "c"]);
10892 /// ```
10893 pub fn set_args<T, V>(mut self, v: T) -> Self
10894 where
10895 T: std::iter::IntoIterator<Item = V>,
10896 V: std::convert::Into<std::string::String>,
10897 {
10898 use std::iter::Iterator;
10899 self.args = v.into_iter().map(|i| i.into()).collect();
10900 self
10901 }
10902
10903 /// Sets the value of [python_file_uris][crate::model::PySparkJob::python_file_uris].
10904 ///
10905 /// # Example
10906 /// ```ignore,no_run
10907 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10908 /// let x = PySparkJob::new().set_python_file_uris(["a", "b", "c"]);
10909 /// ```
10910 pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
10911 where
10912 T: std::iter::IntoIterator<Item = V>,
10913 V: std::convert::Into<std::string::String>,
10914 {
10915 use std::iter::Iterator;
10916 self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
10917 self
10918 }
10919
10920 /// Sets the value of [jar_file_uris][crate::model::PySparkJob::jar_file_uris].
10921 ///
10922 /// # Example
10923 /// ```ignore,no_run
10924 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10925 /// let x = PySparkJob::new().set_jar_file_uris(["a", "b", "c"]);
10926 /// ```
10927 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10928 where
10929 T: std::iter::IntoIterator<Item = V>,
10930 V: std::convert::Into<std::string::String>,
10931 {
10932 use std::iter::Iterator;
10933 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10934 self
10935 }
10936
10937 /// Sets the value of [file_uris][crate::model::PySparkJob::file_uris].
10938 ///
10939 /// # Example
10940 /// ```ignore,no_run
10941 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10942 /// let x = PySparkJob::new().set_file_uris(["a", "b", "c"]);
10943 /// ```
10944 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10945 where
10946 T: std::iter::IntoIterator<Item = V>,
10947 V: std::convert::Into<std::string::String>,
10948 {
10949 use std::iter::Iterator;
10950 self.file_uris = v.into_iter().map(|i| i.into()).collect();
10951 self
10952 }
10953
10954 /// Sets the value of [archive_uris][crate::model::PySparkJob::archive_uris].
10955 ///
10956 /// # Example
10957 /// ```ignore,no_run
10958 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10959 /// let x = PySparkJob::new().set_archive_uris(["a", "b", "c"]);
10960 /// ```
10961 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10962 where
10963 T: std::iter::IntoIterator<Item = V>,
10964 V: std::convert::Into<std::string::String>,
10965 {
10966 use std::iter::Iterator;
10967 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10968 self
10969 }
10970
10971 /// Sets the value of [properties][crate::model::PySparkJob::properties].
10972 ///
10973 /// # Example
10974 /// ```ignore,no_run
10975 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10976 /// let x = PySparkJob::new().set_properties([
10977 /// ("key0", "abc"),
10978 /// ("key1", "xyz"),
10979 /// ]);
10980 /// ```
10981 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10982 where
10983 T: std::iter::IntoIterator<Item = (K, V)>,
10984 K: std::convert::Into<std::string::String>,
10985 V: std::convert::Into<std::string::String>,
10986 {
10987 use std::iter::Iterator;
10988 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10989 self
10990 }
10991
10992 /// Sets the value of [logging_config][crate::model::PySparkJob::logging_config].
10993 ///
10994 /// # Example
10995 /// ```ignore,no_run
10996 /// # use google_cloud_dataproc_v1::model::PySparkJob;
10997 /// use google_cloud_dataproc_v1::model::LoggingConfig;
10998 /// let x = PySparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10999 /// ```
11000 pub fn set_logging_config<T>(mut self, v: T) -> Self
11001 where
11002 T: std::convert::Into<crate::model::LoggingConfig>,
11003 {
11004 self.logging_config = std::option::Option::Some(v.into());
11005 self
11006 }
11007
11008 /// Sets or clears the value of [logging_config][crate::model::PySparkJob::logging_config].
11009 ///
11010 /// # Example
11011 /// ```ignore,no_run
11012 /// # use google_cloud_dataproc_v1::model::PySparkJob;
11013 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11014 /// let x = PySparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11015 /// let x = PySparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11016 /// ```
11017 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11018 where
11019 T: std::convert::Into<crate::model::LoggingConfig>,
11020 {
11021 self.logging_config = v.map(|x| x.into());
11022 self
11023 }
11024}
11025
11026impl wkt::message::Message for PySparkJob {
11027 fn typename() -> &'static str {
11028 "type.googleapis.com/google.cloud.dataproc.v1.PySparkJob"
11029 }
11030}
11031
11032/// A list of queries to run on a cluster.
11033#[derive(Clone, Default, PartialEq)]
11034#[non_exhaustive]
11035pub struct QueryList {
11036 /// Required. The queries to execute. You do not need to end a query expression
11037 /// with a semicolon. Multiple queries can be specified in one
11038 /// string by separating each with a semicolon. Here is an example of a
11039 /// Dataproc API snippet that uses a QueryList to specify a HiveJob:
11040 ///
11041 /// ```norust
11042 /// "hiveJob": {
11043 /// "queryList": {
11044 /// "queries": [
11045 /// "query1",
11046 /// "query2",
11047 /// "query3;query4",
11048 /// ]
11049 /// }
11050 /// }
11051 /// ```
11052 pub queries: std::vec::Vec<std::string::String>,
11053
11054 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11055}
11056
11057impl QueryList {
11058 pub fn new() -> Self {
11059 std::default::Default::default()
11060 }
11061
11062 /// Sets the value of [queries][crate::model::QueryList::queries].
11063 ///
11064 /// # Example
11065 /// ```ignore,no_run
11066 /// # use google_cloud_dataproc_v1::model::QueryList;
11067 /// let x = QueryList::new().set_queries(["a", "b", "c"]);
11068 /// ```
11069 pub fn set_queries<T, V>(mut self, v: T) -> Self
11070 where
11071 T: std::iter::IntoIterator<Item = V>,
11072 V: std::convert::Into<std::string::String>,
11073 {
11074 use std::iter::Iterator;
11075 self.queries = v.into_iter().map(|i| i.into()).collect();
11076 self
11077 }
11078}
11079
11080impl wkt::message::Message for QueryList {
11081 fn typename() -> &'static str {
11082 "type.googleapis.com/google.cloud.dataproc.v1.QueryList"
11083 }
11084}
11085
11086/// A Dataproc job for running [Apache Hive](https://hive.apache.org/)
11087/// queries on YARN.
11088#[derive(Clone, Default, PartialEq)]
11089#[non_exhaustive]
11090pub struct HiveJob {
11091 /// Optional. Whether to continue executing queries if a query fails.
11092 /// The default value is `false`. Setting to `true` can be useful when
11093 /// executing independent parallel queries.
11094 pub continue_on_failure: bool,
11095
11096 /// Optional. Mapping of query variable names to values (equivalent to the
11097 /// Hive command: `SET name="value";`).
11098 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11099
11100 /// Optional. A mapping of property names and values, used to configure Hive.
11101 /// Properties that conflict with values set by the Dataproc API might be
11102 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11103 /// /etc/hive/conf/hive-site.xml, and classes in user code.
11104 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11105
11106 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the
11107 /// Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes
11108 /// and UDFs.
11109 pub jar_file_uris: std::vec::Vec<std::string::String>,
11110
11111 /// Required. The sequence of Hive queries to execute, specified as either
11112 /// an HCFS file URI or a list of queries.
11113 pub queries: std::option::Option<crate::model::hive_job::Queries>,
11114
11115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11116}
11117
11118impl HiveJob {
11119 pub fn new() -> Self {
11120 std::default::Default::default()
11121 }
11122
11123 /// Sets the value of [continue_on_failure][crate::model::HiveJob::continue_on_failure].
11124 ///
11125 /// # Example
11126 /// ```ignore,no_run
11127 /// # use google_cloud_dataproc_v1::model::HiveJob;
11128 /// let x = HiveJob::new().set_continue_on_failure(true);
11129 /// ```
11130 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11131 self.continue_on_failure = v.into();
11132 self
11133 }
11134
11135 /// Sets the value of [script_variables][crate::model::HiveJob::script_variables].
11136 ///
11137 /// # Example
11138 /// ```ignore,no_run
11139 /// # use google_cloud_dataproc_v1::model::HiveJob;
11140 /// let x = HiveJob::new().set_script_variables([
11141 /// ("key0", "abc"),
11142 /// ("key1", "xyz"),
11143 /// ]);
11144 /// ```
11145 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11146 where
11147 T: std::iter::IntoIterator<Item = (K, V)>,
11148 K: std::convert::Into<std::string::String>,
11149 V: std::convert::Into<std::string::String>,
11150 {
11151 use std::iter::Iterator;
11152 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11153 self
11154 }
11155
11156 /// Sets the value of [properties][crate::model::HiveJob::properties].
11157 ///
11158 /// # Example
11159 /// ```ignore,no_run
11160 /// # use google_cloud_dataproc_v1::model::HiveJob;
11161 /// let x = HiveJob::new().set_properties([
11162 /// ("key0", "abc"),
11163 /// ("key1", "xyz"),
11164 /// ]);
11165 /// ```
11166 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11167 where
11168 T: std::iter::IntoIterator<Item = (K, V)>,
11169 K: std::convert::Into<std::string::String>,
11170 V: std::convert::Into<std::string::String>,
11171 {
11172 use std::iter::Iterator;
11173 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11174 self
11175 }
11176
11177 /// Sets the value of [jar_file_uris][crate::model::HiveJob::jar_file_uris].
11178 ///
11179 /// # Example
11180 /// ```ignore,no_run
11181 /// # use google_cloud_dataproc_v1::model::HiveJob;
11182 /// let x = HiveJob::new().set_jar_file_uris(["a", "b", "c"]);
11183 /// ```
11184 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11185 where
11186 T: std::iter::IntoIterator<Item = V>,
11187 V: std::convert::Into<std::string::String>,
11188 {
11189 use std::iter::Iterator;
11190 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11191 self
11192 }
11193
11194 /// Sets the value of [queries][crate::model::HiveJob::queries].
11195 ///
11196 /// Note that all the setters affecting `queries` are mutually
11197 /// exclusive.
11198 ///
11199 /// # Example
11200 /// ```ignore,no_run
11201 /// # use google_cloud_dataproc_v1::model::HiveJob;
11202 /// use google_cloud_dataproc_v1::model::hive_job::Queries;
11203 /// let x = HiveJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11204 /// ```
11205 pub fn set_queries<
11206 T: std::convert::Into<std::option::Option<crate::model::hive_job::Queries>>,
11207 >(
11208 mut self,
11209 v: T,
11210 ) -> Self {
11211 self.queries = v.into();
11212 self
11213 }
11214
11215 /// The value of [queries][crate::model::HiveJob::queries]
11216 /// if it holds a `QueryFileUri`, `None` if the field is not set or
11217 /// holds a different branch.
11218 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11219 #[allow(unreachable_patterns)]
11220 self.queries.as_ref().and_then(|v| match v {
11221 crate::model::hive_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11222 _ => std::option::Option::None,
11223 })
11224 }
11225
11226 /// Sets the value of [queries][crate::model::HiveJob::queries]
11227 /// to hold a `QueryFileUri`.
11228 ///
11229 /// Note that all the setters affecting `queries` are
11230 /// mutually exclusive.
11231 ///
11232 /// # Example
11233 /// ```ignore,no_run
11234 /// # use google_cloud_dataproc_v1::model::HiveJob;
11235 /// let x = HiveJob::new().set_query_file_uri("example");
11236 /// assert!(x.query_file_uri().is_some());
11237 /// assert!(x.query_list().is_none());
11238 /// ```
11239 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11240 self.queries =
11241 std::option::Option::Some(crate::model::hive_job::Queries::QueryFileUri(v.into()));
11242 self
11243 }
11244
11245 /// The value of [queries][crate::model::HiveJob::queries]
11246 /// if it holds a `QueryList`, `None` if the field is not set or
11247 /// holds a different branch.
11248 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11249 #[allow(unreachable_patterns)]
11250 self.queries.as_ref().and_then(|v| match v {
11251 crate::model::hive_job::Queries::QueryList(v) => std::option::Option::Some(v),
11252 _ => std::option::Option::None,
11253 })
11254 }
11255
11256 /// Sets the value of [queries][crate::model::HiveJob::queries]
11257 /// to hold a `QueryList`.
11258 ///
11259 /// Note that all the setters affecting `queries` are
11260 /// mutually exclusive.
11261 ///
11262 /// # Example
11263 /// ```ignore,no_run
11264 /// # use google_cloud_dataproc_v1::model::HiveJob;
11265 /// use google_cloud_dataproc_v1::model::QueryList;
11266 /// let x = HiveJob::new().set_query_list(QueryList::default()/* use setters */);
11267 /// assert!(x.query_list().is_some());
11268 /// assert!(x.query_file_uri().is_none());
11269 /// ```
11270 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11271 mut self,
11272 v: T,
11273 ) -> Self {
11274 self.queries =
11275 std::option::Option::Some(crate::model::hive_job::Queries::QueryList(v.into()));
11276 self
11277 }
11278}
11279
11280impl wkt::message::Message for HiveJob {
11281 fn typename() -> &'static str {
11282 "type.googleapis.com/google.cloud.dataproc.v1.HiveJob"
11283 }
11284}
11285
11286/// Defines additional types related to [HiveJob].
11287pub mod hive_job {
11288 #[allow(unused_imports)]
11289 use super::*;
11290
11291 /// Required. The sequence of Hive queries to execute, specified as either
11292 /// an HCFS file URI or a list of queries.
11293 #[derive(Clone, Debug, PartialEq)]
11294 #[non_exhaustive]
11295 pub enum Queries {
11296 /// The HCFS URI of the script that contains Hive queries.
11297 QueryFileUri(std::string::String),
11298 /// A list of queries.
11299 QueryList(std::boxed::Box<crate::model::QueryList>),
11300 }
11301}
11302
11303/// A Dataproc job for running [Apache Spark
11304/// SQL](https://spark.apache.org/sql/) queries.
11305#[derive(Clone, Default, PartialEq)]
11306#[non_exhaustive]
11307pub struct SparkSqlJob {
11308 /// Optional. Mapping of query variable names to values (equivalent to the
11309 /// Spark SQL command: SET `name="value";`).
11310 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11311
11312 /// Optional. A mapping of property names to values, used to configure
11313 /// Spark SQL's SparkConf. Properties that conflict with values set by the
11314 /// Dataproc API might be overwritten.
11315 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11316
11317 /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
11318 pub jar_file_uris: std::vec::Vec<std::string::String>,
11319
11320 /// Optional. The runtime log config for job execution.
11321 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11322
11323 /// Required. The sequence of Spark SQL queries to execute, specified as
11324 /// either an HCFS file URI or as a list of queries.
11325 pub queries: std::option::Option<crate::model::spark_sql_job::Queries>,
11326
11327 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11328}
11329
11330impl SparkSqlJob {
11331 pub fn new() -> Self {
11332 std::default::Default::default()
11333 }
11334
11335 /// Sets the value of [script_variables][crate::model::SparkSqlJob::script_variables].
11336 ///
11337 /// # Example
11338 /// ```ignore,no_run
11339 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11340 /// let x = SparkSqlJob::new().set_script_variables([
11341 /// ("key0", "abc"),
11342 /// ("key1", "xyz"),
11343 /// ]);
11344 /// ```
11345 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11346 where
11347 T: std::iter::IntoIterator<Item = (K, V)>,
11348 K: std::convert::Into<std::string::String>,
11349 V: std::convert::Into<std::string::String>,
11350 {
11351 use std::iter::Iterator;
11352 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11353 self
11354 }
11355
11356 /// Sets the value of [properties][crate::model::SparkSqlJob::properties].
11357 ///
11358 /// # Example
11359 /// ```ignore,no_run
11360 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11361 /// let x = SparkSqlJob::new().set_properties([
11362 /// ("key0", "abc"),
11363 /// ("key1", "xyz"),
11364 /// ]);
11365 /// ```
11366 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11367 where
11368 T: std::iter::IntoIterator<Item = (K, V)>,
11369 K: std::convert::Into<std::string::String>,
11370 V: std::convert::Into<std::string::String>,
11371 {
11372 use std::iter::Iterator;
11373 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11374 self
11375 }
11376
11377 /// Sets the value of [jar_file_uris][crate::model::SparkSqlJob::jar_file_uris].
11378 ///
11379 /// # Example
11380 /// ```ignore,no_run
11381 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11382 /// let x = SparkSqlJob::new().set_jar_file_uris(["a", "b", "c"]);
11383 /// ```
11384 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11385 where
11386 T: std::iter::IntoIterator<Item = V>,
11387 V: std::convert::Into<std::string::String>,
11388 {
11389 use std::iter::Iterator;
11390 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11391 self
11392 }
11393
11394 /// Sets the value of [logging_config][crate::model::SparkSqlJob::logging_config].
11395 ///
11396 /// # Example
11397 /// ```ignore,no_run
11398 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11399 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11400 /// let x = SparkSqlJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11401 /// ```
11402 pub fn set_logging_config<T>(mut self, v: T) -> Self
11403 where
11404 T: std::convert::Into<crate::model::LoggingConfig>,
11405 {
11406 self.logging_config = std::option::Option::Some(v.into());
11407 self
11408 }
11409
11410 /// Sets or clears the value of [logging_config][crate::model::SparkSqlJob::logging_config].
11411 ///
11412 /// # Example
11413 /// ```ignore,no_run
11414 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11415 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11416 /// let x = SparkSqlJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11417 /// let x = SparkSqlJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11418 /// ```
11419 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11420 where
11421 T: std::convert::Into<crate::model::LoggingConfig>,
11422 {
11423 self.logging_config = v.map(|x| x.into());
11424 self
11425 }
11426
11427 /// Sets the value of [queries][crate::model::SparkSqlJob::queries].
11428 ///
11429 /// Note that all the setters affecting `queries` are mutually
11430 /// exclusive.
11431 ///
11432 /// # Example
11433 /// ```ignore,no_run
11434 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11435 /// use google_cloud_dataproc_v1::model::spark_sql_job::Queries;
11436 /// let x = SparkSqlJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11437 /// ```
11438 pub fn set_queries<
11439 T: std::convert::Into<std::option::Option<crate::model::spark_sql_job::Queries>>,
11440 >(
11441 mut self,
11442 v: T,
11443 ) -> Self {
11444 self.queries = v.into();
11445 self
11446 }
11447
11448 /// The value of [queries][crate::model::SparkSqlJob::queries]
11449 /// if it holds a `QueryFileUri`, `None` if the field is not set or
11450 /// holds a different branch.
11451 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11452 #[allow(unreachable_patterns)]
11453 self.queries.as_ref().and_then(|v| match v {
11454 crate::model::spark_sql_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11455 _ => std::option::Option::None,
11456 })
11457 }
11458
11459 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
11460 /// to hold a `QueryFileUri`.
11461 ///
11462 /// Note that all the setters affecting `queries` are
11463 /// mutually exclusive.
11464 ///
11465 /// # Example
11466 /// ```ignore,no_run
11467 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11468 /// let x = SparkSqlJob::new().set_query_file_uri("example");
11469 /// assert!(x.query_file_uri().is_some());
11470 /// assert!(x.query_list().is_none());
11471 /// ```
11472 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11473 self.queries =
11474 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryFileUri(v.into()));
11475 self
11476 }
11477
11478 /// The value of [queries][crate::model::SparkSqlJob::queries]
11479 /// if it holds a `QueryList`, `None` if the field is not set or
11480 /// holds a different branch.
11481 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11482 #[allow(unreachable_patterns)]
11483 self.queries.as_ref().and_then(|v| match v {
11484 crate::model::spark_sql_job::Queries::QueryList(v) => std::option::Option::Some(v),
11485 _ => std::option::Option::None,
11486 })
11487 }
11488
11489 /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
11490 /// to hold a `QueryList`.
11491 ///
11492 /// Note that all the setters affecting `queries` are
11493 /// mutually exclusive.
11494 ///
11495 /// # Example
11496 /// ```ignore,no_run
11497 /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11498 /// use google_cloud_dataproc_v1::model::QueryList;
11499 /// let x = SparkSqlJob::new().set_query_list(QueryList::default()/* use setters */);
11500 /// assert!(x.query_list().is_some());
11501 /// assert!(x.query_file_uri().is_none());
11502 /// ```
11503 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11504 mut self,
11505 v: T,
11506 ) -> Self {
11507 self.queries =
11508 std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryList(v.into()));
11509 self
11510 }
11511}
11512
11513impl wkt::message::Message for SparkSqlJob {
11514 fn typename() -> &'static str {
11515 "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlJob"
11516 }
11517}
11518
11519/// Defines additional types related to [SparkSqlJob].
11520pub mod spark_sql_job {
11521 #[allow(unused_imports)]
11522 use super::*;
11523
11524 /// Required. The sequence of Spark SQL queries to execute, specified as
11525 /// either an HCFS file URI or as a list of queries.
11526 #[derive(Clone, Debug, PartialEq)]
11527 #[non_exhaustive]
11528 pub enum Queries {
11529 /// The HCFS URI of the script that contains SQL queries.
11530 QueryFileUri(std::string::String),
11531 /// A list of queries.
11532 QueryList(std::boxed::Box<crate::model::QueryList>),
11533 }
11534}
11535
11536/// A Dataproc job for running [Apache Pig](https://pig.apache.org/)
11537/// queries on YARN.
11538#[derive(Clone, Default, PartialEq)]
11539#[non_exhaustive]
11540pub struct PigJob {
11541 /// Optional. Whether to continue executing queries if a query fails.
11542 /// The default value is `false`. Setting to `true` can be useful when
11543 /// executing independent parallel queries.
11544 pub continue_on_failure: bool,
11545
11546 /// Optional. Mapping of query variable names to values (equivalent to the Pig
11547 /// command: `name=[value]`).
11548 pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11549
11550 /// Optional. A mapping of property names to values, used to configure Pig.
11551 /// Properties that conflict with values set by the Dataproc API might be
11552 /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11553 /// /etc/pig/conf/pig.properties, and classes in user code.
11554 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11555
11556 /// Optional. HCFS URIs of jar files to add to the CLASSPATH of
11557 /// the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs.
11558 pub jar_file_uris: std::vec::Vec<std::string::String>,
11559
11560 /// Optional. The runtime log config for job execution.
11561 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11562
11563 /// Required. The sequence of Pig queries to execute, specified as an HCFS
11564 /// file URI or a list of queries.
11565 pub queries: std::option::Option<crate::model::pig_job::Queries>,
11566
11567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11568}
11569
11570impl PigJob {
11571 pub fn new() -> Self {
11572 std::default::Default::default()
11573 }
11574
11575 /// Sets the value of [continue_on_failure][crate::model::PigJob::continue_on_failure].
11576 ///
11577 /// # Example
11578 /// ```ignore,no_run
11579 /// # use google_cloud_dataproc_v1::model::PigJob;
11580 /// let x = PigJob::new().set_continue_on_failure(true);
11581 /// ```
11582 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11583 self.continue_on_failure = v.into();
11584 self
11585 }
11586
11587 /// Sets the value of [script_variables][crate::model::PigJob::script_variables].
11588 ///
11589 /// # Example
11590 /// ```ignore,no_run
11591 /// # use google_cloud_dataproc_v1::model::PigJob;
11592 /// let x = PigJob::new().set_script_variables([
11593 /// ("key0", "abc"),
11594 /// ("key1", "xyz"),
11595 /// ]);
11596 /// ```
11597 pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11598 where
11599 T: std::iter::IntoIterator<Item = (K, V)>,
11600 K: std::convert::Into<std::string::String>,
11601 V: std::convert::Into<std::string::String>,
11602 {
11603 use std::iter::Iterator;
11604 self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11605 self
11606 }
11607
11608 /// Sets the value of [properties][crate::model::PigJob::properties].
11609 ///
11610 /// # Example
11611 /// ```ignore,no_run
11612 /// # use google_cloud_dataproc_v1::model::PigJob;
11613 /// let x = PigJob::new().set_properties([
11614 /// ("key0", "abc"),
11615 /// ("key1", "xyz"),
11616 /// ]);
11617 /// ```
11618 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11619 where
11620 T: std::iter::IntoIterator<Item = (K, V)>,
11621 K: std::convert::Into<std::string::String>,
11622 V: std::convert::Into<std::string::String>,
11623 {
11624 use std::iter::Iterator;
11625 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11626 self
11627 }
11628
11629 /// Sets the value of [jar_file_uris][crate::model::PigJob::jar_file_uris].
11630 ///
11631 /// # Example
11632 /// ```ignore,no_run
11633 /// # use google_cloud_dataproc_v1::model::PigJob;
11634 /// let x = PigJob::new().set_jar_file_uris(["a", "b", "c"]);
11635 /// ```
11636 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11637 where
11638 T: std::iter::IntoIterator<Item = V>,
11639 V: std::convert::Into<std::string::String>,
11640 {
11641 use std::iter::Iterator;
11642 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11643 self
11644 }
11645
11646 /// Sets the value of [logging_config][crate::model::PigJob::logging_config].
11647 ///
11648 /// # Example
11649 /// ```ignore,no_run
11650 /// # use google_cloud_dataproc_v1::model::PigJob;
11651 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11652 /// let x = PigJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11653 /// ```
11654 pub fn set_logging_config<T>(mut self, v: T) -> Self
11655 where
11656 T: std::convert::Into<crate::model::LoggingConfig>,
11657 {
11658 self.logging_config = std::option::Option::Some(v.into());
11659 self
11660 }
11661
11662 /// Sets or clears the value of [logging_config][crate::model::PigJob::logging_config].
11663 ///
11664 /// # Example
11665 /// ```ignore,no_run
11666 /// # use google_cloud_dataproc_v1::model::PigJob;
11667 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11668 /// let x = PigJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11669 /// let x = PigJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11670 /// ```
11671 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11672 where
11673 T: std::convert::Into<crate::model::LoggingConfig>,
11674 {
11675 self.logging_config = v.map(|x| x.into());
11676 self
11677 }
11678
11679 /// Sets the value of [queries][crate::model::PigJob::queries].
11680 ///
11681 /// Note that all the setters affecting `queries` are mutually
11682 /// exclusive.
11683 ///
11684 /// # Example
11685 /// ```ignore,no_run
11686 /// # use google_cloud_dataproc_v1::model::PigJob;
11687 /// use google_cloud_dataproc_v1::model::pig_job::Queries;
11688 /// let x = PigJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11689 /// ```
11690 pub fn set_queries<
11691 T: std::convert::Into<std::option::Option<crate::model::pig_job::Queries>>,
11692 >(
11693 mut self,
11694 v: T,
11695 ) -> Self {
11696 self.queries = v.into();
11697 self
11698 }
11699
11700 /// The value of [queries][crate::model::PigJob::queries]
11701 /// if it holds a `QueryFileUri`, `None` if the field is not set or
11702 /// holds a different branch.
11703 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11704 #[allow(unreachable_patterns)]
11705 self.queries.as_ref().and_then(|v| match v {
11706 crate::model::pig_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11707 _ => std::option::Option::None,
11708 })
11709 }
11710
11711 /// Sets the value of [queries][crate::model::PigJob::queries]
11712 /// to hold a `QueryFileUri`.
11713 ///
11714 /// Note that all the setters affecting `queries` are
11715 /// mutually exclusive.
11716 ///
11717 /// # Example
11718 /// ```ignore,no_run
11719 /// # use google_cloud_dataproc_v1::model::PigJob;
11720 /// let x = PigJob::new().set_query_file_uri("example");
11721 /// assert!(x.query_file_uri().is_some());
11722 /// assert!(x.query_list().is_none());
11723 /// ```
11724 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11725 self.queries =
11726 std::option::Option::Some(crate::model::pig_job::Queries::QueryFileUri(v.into()));
11727 self
11728 }
11729
11730 /// The value of [queries][crate::model::PigJob::queries]
11731 /// if it holds a `QueryList`, `None` if the field is not set or
11732 /// holds a different branch.
11733 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11734 #[allow(unreachable_patterns)]
11735 self.queries.as_ref().and_then(|v| match v {
11736 crate::model::pig_job::Queries::QueryList(v) => std::option::Option::Some(v),
11737 _ => std::option::Option::None,
11738 })
11739 }
11740
11741 /// Sets the value of [queries][crate::model::PigJob::queries]
11742 /// to hold a `QueryList`.
11743 ///
11744 /// Note that all the setters affecting `queries` are
11745 /// mutually exclusive.
11746 ///
11747 /// # Example
11748 /// ```ignore,no_run
11749 /// # use google_cloud_dataproc_v1::model::PigJob;
11750 /// use google_cloud_dataproc_v1::model::QueryList;
11751 /// let x = PigJob::new().set_query_list(QueryList::default()/* use setters */);
11752 /// assert!(x.query_list().is_some());
11753 /// assert!(x.query_file_uri().is_none());
11754 /// ```
11755 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11756 mut self,
11757 v: T,
11758 ) -> Self {
11759 self.queries =
11760 std::option::Option::Some(crate::model::pig_job::Queries::QueryList(v.into()));
11761 self
11762 }
11763}
11764
11765impl wkt::message::Message for PigJob {
11766 fn typename() -> &'static str {
11767 "type.googleapis.com/google.cloud.dataproc.v1.PigJob"
11768 }
11769}
11770
11771/// Defines additional types related to [PigJob].
11772pub mod pig_job {
11773 #[allow(unused_imports)]
11774 use super::*;
11775
11776 /// Required. The sequence of Pig queries to execute, specified as an HCFS
11777 /// file URI or a list of queries.
11778 #[derive(Clone, Debug, PartialEq)]
11779 #[non_exhaustive]
11780 pub enum Queries {
11781 /// The HCFS URI of the script that contains the Pig queries.
11782 QueryFileUri(std::string::String),
11783 /// A list of queries.
11784 QueryList(std::boxed::Box<crate::model::QueryList>),
11785 }
11786}
11787
11788/// A Dataproc job for running
11789/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
11790/// applications on YARN.
11791#[derive(Clone, Default, PartialEq)]
11792#[non_exhaustive]
11793pub struct SparkRJob {
11794 /// Required. The HCFS URI of the main R file to use as the driver.
11795 /// Must be a .R file.
11796 pub main_r_file_uri: std::string::String,
11797
11798 /// Optional. The arguments to pass to the driver. Do not include arguments,
11799 /// such as `--conf`, that can be set as job properties, since a collision may
11800 /// occur that causes an incorrect job submission.
11801 pub args: std::vec::Vec<std::string::String>,
11802
11803 /// Optional. HCFS URIs of files to be placed in the working directory of
11804 /// each executor. Useful for naively parallel tasks.
11805 pub file_uris: std::vec::Vec<std::string::String>,
11806
11807 /// Optional. HCFS URIs of archives to be extracted into the working directory
11808 /// of each executor. Supported file types:
11809 /// .jar, .tar, .tar.gz, .tgz, and .zip.
11810 pub archive_uris: std::vec::Vec<std::string::String>,
11811
11812 /// Optional. A mapping of property names to values, used to configure SparkR.
11813 /// Properties that conflict with values set by the Dataproc API might be
11814 /// overwritten. Can include properties set in
11815 /// /etc/spark/conf/spark-defaults.conf and classes in user code.
11816 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11817
11818 /// Optional. The runtime log config for job execution.
11819 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11820
11821 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11822}
11823
11824impl SparkRJob {
11825 pub fn new() -> Self {
11826 std::default::Default::default()
11827 }
11828
11829 /// Sets the value of [main_r_file_uri][crate::model::SparkRJob::main_r_file_uri].
11830 ///
11831 /// # Example
11832 /// ```ignore,no_run
11833 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11834 /// let x = SparkRJob::new().set_main_r_file_uri("example");
11835 /// ```
11836 pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11837 self.main_r_file_uri = v.into();
11838 self
11839 }
11840
11841 /// Sets the value of [args][crate::model::SparkRJob::args].
11842 ///
11843 /// # Example
11844 /// ```ignore,no_run
11845 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11846 /// let x = SparkRJob::new().set_args(["a", "b", "c"]);
11847 /// ```
11848 pub fn set_args<T, V>(mut self, v: T) -> Self
11849 where
11850 T: std::iter::IntoIterator<Item = V>,
11851 V: std::convert::Into<std::string::String>,
11852 {
11853 use std::iter::Iterator;
11854 self.args = v.into_iter().map(|i| i.into()).collect();
11855 self
11856 }
11857
11858 /// Sets the value of [file_uris][crate::model::SparkRJob::file_uris].
11859 ///
11860 /// # Example
11861 /// ```ignore,no_run
11862 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11863 /// let x = SparkRJob::new().set_file_uris(["a", "b", "c"]);
11864 /// ```
11865 pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11866 where
11867 T: std::iter::IntoIterator<Item = V>,
11868 V: std::convert::Into<std::string::String>,
11869 {
11870 use std::iter::Iterator;
11871 self.file_uris = v.into_iter().map(|i| i.into()).collect();
11872 self
11873 }
11874
11875 /// Sets the value of [archive_uris][crate::model::SparkRJob::archive_uris].
11876 ///
11877 /// # Example
11878 /// ```ignore,no_run
11879 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11880 /// let x = SparkRJob::new().set_archive_uris(["a", "b", "c"]);
11881 /// ```
11882 pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11883 where
11884 T: std::iter::IntoIterator<Item = V>,
11885 V: std::convert::Into<std::string::String>,
11886 {
11887 use std::iter::Iterator;
11888 self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11889 self
11890 }
11891
11892 /// Sets the value of [properties][crate::model::SparkRJob::properties].
11893 ///
11894 /// # Example
11895 /// ```ignore,no_run
11896 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11897 /// let x = SparkRJob::new().set_properties([
11898 /// ("key0", "abc"),
11899 /// ("key1", "xyz"),
11900 /// ]);
11901 /// ```
11902 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11903 where
11904 T: std::iter::IntoIterator<Item = (K, V)>,
11905 K: std::convert::Into<std::string::String>,
11906 V: std::convert::Into<std::string::String>,
11907 {
11908 use std::iter::Iterator;
11909 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11910 self
11911 }
11912
11913 /// Sets the value of [logging_config][crate::model::SparkRJob::logging_config].
11914 ///
11915 /// # Example
11916 /// ```ignore,no_run
11917 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11918 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11919 /// let x = SparkRJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11920 /// ```
11921 pub fn set_logging_config<T>(mut self, v: T) -> Self
11922 where
11923 T: std::convert::Into<crate::model::LoggingConfig>,
11924 {
11925 self.logging_config = std::option::Option::Some(v.into());
11926 self
11927 }
11928
11929 /// Sets or clears the value of [logging_config][crate::model::SparkRJob::logging_config].
11930 ///
11931 /// # Example
11932 /// ```ignore,no_run
11933 /// # use google_cloud_dataproc_v1::model::SparkRJob;
11934 /// use google_cloud_dataproc_v1::model::LoggingConfig;
11935 /// let x = SparkRJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11936 /// let x = SparkRJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11937 /// ```
11938 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11939 where
11940 T: std::convert::Into<crate::model::LoggingConfig>,
11941 {
11942 self.logging_config = v.map(|x| x.into());
11943 self
11944 }
11945}
11946
11947impl wkt::message::Message for SparkRJob {
11948 fn typename() -> &'static str {
11949 "type.googleapis.com/google.cloud.dataproc.v1.SparkRJob"
11950 }
11951}
11952
11953/// A Dataproc job for running [Presto](https://prestosql.io/) queries.
11954/// **IMPORTANT**: The [Dataproc Presto Optional
11955/// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto)
11956/// must be enabled when the cluster is created to submit a Presto job to the
11957/// cluster.
11958#[derive(Clone, Default, PartialEq)]
11959#[non_exhaustive]
11960pub struct PrestoJob {
11961 /// Optional. Whether to continue executing queries if a query fails.
11962 /// The default value is `false`. Setting to `true` can be useful when
11963 /// executing independent parallel queries.
11964 pub continue_on_failure: bool,
11965
11966 /// Optional. The format in which query output will be displayed. See the
11967 /// Presto documentation for supported output formats
11968 pub output_format: std::string::String,
11969
11970 /// Optional. Presto client tags to attach to this query
11971 pub client_tags: std::vec::Vec<std::string::String>,
11972
11973 /// Optional. A mapping of property names to values. Used to set Presto
11974 /// [session properties](https://prestodb.io/docs/current/sql/set-session.html)
11975 /// Equivalent to using the --session flag in the Presto CLI
11976 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11977
11978 /// Optional. The runtime log config for job execution.
11979 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11980
11981 /// Required. The sequence of Presto queries to execute, specified as
11982 /// either an HCFS file URI or as a list of queries.
11983 pub queries: std::option::Option<crate::model::presto_job::Queries>,
11984
11985 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11986}
11987
11988impl PrestoJob {
11989 pub fn new() -> Self {
11990 std::default::Default::default()
11991 }
11992
11993 /// Sets the value of [continue_on_failure][crate::model::PrestoJob::continue_on_failure].
11994 ///
11995 /// # Example
11996 /// ```ignore,no_run
11997 /// # use google_cloud_dataproc_v1::model::PrestoJob;
11998 /// let x = PrestoJob::new().set_continue_on_failure(true);
11999 /// ```
12000 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12001 self.continue_on_failure = v.into();
12002 self
12003 }
12004
12005 /// Sets the value of [output_format][crate::model::PrestoJob::output_format].
12006 ///
12007 /// # Example
12008 /// ```ignore,no_run
12009 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12010 /// let x = PrestoJob::new().set_output_format("example");
12011 /// ```
12012 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12013 self.output_format = v.into();
12014 self
12015 }
12016
12017 /// Sets the value of [client_tags][crate::model::PrestoJob::client_tags].
12018 ///
12019 /// # Example
12020 /// ```ignore,no_run
12021 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12022 /// let x = PrestoJob::new().set_client_tags(["a", "b", "c"]);
12023 /// ```
12024 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12025 where
12026 T: std::iter::IntoIterator<Item = V>,
12027 V: std::convert::Into<std::string::String>,
12028 {
12029 use std::iter::Iterator;
12030 self.client_tags = v.into_iter().map(|i| i.into()).collect();
12031 self
12032 }
12033
12034 /// Sets the value of [properties][crate::model::PrestoJob::properties].
12035 ///
12036 /// # Example
12037 /// ```ignore,no_run
12038 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12039 /// let x = PrestoJob::new().set_properties([
12040 /// ("key0", "abc"),
12041 /// ("key1", "xyz"),
12042 /// ]);
12043 /// ```
12044 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12045 where
12046 T: std::iter::IntoIterator<Item = (K, V)>,
12047 K: std::convert::Into<std::string::String>,
12048 V: std::convert::Into<std::string::String>,
12049 {
12050 use std::iter::Iterator;
12051 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12052 self
12053 }
12054
12055 /// Sets the value of [logging_config][crate::model::PrestoJob::logging_config].
12056 ///
12057 /// # Example
12058 /// ```ignore,no_run
12059 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12060 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12061 /// let x = PrestoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12062 /// ```
12063 pub fn set_logging_config<T>(mut self, v: T) -> Self
12064 where
12065 T: std::convert::Into<crate::model::LoggingConfig>,
12066 {
12067 self.logging_config = std::option::Option::Some(v.into());
12068 self
12069 }
12070
12071 /// Sets or clears the value of [logging_config][crate::model::PrestoJob::logging_config].
12072 ///
12073 /// # Example
12074 /// ```ignore,no_run
12075 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12076 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12077 /// let x = PrestoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12078 /// let x = PrestoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12079 /// ```
12080 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12081 where
12082 T: std::convert::Into<crate::model::LoggingConfig>,
12083 {
12084 self.logging_config = v.map(|x| x.into());
12085 self
12086 }
12087
12088 /// Sets the value of [queries][crate::model::PrestoJob::queries].
12089 ///
12090 /// Note that all the setters affecting `queries` are mutually
12091 /// exclusive.
12092 ///
12093 /// # Example
12094 /// ```ignore,no_run
12095 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12096 /// use google_cloud_dataproc_v1::model::presto_job::Queries;
12097 /// let x = PrestoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12098 /// ```
12099 pub fn set_queries<
12100 T: std::convert::Into<std::option::Option<crate::model::presto_job::Queries>>,
12101 >(
12102 mut self,
12103 v: T,
12104 ) -> Self {
12105 self.queries = v.into();
12106 self
12107 }
12108
12109 /// The value of [queries][crate::model::PrestoJob::queries]
12110 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12111 /// holds a different branch.
12112 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12113 #[allow(unreachable_patterns)]
12114 self.queries.as_ref().and_then(|v| match v {
12115 crate::model::presto_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12116 _ => std::option::Option::None,
12117 })
12118 }
12119
12120 /// Sets the value of [queries][crate::model::PrestoJob::queries]
12121 /// to hold a `QueryFileUri`.
12122 ///
12123 /// Note that all the setters affecting `queries` are
12124 /// mutually exclusive.
12125 ///
12126 /// # Example
12127 /// ```ignore,no_run
12128 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12129 /// let x = PrestoJob::new().set_query_file_uri("example");
12130 /// assert!(x.query_file_uri().is_some());
12131 /// assert!(x.query_list().is_none());
12132 /// ```
12133 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12134 self.queries =
12135 std::option::Option::Some(crate::model::presto_job::Queries::QueryFileUri(v.into()));
12136 self
12137 }
12138
12139 /// The value of [queries][crate::model::PrestoJob::queries]
12140 /// if it holds a `QueryList`, `None` if the field is not set or
12141 /// holds a different branch.
12142 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12143 #[allow(unreachable_patterns)]
12144 self.queries.as_ref().and_then(|v| match v {
12145 crate::model::presto_job::Queries::QueryList(v) => std::option::Option::Some(v),
12146 _ => std::option::Option::None,
12147 })
12148 }
12149
12150 /// Sets the value of [queries][crate::model::PrestoJob::queries]
12151 /// to hold a `QueryList`.
12152 ///
12153 /// Note that all the setters affecting `queries` are
12154 /// mutually exclusive.
12155 ///
12156 /// # Example
12157 /// ```ignore,no_run
12158 /// # use google_cloud_dataproc_v1::model::PrestoJob;
12159 /// use google_cloud_dataproc_v1::model::QueryList;
12160 /// let x = PrestoJob::new().set_query_list(QueryList::default()/* use setters */);
12161 /// assert!(x.query_list().is_some());
12162 /// assert!(x.query_file_uri().is_none());
12163 /// ```
12164 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12165 mut self,
12166 v: T,
12167 ) -> Self {
12168 self.queries =
12169 std::option::Option::Some(crate::model::presto_job::Queries::QueryList(v.into()));
12170 self
12171 }
12172}
12173
12174impl wkt::message::Message for PrestoJob {
12175 fn typename() -> &'static str {
12176 "type.googleapis.com/google.cloud.dataproc.v1.PrestoJob"
12177 }
12178}
12179
12180/// Defines additional types related to [PrestoJob].
12181pub mod presto_job {
12182 #[allow(unused_imports)]
12183 use super::*;
12184
12185 /// Required. The sequence of Presto queries to execute, specified as
12186 /// either an HCFS file URI or as a list of queries.
12187 #[derive(Clone, Debug, PartialEq)]
12188 #[non_exhaustive]
12189 pub enum Queries {
12190 /// The HCFS URI of the script that contains SQL queries.
12191 QueryFileUri(std::string::String),
12192 /// A list of queries.
12193 QueryList(std::boxed::Box<crate::model::QueryList>),
12194 }
12195}
12196
12197/// A Dataproc job for running [Trino](https://trino.io/) queries.
12198/// **IMPORTANT**: The [Dataproc Trino Optional
12199/// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino)
12200/// must be enabled when the cluster is created to submit a Trino job to the
12201/// cluster.
12202#[derive(Clone, Default, PartialEq)]
12203#[non_exhaustive]
12204pub struct TrinoJob {
12205 /// Optional. Whether to continue executing queries if a query fails.
12206 /// The default value is `false`. Setting to `true` can be useful when
12207 /// executing independent parallel queries.
12208 pub continue_on_failure: bool,
12209
12210 /// Optional. The format in which query output will be displayed. See the
12211 /// Trino documentation for supported output formats
12212 pub output_format: std::string::String,
12213
12214 /// Optional. Trino client tags to attach to this query
12215 pub client_tags: std::vec::Vec<std::string::String>,
12216
12217 /// Optional. A mapping of property names to values. Used to set Trino
12218 /// [session properties](https://trino.io/docs/current/sql/set-session.html)
12219 /// Equivalent to using the --session flag in the Trino CLI
12220 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12221
12222 /// Optional. The runtime log config for job execution.
12223 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12224
12225 /// Required. The sequence of Trino queries to execute, specified as
12226 /// either an HCFS file URI or as a list of queries.
12227 pub queries: std::option::Option<crate::model::trino_job::Queries>,
12228
12229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12230}
12231
12232impl TrinoJob {
12233 pub fn new() -> Self {
12234 std::default::Default::default()
12235 }
12236
12237 /// Sets the value of [continue_on_failure][crate::model::TrinoJob::continue_on_failure].
12238 ///
12239 /// # Example
12240 /// ```ignore,no_run
12241 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12242 /// let x = TrinoJob::new().set_continue_on_failure(true);
12243 /// ```
12244 pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12245 self.continue_on_failure = v.into();
12246 self
12247 }
12248
12249 /// Sets the value of [output_format][crate::model::TrinoJob::output_format].
12250 ///
12251 /// # Example
12252 /// ```ignore,no_run
12253 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12254 /// let x = TrinoJob::new().set_output_format("example");
12255 /// ```
12256 pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12257 self.output_format = v.into();
12258 self
12259 }
12260
12261 /// Sets the value of [client_tags][crate::model::TrinoJob::client_tags].
12262 ///
12263 /// # Example
12264 /// ```ignore,no_run
12265 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12266 /// let x = TrinoJob::new().set_client_tags(["a", "b", "c"]);
12267 /// ```
12268 pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12269 where
12270 T: std::iter::IntoIterator<Item = V>,
12271 V: std::convert::Into<std::string::String>,
12272 {
12273 use std::iter::Iterator;
12274 self.client_tags = v.into_iter().map(|i| i.into()).collect();
12275 self
12276 }
12277
12278 /// Sets the value of [properties][crate::model::TrinoJob::properties].
12279 ///
12280 /// # Example
12281 /// ```ignore,no_run
12282 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12283 /// let x = TrinoJob::new().set_properties([
12284 /// ("key0", "abc"),
12285 /// ("key1", "xyz"),
12286 /// ]);
12287 /// ```
12288 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12289 where
12290 T: std::iter::IntoIterator<Item = (K, V)>,
12291 K: std::convert::Into<std::string::String>,
12292 V: std::convert::Into<std::string::String>,
12293 {
12294 use std::iter::Iterator;
12295 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12296 self
12297 }
12298
12299 /// Sets the value of [logging_config][crate::model::TrinoJob::logging_config].
12300 ///
12301 /// # Example
12302 /// ```ignore,no_run
12303 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12304 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12305 /// let x = TrinoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12306 /// ```
12307 pub fn set_logging_config<T>(mut self, v: T) -> Self
12308 where
12309 T: std::convert::Into<crate::model::LoggingConfig>,
12310 {
12311 self.logging_config = std::option::Option::Some(v.into());
12312 self
12313 }
12314
12315 /// Sets or clears the value of [logging_config][crate::model::TrinoJob::logging_config].
12316 ///
12317 /// # Example
12318 /// ```ignore,no_run
12319 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12320 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12321 /// let x = TrinoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12322 /// let x = TrinoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12323 /// ```
12324 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12325 where
12326 T: std::convert::Into<crate::model::LoggingConfig>,
12327 {
12328 self.logging_config = v.map(|x| x.into());
12329 self
12330 }
12331
12332 /// Sets the value of [queries][crate::model::TrinoJob::queries].
12333 ///
12334 /// Note that all the setters affecting `queries` are mutually
12335 /// exclusive.
12336 ///
12337 /// # Example
12338 /// ```ignore,no_run
12339 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12340 /// use google_cloud_dataproc_v1::model::trino_job::Queries;
12341 /// let x = TrinoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12342 /// ```
12343 pub fn set_queries<
12344 T: std::convert::Into<std::option::Option<crate::model::trino_job::Queries>>,
12345 >(
12346 mut self,
12347 v: T,
12348 ) -> Self {
12349 self.queries = v.into();
12350 self
12351 }
12352
12353 /// The value of [queries][crate::model::TrinoJob::queries]
12354 /// if it holds a `QueryFileUri`, `None` if the field is not set or
12355 /// holds a different branch.
12356 pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12357 #[allow(unreachable_patterns)]
12358 self.queries.as_ref().and_then(|v| match v {
12359 crate::model::trino_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12360 _ => std::option::Option::None,
12361 })
12362 }
12363
12364 /// Sets the value of [queries][crate::model::TrinoJob::queries]
12365 /// to hold a `QueryFileUri`.
12366 ///
12367 /// Note that all the setters affecting `queries` are
12368 /// mutually exclusive.
12369 ///
12370 /// # Example
12371 /// ```ignore,no_run
12372 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12373 /// let x = TrinoJob::new().set_query_file_uri("example");
12374 /// assert!(x.query_file_uri().is_some());
12375 /// assert!(x.query_list().is_none());
12376 /// ```
12377 pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12378 self.queries =
12379 std::option::Option::Some(crate::model::trino_job::Queries::QueryFileUri(v.into()));
12380 self
12381 }
12382
12383 /// The value of [queries][crate::model::TrinoJob::queries]
12384 /// if it holds a `QueryList`, `None` if the field is not set or
12385 /// holds a different branch.
12386 pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12387 #[allow(unreachable_patterns)]
12388 self.queries.as_ref().and_then(|v| match v {
12389 crate::model::trino_job::Queries::QueryList(v) => std::option::Option::Some(v),
12390 _ => std::option::Option::None,
12391 })
12392 }
12393
12394 /// Sets the value of [queries][crate::model::TrinoJob::queries]
12395 /// to hold a `QueryList`.
12396 ///
12397 /// Note that all the setters affecting `queries` are
12398 /// mutually exclusive.
12399 ///
12400 /// # Example
12401 /// ```ignore,no_run
12402 /// # use google_cloud_dataproc_v1::model::TrinoJob;
12403 /// use google_cloud_dataproc_v1::model::QueryList;
12404 /// let x = TrinoJob::new().set_query_list(QueryList::default()/* use setters */);
12405 /// assert!(x.query_list().is_some());
12406 /// assert!(x.query_file_uri().is_none());
12407 /// ```
12408 pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12409 mut self,
12410 v: T,
12411 ) -> Self {
12412 self.queries =
12413 std::option::Option::Some(crate::model::trino_job::Queries::QueryList(v.into()));
12414 self
12415 }
12416}
12417
12418impl wkt::message::Message for TrinoJob {
12419 fn typename() -> &'static str {
12420 "type.googleapis.com/google.cloud.dataproc.v1.TrinoJob"
12421 }
12422}
12423
12424/// Defines additional types related to [TrinoJob].
12425pub mod trino_job {
12426 #[allow(unused_imports)]
12427 use super::*;
12428
12429 /// Required. The sequence of Trino queries to execute, specified as
12430 /// either an HCFS file URI or as a list of queries.
12431 #[derive(Clone, Debug, PartialEq)]
12432 #[non_exhaustive]
12433 pub enum Queries {
12434 /// The HCFS URI of the script that contains SQL queries.
12435 QueryFileUri(std::string::String),
12436 /// A list of queries.
12437 QueryList(std::boxed::Box<crate::model::QueryList>),
12438 }
12439}
12440
12441/// A Dataproc job for running Apache Flink applications on YARN.
12442#[derive(Clone, Default, PartialEq)]
12443#[non_exhaustive]
12444pub struct FlinkJob {
12445 /// Optional. The arguments to pass to the driver. Do not include arguments,
12446 /// such as `--conf`, that can be set as job properties, since a collision
12447 /// might occur that causes an incorrect job submission.
12448 pub args: std::vec::Vec<std::string::String>,
12449
12450 /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
12451 /// Flink driver and tasks.
12452 pub jar_file_uris: std::vec::Vec<std::string::String>,
12453
12454 /// Optional. HCFS URI of the savepoint, which contains the last saved progress
12455 /// for starting the current job.
12456 pub savepoint_uri: std::string::String,
12457
12458 /// Optional. A mapping of property names to values, used to configure Flink.
12459 /// Properties that conflict with values set by the Dataproc API might be
12460 /// overwritten. Can include properties set in
12461 /// `/etc/flink/conf/flink-defaults.conf` and classes in user code.
12462 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12463
12464 /// Optional. The runtime log config for job execution.
12465 pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12466
12467 /// Required. The specification of the main method to call to drive the job.
12468 /// Specify either the jar file that contains the main class or the main class
12469 /// name. To pass both a main jar and a main class in the jar, add the jar to
12470 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
12471 /// specify the main class name in
12472 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
12473 ///
12474 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
12475 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
12476 pub driver: std::option::Option<crate::model::flink_job::Driver>,
12477
12478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12479}
12480
12481impl FlinkJob {
12482 pub fn new() -> Self {
12483 std::default::Default::default()
12484 }
12485
12486 /// Sets the value of [args][crate::model::FlinkJob::args].
12487 ///
12488 /// # Example
12489 /// ```ignore,no_run
12490 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12491 /// let x = FlinkJob::new().set_args(["a", "b", "c"]);
12492 /// ```
12493 pub fn set_args<T, V>(mut self, v: T) -> Self
12494 where
12495 T: std::iter::IntoIterator<Item = V>,
12496 V: std::convert::Into<std::string::String>,
12497 {
12498 use std::iter::Iterator;
12499 self.args = v.into_iter().map(|i| i.into()).collect();
12500 self
12501 }
12502
12503 /// Sets the value of [jar_file_uris][crate::model::FlinkJob::jar_file_uris].
12504 ///
12505 /// # Example
12506 /// ```ignore,no_run
12507 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12508 /// let x = FlinkJob::new().set_jar_file_uris(["a", "b", "c"]);
12509 /// ```
12510 pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12511 where
12512 T: std::iter::IntoIterator<Item = V>,
12513 V: std::convert::Into<std::string::String>,
12514 {
12515 use std::iter::Iterator;
12516 self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12517 self
12518 }
12519
12520 /// Sets the value of [savepoint_uri][crate::model::FlinkJob::savepoint_uri].
12521 ///
12522 /// # Example
12523 /// ```ignore,no_run
12524 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12525 /// let x = FlinkJob::new().set_savepoint_uri("example");
12526 /// ```
12527 pub fn set_savepoint_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12528 self.savepoint_uri = v.into();
12529 self
12530 }
12531
12532 /// Sets the value of [properties][crate::model::FlinkJob::properties].
12533 ///
12534 /// # Example
12535 /// ```ignore,no_run
12536 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12537 /// let x = FlinkJob::new().set_properties([
12538 /// ("key0", "abc"),
12539 /// ("key1", "xyz"),
12540 /// ]);
12541 /// ```
12542 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12543 where
12544 T: std::iter::IntoIterator<Item = (K, V)>,
12545 K: std::convert::Into<std::string::String>,
12546 V: std::convert::Into<std::string::String>,
12547 {
12548 use std::iter::Iterator;
12549 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12550 self
12551 }
12552
12553 /// Sets the value of [logging_config][crate::model::FlinkJob::logging_config].
12554 ///
12555 /// # Example
12556 /// ```ignore,no_run
12557 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12558 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12559 /// let x = FlinkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12560 /// ```
12561 pub fn set_logging_config<T>(mut self, v: T) -> Self
12562 where
12563 T: std::convert::Into<crate::model::LoggingConfig>,
12564 {
12565 self.logging_config = std::option::Option::Some(v.into());
12566 self
12567 }
12568
12569 /// Sets or clears the value of [logging_config][crate::model::FlinkJob::logging_config].
12570 ///
12571 /// # Example
12572 /// ```ignore,no_run
12573 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12574 /// use google_cloud_dataproc_v1::model::LoggingConfig;
12575 /// let x = FlinkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12576 /// let x = FlinkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12577 /// ```
12578 pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12579 where
12580 T: std::convert::Into<crate::model::LoggingConfig>,
12581 {
12582 self.logging_config = v.map(|x| x.into());
12583 self
12584 }
12585
12586 /// Sets the value of [driver][crate::model::FlinkJob::driver].
12587 ///
12588 /// Note that all the setters affecting `driver` are mutually
12589 /// exclusive.
12590 ///
12591 /// # Example
12592 /// ```ignore,no_run
12593 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12594 /// use google_cloud_dataproc_v1::model::flink_job::Driver;
12595 /// let x = FlinkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
12596 /// ```
12597 pub fn set_driver<
12598 T: std::convert::Into<std::option::Option<crate::model::flink_job::Driver>>,
12599 >(
12600 mut self,
12601 v: T,
12602 ) -> Self {
12603 self.driver = v.into();
12604 self
12605 }
12606
12607 /// The value of [driver][crate::model::FlinkJob::driver]
12608 /// if it holds a `MainJarFileUri`, `None` if the field is not set or
12609 /// holds a different branch.
12610 pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
12611 #[allow(unreachable_patterns)]
12612 self.driver.as_ref().and_then(|v| match v {
12613 crate::model::flink_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
12614 _ => std::option::Option::None,
12615 })
12616 }
12617
12618 /// Sets the value of [driver][crate::model::FlinkJob::driver]
12619 /// to hold a `MainJarFileUri`.
12620 ///
12621 /// Note that all the setters affecting `driver` are
12622 /// mutually exclusive.
12623 ///
12624 /// # Example
12625 /// ```ignore,no_run
12626 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12627 /// let x = FlinkJob::new().set_main_jar_file_uri("example");
12628 /// assert!(x.main_jar_file_uri().is_some());
12629 /// assert!(x.main_class().is_none());
12630 /// ```
12631 pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
12632 mut self,
12633 v: T,
12634 ) -> Self {
12635 self.driver =
12636 std::option::Option::Some(crate::model::flink_job::Driver::MainJarFileUri(v.into()));
12637 self
12638 }
12639
12640 /// The value of [driver][crate::model::FlinkJob::driver]
12641 /// if it holds a `MainClass`, `None` if the field is not set or
12642 /// holds a different branch.
12643 pub fn main_class(&self) -> std::option::Option<&std::string::String> {
12644 #[allow(unreachable_patterns)]
12645 self.driver.as_ref().and_then(|v| match v {
12646 crate::model::flink_job::Driver::MainClass(v) => std::option::Option::Some(v),
12647 _ => std::option::Option::None,
12648 })
12649 }
12650
12651 /// Sets the value of [driver][crate::model::FlinkJob::driver]
12652 /// to hold a `MainClass`.
12653 ///
12654 /// Note that all the setters affecting `driver` are
12655 /// mutually exclusive.
12656 ///
12657 /// # Example
12658 /// ```ignore,no_run
12659 /// # use google_cloud_dataproc_v1::model::FlinkJob;
12660 /// let x = FlinkJob::new().set_main_class("example");
12661 /// assert!(x.main_class().is_some());
12662 /// assert!(x.main_jar_file_uri().is_none());
12663 /// ```
12664 pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12665 self.driver =
12666 std::option::Option::Some(crate::model::flink_job::Driver::MainClass(v.into()));
12667 self
12668 }
12669}
12670
12671impl wkt::message::Message for FlinkJob {
12672 fn typename() -> &'static str {
12673 "type.googleapis.com/google.cloud.dataproc.v1.FlinkJob"
12674 }
12675}
12676
12677/// Defines additional types related to [FlinkJob].
12678pub mod flink_job {
12679 #[allow(unused_imports)]
12680 use super::*;
12681
12682 /// Required. The specification of the main method to call to drive the job.
12683 /// Specify either the jar file that contains the main class or the main class
12684 /// name. To pass both a main jar and a main class in the jar, add the jar to
12685 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
12686 /// specify the main class name in
12687 /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
12688 ///
12689 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
12690 /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
12691 #[derive(Clone, Debug, PartialEq)]
12692 #[non_exhaustive]
12693 pub enum Driver {
12694 /// The HCFS URI of the jar file that contains the main class.
12695 MainJarFileUri(std::string::String),
12696 /// The name of the driver's main class. The jar file that contains the class
12697 /// must be in the default CLASSPATH or specified in
12698 /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris].
12699 ///
12700 /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
12701 MainClass(std::string::String),
12702 }
12703}
12704
12705/// Dataproc job config.
12706#[derive(Clone, Default, PartialEq)]
12707#[non_exhaustive]
12708pub struct JobPlacement {
12709 /// Required. The name of the cluster where the job will be submitted.
12710 pub cluster_name: std::string::String,
12711
12712 /// Output only. A cluster UUID generated by the Dataproc service when
12713 /// the job is submitted.
12714 pub cluster_uuid: std::string::String,
12715
12716 /// Optional. Cluster labels to identify a cluster where the job will be
12717 /// submitted.
12718 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
12719
12720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12721}
12722
12723impl JobPlacement {
12724 pub fn new() -> Self {
12725 std::default::Default::default()
12726 }
12727
12728 /// Sets the value of [cluster_name][crate::model::JobPlacement::cluster_name].
12729 ///
12730 /// # Example
12731 /// ```ignore,no_run
12732 /// # use google_cloud_dataproc_v1::model::JobPlacement;
12733 /// let x = JobPlacement::new().set_cluster_name("example");
12734 /// ```
12735 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12736 self.cluster_name = v.into();
12737 self
12738 }
12739
12740 /// Sets the value of [cluster_uuid][crate::model::JobPlacement::cluster_uuid].
12741 ///
12742 /// # Example
12743 /// ```ignore,no_run
12744 /// # use google_cloud_dataproc_v1::model::JobPlacement;
12745 /// let x = JobPlacement::new().set_cluster_uuid("example");
12746 /// ```
12747 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12748 self.cluster_uuid = v.into();
12749 self
12750 }
12751
12752 /// Sets the value of [cluster_labels][crate::model::JobPlacement::cluster_labels].
12753 ///
12754 /// # Example
12755 /// ```ignore,no_run
12756 /// # use google_cloud_dataproc_v1::model::JobPlacement;
12757 /// let x = JobPlacement::new().set_cluster_labels([
12758 /// ("key0", "abc"),
12759 /// ("key1", "xyz"),
12760 /// ]);
12761 /// ```
12762 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
12763 where
12764 T: std::iter::IntoIterator<Item = (K, V)>,
12765 K: std::convert::Into<std::string::String>,
12766 V: std::convert::Into<std::string::String>,
12767 {
12768 use std::iter::Iterator;
12769 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12770 self
12771 }
12772}
12773
12774impl wkt::message::Message for JobPlacement {
12775 fn typename() -> &'static str {
12776 "type.googleapis.com/google.cloud.dataproc.v1.JobPlacement"
12777 }
12778}
12779
12780/// Dataproc job status.
12781#[derive(Clone, Default, PartialEq)]
12782#[non_exhaustive]
12783pub struct JobStatus {
12784 /// Output only. A state message specifying the overall job state.
12785 pub state: crate::model::job_status::State,
12786
12787 /// Optional. Output only. Job state details, such as an error
12788 /// description if the state is `ERROR`.
12789 pub details: std::string::String,
12790
12791 /// Output only. The time when this state was entered.
12792 pub state_start_time: std::option::Option<wkt::Timestamp>,
12793
12794 /// Output only. Additional state information, which includes
12795 /// status reported by the agent.
12796 pub substate: crate::model::job_status::Substate,
12797
12798 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12799}
12800
12801impl JobStatus {
12802 pub fn new() -> Self {
12803 std::default::Default::default()
12804 }
12805
12806 /// Sets the value of [state][crate::model::JobStatus::state].
12807 ///
12808 /// # Example
12809 /// ```ignore,no_run
12810 /// # use google_cloud_dataproc_v1::model::JobStatus;
12811 /// use google_cloud_dataproc_v1::model::job_status::State;
12812 /// let x0 = JobStatus::new().set_state(State::Pending);
12813 /// let x1 = JobStatus::new().set_state(State::SetupDone);
12814 /// let x2 = JobStatus::new().set_state(State::Running);
12815 /// ```
12816 pub fn set_state<T: std::convert::Into<crate::model::job_status::State>>(
12817 mut self,
12818 v: T,
12819 ) -> Self {
12820 self.state = v.into();
12821 self
12822 }
12823
12824 /// Sets the value of [details][crate::model::JobStatus::details].
12825 ///
12826 /// # Example
12827 /// ```ignore,no_run
12828 /// # use google_cloud_dataproc_v1::model::JobStatus;
12829 /// let x = JobStatus::new().set_details("example");
12830 /// ```
12831 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12832 self.details = v.into();
12833 self
12834 }
12835
12836 /// Sets the value of [state_start_time][crate::model::JobStatus::state_start_time].
12837 ///
12838 /// # Example
12839 /// ```ignore,no_run
12840 /// # use google_cloud_dataproc_v1::model::JobStatus;
12841 /// use wkt::Timestamp;
12842 /// let x = JobStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
12843 /// ```
12844 pub fn set_state_start_time<T>(mut self, v: T) -> Self
12845 where
12846 T: std::convert::Into<wkt::Timestamp>,
12847 {
12848 self.state_start_time = std::option::Option::Some(v.into());
12849 self
12850 }
12851
12852 /// Sets or clears the value of [state_start_time][crate::model::JobStatus::state_start_time].
12853 ///
12854 /// # Example
12855 /// ```ignore,no_run
12856 /// # use google_cloud_dataproc_v1::model::JobStatus;
12857 /// use wkt::Timestamp;
12858 /// let x = JobStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
12859 /// let x = JobStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
12860 /// ```
12861 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
12862 where
12863 T: std::convert::Into<wkt::Timestamp>,
12864 {
12865 self.state_start_time = v.map(|x| x.into());
12866 self
12867 }
12868
12869 /// Sets the value of [substate][crate::model::JobStatus::substate].
12870 ///
12871 /// # Example
12872 /// ```ignore,no_run
12873 /// # use google_cloud_dataproc_v1::model::JobStatus;
12874 /// use google_cloud_dataproc_v1::model::job_status::Substate;
12875 /// let x0 = JobStatus::new().set_substate(Substate::Submitted);
12876 /// let x1 = JobStatus::new().set_substate(Substate::Queued);
12877 /// let x2 = JobStatus::new().set_substate(Substate::StaleStatus);
12878 /// ```
12879 pub fn set_substate<T: std::convert::Into<crate::model::job_status::Substate>>(
12880 mut self,
12881 v: T,
12882 ) -> Self {
12883 self.substate = v.into();
12884 self
12885 }
12886}
12887
12888impl wkt::message::Message for JobStatus {
12889 fn typename() -> &'static str {
12890 "type.googleapis.com/google.cloud.dataproc.v1.JobStatus"
12891 }
12892}
12893
12894/// Defines additional types related to [JobStatus].
12895pub mod job_status {
12896 #[allow(unused_imports)]
12897 use super::*;
12898
12899 /// The job state.
12900 ///
12901 /// # Working with unknown values
12902 ///
12903 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12904 /// additional enum variants at any time. Adding new variants is not considered
12905 /// a breaking change. Applications should write their code in anticipation of:
12906 ///
12907 /// - New values appearing in future releases of the client library, **and**
12908 /// - New values received dynamically, without application changes.
12909 ///
12910 /// Please consult the [Working with enums] section in the user guide for some
12911 /// guidelines.
12912 ///
12913 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12914 #[derive(Clone, Debug, PartialEq)]
12915 #[non_exhaustive]
12916 pub enum State {
12917 /// The job state is unknown.
12918 Unspecified,
12919 /// The job is pending; it has been submitted, but is not yet running.
12920 Pending,
12921 /// Job has been received by the service and completed initial setup;
12922 /// it will soon be submitted to the cluster.
12923 SetupDone,
12924 /// The job is running on the cluster.
12925 Running,
12926 /// A CancelJob request has been received, but is pending.
12927 CancelPending,
12928 /// Transient in-flight resources have been canceled, and the request to
12929 /// cancel the running job has been issued to the cluster.
12930 CancelStarted,
12931 /// The job cancellation was successful.
12932 Cancelled,
12933 /// The job has completed successfully.
12934 Done,
12935 /// The job has completed, but encountered an error.
12936 Error,
12937 /// Job attempt has failed. The detail field contains failure details for
12938 /// this attempt.
12939 ///
12940 /// Applies to restartable jobs only.
12941 AttemptFailure,
12942 /// If set, the enum was initialized with an unknown value.
12943 ///
12944 /// Applications can examine the value using [State::value] or
12945 /// [State::name].
12946 UnknownValue(state::UnknownValue),
12947 }
12948
12949 #[doc(hidden)]
12950 pub mod state {
12951 #[allow(unused_imports)]
12952 use super::*;
12953 #[derive(Clone, Debug, PartialEq)]
12954 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12955 }
12956
12957 impl State {
12958 /// Gets the enum value.
12959 ///
12960 /// Returns `None` if the enum contains an unknown value deserialized from
12961 /// the string representation of enums.
12962 pub fn value(&self) -> std::option::Option<i32> {
12963 match self {
12964 Self::Unspecified => std::option::Option::Some(0),
12965 Self::Pending => std::option::Option::Some(1),
12966 Self::SetupDone => std::option::Option::Some(8),
12967 Self::Running => std::option::Option::Some(2),
12968 Self::CancelPending => std::option::Option::Some(3),
12969 Self::CancelStarted => std::option::Option::Some(7),
12970 Self::Cancelled => std::option::Option::Some(4),
12971 Self::Done => std::option::Option::Some(5),
12972 Self::Error => std::option::Option::Some(6),
12973 Self::AttemptFailure => std::option::Option::Some(9),
12974 Self::UnknownValue(u) => u.0.value(),
12975 }
12976 }
12977
12978 /// Gets the enum value as a string.
12979 ///
12980 /// Returns `None` if the enum contains an unknown value deserialized from
12981 /// the integer representation of enums.
12982 pub fn name(&self) -> std::option::Option<&str> {
12983 match self {
12984 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12985 Self::Pending => std::option::Option::Some("PENDING"),
12986 Self::SetupDone => std::option::Option::Some("SETUP_DONE"),
12987 Self::Running => std::option::Option::Some("RUNNING"),
12988 Self::CancelPending => std::option::Option::Some("CANCEL_PENDING"),
12989 Self::CancelStarted => std::option::Option::Some("CANCEL_STARTED"),
12990 Self::Cancelled => std::option::Option::Some("CANCELLED"),
12991 Self::Done => std::option::Option::Some("DONE"),
12992 Self::Error => std::option::Option::Some("ERROR"),
12993 Self::AttemptFailure => std::option::Option::Some("ATTEMPT_FAILURE"),
12994 Self::UnknownValue(u) => u.0.name(),
12995 }
12996 }
12997 }
12998
12999 impl std::default::Default for State {
13000 fn default() -> Self {
13001 use std::convert::From;
13002 Self::from(0)
13003 }
13004 }
13005
13006 impl std::fmt::Display for State {
13007 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13008 wkt::internal::display_enum(f, self.name(), self.value())
13009 }
13010 }
13011
13012 impl std::convert::From<i32> for State {
13013 fn from(value: i32) -> Self {
13014 match value {
13015 0 => Self::Unspecified,
13016 1 => Self::Pending,
13017 2 => Self::Running,
13018 3 => Self::CancelPending,
13019 4 => Self::Cancelled,
13020 5 => Self::Done,
13021 6 => Self::Error,
13022 7 => Self::CancelStarted,
13023 8 => Self::SetupDone,
13024 9 => Self::AttemptFailure,
13025 _ => Self::UnknownValue(state::UnknownValue(
13026 wkt::internal::UnknownEnumValue::Integer(value),
13027 )),
13028 }
13029 }
13030 }
13031
13032 impl std::convert::From<&str> for State {
13033 fn from(value: &str) -> Self {
13034 use std::string::ToString;
13035 match value {
13036 "STATE_UNSPECIFIED" => Self::Unspecified,
13037 "PENDING" => Self::Pending,
13038 "SETUP_DONE" => Self::SetupDone,
13039 "RUNNING" => Self::Running,
13040 "CANCEL_PENDING" => Self::CancelPending,
13041 "CANCEL_STARTED" => Self::CancelStarted,
13042 "CANCELLED" => Self::Cancelled,
13043 "DONE" => Self::Done,
13044 "ERROR" => Self::Error,
13045 "ATTEMPT_FAILURE" => Self::AttemptFailure,
13046 _ => Self::UnknownValue(state::UnknownValue(
13047 wkt::internal::UnknownEnumValue::String(value.to_string()),
13048 )),
13049 }
13050 }
13051 }
13052
13053 impl serde::ser::Serialize for State {
13054 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13055 where
13056 S: serde::Serializer,
13057 {
13058 match self {
13059 Self::Unspecified => serializer.serialize_i32(0),
13060 Self::Pending => serializer.serialize_i32(1),
13061 Self::SetupDone => serializer.serialize_i32(8),
13062 Self::Running => serializer.serialize_i32(2),
13063 Self::CancelPending => serializer.serialize_i32(3),
13064 Self::CancelStarted => serializer.serialize_i32(7),
13065 Self::Cancelled => serializer.serialize_i32(4),
13066 Self::Done => serializer.serialize_i32(5),
13067 Self::Error => serializer.serialize_i32(6),
13068 Self::AttemptFailure => serializer.serialize_i32(9),
13069 Self::UnknownValue(u) => u.0.serialize(serializer),
13070 }
13071 }
13072 }
13073
13074 impl<'de> serde::de::Deserialize<'de> for State {
13075 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13076 where
13077 D: serde::Deserializer<'de>,
13078 {
13079 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13080 ".google.cloud.dataproc.v1.JobStatus.State",
13081 ))
13082 }
13083 }
13084
13085 /// The job substate.
13086 ///
13087 /// # Working with unknown values
13088 ///
13089 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13090 /// additional enum variants at any time. Adding new variants is not considered
13091 /// a breaking change. Applications should write their code in anticipation of:
13092 ///
13093 /// - New values appearing in future releases of the client library, **and**
13094 /// - New values received dynamically, without application changes.
13095 ///
13096 /// Please consult the [Working with enums] section in the user guide for some
13097 /// guidelines.
13098 ///
13099 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13100 #[derive(Clone, Debug, PartialEq)]
13101 #[non_exhaustive]
13102 pub enum Substate {
13103 /// The job substate is unknown.
13104 Unspecified,
13105 /// The Job is submitted to the agent.
13106 ///
13107 /// Applies to RUNNING state.
13108 Submitted,
13109 /// The Job has been received and is awaiting execution (it might be waiting
13110 /// for a condition to be met). See the "details" field for the reason for
13111 /// the delay.
13112 ///
13113 /// Applies to RUNNING state.
13114 Queued,
13115 /// The agent-reported status is out of date, which can be caused by a
13116 /// loss of communication between the agent and Dataproc. If the
13117 /// agent does not send a timely update, the job will fail.
13118 ///
13119 /// Applies to RUNNING state.
13120 StaleStatus,
13121 /// If set, the enum was initialized with an unknown value.
13122 ///
13123 /// Applications can examine the value using [Substate::value] or
13124 /// [Substate::name].
13125 UnknownValue(substate::UnknownValue),
13126 }
13127
13128 #[doc(hidden)]
13129 pub mod substate {
13130 #[allow(unused_imports)]
13131 use super::*;
13132 #[derive(Clone, Debug, PartialEq)]
13133 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13134 }
13135
13136 impl Substate {
13137 /// Gets the enum value.
13138 ///
13139 /// Returns `None` if the enum contains an unknown value deserialized from
13140 /// the string representation of enums.
13141 pub fn value(&self) -> std::option::Option<i32> {
13142 match self {
13143 Self::Unspecified => std::option::Option::Some(0),
13144 Self::Submitted => std::option::Option::Some(1),
13145 Self::Queued => std::option::Option::Some(2),
13146 Self::StaleStatus => std::option::Option::Some(3),
13147 Self::UnknownValue(u) => u.0.value(),
13148 }
13149 }
13150
13151 /// Gets the enum value as a string.
13152 ///
13153 /// Returns `None` if the enum contains an unknown value deserialized from
13154 /// the integer representation of enums.
13155 pub fn name(&self) -> std::option::Option<&str> {
13156 match self {
13157 Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
13158 Self::Submitted => std::option::Option::Some("SUBMITTED"),
13159 Self::Queued => std::option::Option::Some("QUEUED"),
13160 Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
13161 Self::UnknownValue(u) => u.0.name(),
13162 }
13163 }
13164 }
13165
13166 impl std::default::Default for Substate {
13167 fn default() -> Self {
13168 use std::convert::From;
13169 Self::from(0)
13170 }
13171 }
13172
13173 impl std::fmt::Display for Substate {
13174 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13175 wkt::internal::display_enum(f, self.name(), self.value())
13176 }
13177 }
13178
13179 impl std::convert::From<i32> for Substate {
13180 fn from(value: i32) -> Self {
13181 match value {
13182 0 => Self::Unspecified,
13183 1 => Self::Submitted,
13184 2 => Self::Queued,
13185 3 => Self::StaleStatus,
13186 _ => Self::UnknownValue(substate::UnknownValue(
13187 wkt::internal::UnknownEnumValue::Integer(value),
13188 )),
13189 }
13190 }
13191 }
13192
13193 impl std::convert::From<&str> for Substate {
13194 fn from(value: &str) -> Self {
13195 use std::string::ToString;
13196 match value {
13197 "UNSPECIFIED" => Self::Unspecified,
13198 "SUBMITTED" => Self::Submitted,
13199 "QUEUED" => Self::Queued,
13200 "STALE_STATUS" => Self::StaleStatus,
13201 _ => Self::UnknownValue(substate::UnknownValue(
13202 wkt::internal::UnknownEnumValue::String(value.to_string()),
13203 )),
13204 }
13205 }
13206 }
13207
13208 impl serde::ser::Serialize for Substate {
13209 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13210 where
13211 S: serde::Serializer,
13212 {
13213 match self {
13214 Self::Unspecified => serializer.serialize_i32(0),
13215 Self::Submitted => serializer.serialize_i32(1),
13216 Self::Queued => serializer.serialize_i32(2),
13217 Self::StaleStatus => serializer.serialize_i32(3),
13218 Self::UnknownValue(u) => u.0.serialize(serializer),
13219 }
13220 }
13221 }
13222
13223 impl<'de> serde::de::Deserialize<'de> for Substate {
13224 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13225 where
13226 D: serde::Deserializer<'de>,
13227 {
13228 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
13229 ".google.cloud.dataproc.v1.JobStatus.Substate",
13230 ))
13231 }
13232 }
13233}
13234
13235/// Encapsulates the full scoping used to reference a job.
13236#[derive(Clone, Default, PartialEq)]
13237#[non_exhaustive]
13238pub struct JobReference {
13239 /// Optional. The ID of the Google Cloud Platform project that the job belongs
13240 /// to. If specified, must match the request project ID.
13241 pub project_id: std::string::String,
13242
13243 /// Optional. The job ID, which must be unique within the project.
13244 ///
13245 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
13246 /// underscores (_), or hyphens (-). The maximum length is 100 characters.
13247 ///
13248 /// If not specified by the caller, the job ID will be provided by the server.
13249 pub job_id: std::string::String,
13250
13251 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13252}
13253
13254impl JobReference {
13255 pub fn new() -> Self {
13256 std::default::Default::default()
13257 }
13258
13259 /// Sets the value of [project_id][crate::model::JobReference::project_id].
13260 ///
13261 /// # Example
13262 /// ```ignore,no_run
13263 /// # use google_cloud_dataproc_v1::model::JobReference;
13264 /// let x = JobReference::new().set_project_id("example");
13265 /// ```
13266 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13267 self.project_id = v.into();
13268 self
13269 }
13270
13271 /// Sets the value of [job_id][crate::model::JobReference::job_id].
13272 ///
13273 /// # Example
13274 /// ```ignore,no_run
13275 /// # use google_cloud_dataproc_v1::model::JobReference;
13276 /// let x = JobReference::new().set_job_id("example");
13277 /// ```
13278 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13279 self.job_id = v.into();
13280 self
13281 }
13282}
13283
13284impl wkt::message::Message for JobReference {
13285 fn typename() -> &'static str {
13286 "type.googleapis.com/google.cloud.dataproc.v1.JobReference"
13287 }
13288}
13289
13290/// A YARN application created by a job. Application information is a subset of
13291/// \<code\>org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto\</code\>.
13292///
13293/// **Beta Feature**: This report is available for testing purposes only. It may
13294/// be changed before final release.
13295#[derive(Clone, Default, PartialEq)]
13296#[non_exhaustive]
13297pub struct YarnApplication {
13298 /// Required. The application name.
13299 pub name: std::string::String,
13300
13301 /// Required. The application state.
13302 pub state: crate::model::yarn_application::State,
13303
13304 /// Required. The numerical progress of the application, from 1 to 100.
13305 pub progress: f32,
13306
13307 /// Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or
13308 /// TimelineServer that provides application-specific information. The URL uses
13309 /// the internal hostname, and requires a proxy server for resolution and,
13310 /// possibly, access.
13311 pub tracking_url: std::string::String,
13312
13313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13314}
13315
13316impl YarnApplication {
13317 pub fn new() -> Self {
13318 std::default::Default::default()
13319 }
13320
13321 /// Sets the value of [name][crate::model::YarnApplication::name].
13322 ///
13323 /// # Example
13324 /// ```ignore,no_run
13325 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13326 /// let x = YarnApplication::new().set_name("example");
13327 /// ```
13328 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13329 self.name = v.into();
13330 self
13331 }
13332
13333 /// Sets the value of [state][crate::model::YarnApplication::state].
13334 ///
13335 /// # Example
13336 /// ```ignore,no_run
13337 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13338 /// use google_cloud_dataproc_v1::model::yarn_application::State;
13339 /// let x0 = YarnApplication::new().set_state(State::New);
13340 /// let x1 = YarnApplication::new().set_state(State::NewSaving);
13341 /// let x2 = YarnApplication::new().set_state(State::Submitted);
13342 /// ```
13343 pub fn set_state<T: std::convert::Into<crate::model::yarn_application::State>>(
13344 mut self,
13345 v: T,
13346 ) -> Self {
13347 self.state = v.into();
13348 self
13349 }
13350
13351 /// Sets the value of [progress][crate::model::YarnApplication::progress].
13352 ///
13353 /// # Example
13354 /// ```ignore,no_run
13355 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13356 /// let x = YarnApplication::new().set_progress(42.0);
13357 /// ```
13358 pub fn set_progress<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
13359 self.progress = v.into();
13360 self
13361 }
13362
13363 /// Sets the value of [tracking_url][crate::model::YarnApplication::tracking_url].
13364 ///
13365 /// # Example
13366 /// ```ignore,no_run
13367 /// # use google_cloud_dataproc_v1::model::YarnApplication;
13368 /// let x = YarnApplication::new().set_tracking_url("example");
13369 /// ```
13370 pub fn set_tracking_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13371 self.tracking_url = v.into();
13372 self
13373 }
13374}
13375
13376impl wkt::message::Message for YarnApplication {
13377 fn typename() -> &'static str {
13378 "type.googleapis.com/google.cloud.dataproc.v1.YarnApplication"
13379 }
13380}
13381
13382/// Defines additional types related to [YarnApplication].
13383pub mod yarn_application {
13384 #[allow(unused_imports)]
13385 use super::*;
13386
13387 /// The application state, corresponding to
13388 /// \<code\>YarnProtos.YarnApplicationStateProto\</code\>.
13389 ///
13390 /// # Working with unknown values
13391 ///
13392 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13393 /// additional enum variants at any time. Adding new variants is not considered
13394 /// a breaking change. Applications should write their code in anticipation of:
13395 ///
13396 /// - New values appearing in future releases of the client library, **and**
13397 /// - New values received dynamically, without application changes.
13398 ///
13399 /// Please consult the [Working with enums] section in the user guide for some
13400 /// guidelines.
13401 ///
13402 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13403 #[derive(Clone, Debug, PartialEq)]
13404 #[non_exhaustive]
13405 pub enum State {
13406 /// Status is unspecified.
13407 Unspecified,
13408 /// Status is NEW.
13409 New,
13410 /// Status is NEW_SAVING.
13411 NewSaving,
13412 /// Status is SUBMITTED.
13413 Submitted,
13414 /// Status is ACCEPTED.
13415 Accepted,
13416 /// Status is RUNNING.
13417 Running,
13418 /// Status is FINISHED.
13419 Finished,
13420 /// Status is FAILED.
13421 Failed,
13422 /// Status is KILLED.
13423 Killed,
13424 /// If set, the enum was initialized with an unknown value.
13425 ///
13426 /// Applications can examine the value using [State::value] or
13427 /// [State::name].
13428 UnknownValue(state::UnknownValue),
13429 }
13430
13431 #[doc(hidden)]
13432 pub mod state {
13433 #[allow(unused_imports)]
13434 use super::*;
13435 #[derive(Clone, Debug, PartialEq)]
13436 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13437 }
13438
13439 impl State {
13440 /// Gets the enum value.
13441 ///
13442 /// Returns `None` if the enum contains an unknown value deserialized from
13443 /// the string representation of enums.
13444 pub fn value(&self) -> std::option::Option<i32> {
13445 match self {
13446 Self::Unspecified => std::option::Option::Some(0),
13447 Self::New => std::option::Option::Some(1),
13448 Self::NewSaving => std::option::Option::Some(2),
13449 Self::Submitted => std::option::Option::Some(3),
13450 Self::Accepted => std::option::Option::Some(4),
13451 Self::Running => std::option::Option::Some(5),
13452 Self::Finished => std::option::Option::Some(6),
13453 Self::Failed => std::option::Option::Some(7),
13454 Self::Killed => std::option::Option::Some(8),
13455 Self::UnknownValue(u) => u.0.value(),
13456 }
13457 }
13458
13459 /// Gets the enum value as a string.
13460 ///
13461 /// Returns `None` if the enum contains an unknown value deserialized from
13462 /// the integer representation of enums.
13463 pub fn name(&self) -> std::option::Option<&str> {
13464 match self {
13465 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13466 Self::New => std::option::Option::Some("NEW"),
13467 Self::NewSaving => std::option::Option::Some("NEW_SAVING"),
13468 Self::Submitted => std::option::Option::Some("SUBMITTED"),
13469 Self::Accepted => std::option::Option::Some("ACCEPTED"),
13470 Self::Running => std::option::Option::Some("RUNNING"),
13471 Self::Finished => std::option::Option::Some("FINISHED"),
13472 Self::Failed => std::option::Option::Some("FAILED"),
13473 Self::Killed => std::option::Option::Some("KILLED"),
13474 Self::UnknownValue(u) => u.0.name(),
13475 }
13476 }
13477 }
13478
13479 impl std::default::Default for State {
13480 fn default() -> Self {
13481 use std::convert::From;
13482 Self::from(0)
13483 }
13484 }
13485
13486 impl std::fmt::Display for State {
13487 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13488 wkt::internal::display_enum(f, self.name(), self.value())
13489 }
13490 }
13491
13492 impl std::convert::From<i32> for State {
13493 fn from(value: i32) -> Self {
13494 match value {
13495 0 => Self::Unspecified,
13496 1 => Self::New,
13497 2 => Self::NewSaving,
13498 3 => Self::Submitted,
13499 4 => Self::Accepted,
13500 5 => Self::Running,
13501 6 => Self::Finished,
13502 7 => Self::Failed,
13503 8 => Self::Killed,
13504 _ => Self::UnknownValue(state::UnknownValue(
13505 wkt::internal::UnknownEnumValue::Integer(value),
13506 )),
13507 }
13508 }
13509 }
13510
13511 impl std::convert::From<&str> for State {
13512 fn from(value: &str) -> Self {
13513 use std::string::ToString;
13514 match value {
13515 "STATE_UNSPECIFIED" => Self::Unspecified,
13516 "NEW" => Self::New,
13517 "NEW_SAVING" => Self::NewSaving,
13518 "SUBMITTED" => Self::Submitted,
13519 "ACCEPTED" => Self::Accepted,
13520 "RUNNING" => Self::Running,
13521 "FINISHED" => Self::Finished,
13522 "FAILED" => Self::Failed,
13523 "KILLED" => Self::Killed,
13524 _ => Self::UnknownValue(state::UnknownValue(
13525 wkt::internal::UnknownEnumValue::String(value.to_string()),
13526 )),
13527 }
13528 }
13529 }
13530
13531 impl serde::ser::Serialize for State {
13532 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13533 where
13534 S: serde::Serializer,
13535 {
13536 match self {
13537 Self::Unspecified => serializer.serialize_i32(0),
13538 Self::New => serializer.serialize_i32(1),
13539 Self::NewSaving => serializer.serialize_i32(2),
13540 Self::Submitted => serializer.serialize_i32(3),
13541 Self::Accepted => serializer.serialize_i32(4),
13542 Self::Running => serializer.serialize_i32(5),
13543 Self::Finished => serializer.serialize_i32(6),
13544 Self::Failed => serializer.serialize_i32(7),
13545 Self::Killed => serializer.serialize_i32(8),
13546 Self::UnknownValue(u) => u.0.serialize(serializer),
13547 }
13548 }
13549 }
13550
13551 impl<'de> serde::de::Deserialize<'de> for State {
13552 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13553 where
13554 D: serde::Deserializer<'de>,
13555 {
13556 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13557 ".google.cloud.dataproc.v1.YarnApplication.State",
13558 ))
13559 }
13560 }
13561}
13562
13563/// A Dataproc job resource.
13564#[derive(Clone, Default, PartialEq)]
13565#[non_exhaustive]
13566pub struct Job {
13567 /// Optional. The fully qualified reference to the job, which can be used to
13568 /// obtain the equivalent REST path of the job resource. If this property
13569 /// is not specified when a job is created, the server generates a
13570 /// \<code\>job_id\</code\>.
13571 pub reference: std::option::Option<crate::model::JobReference>,
13572
13573 /// Required. Job information, including how, when, and where to
13574 /// run the job.
13575 pub placement: std::option::Option<crate::model::JobPlacement>,
13576
13577 /// Output only. The job status. Additional application-specific
13578 /// status information might be contained in the \<code\>type_job\</code\>
13579 /// and \<code\>yarn_applications\</code\> fields.
13580 pub status: std::option::Option<crate::model::JobStatus>,
13581
13582 /// Output only. The previous job status.
13583 pub status_history: std::vec::Vec<crate::model::JobStatus>,
13584
13585 /// Output only. The collection of YARN applications spun up by this job.
13586 ///
13587 /// **Beta** Feature: This report is available for testing purposes only. It
13588 /// might be changed before final release.
13589 pub yarn_applications: std::vec::Vec<crate::model::YarnApplication>,
13590
13591 /// Output only. A URI pointing to the location of the stdout of the job's
13592 /// driver program.
13593 pub driver_output_resource_uri: std::string::String,
13594
13595 /// Output only. If present, the location of miscellaneous control files
13596 /// which can be used as part of job setup and handling. If not present,
13597 /// control files might be placed in the same location as `driver_output_uri`.
13598 pub driver_control_files_uri: std::string::String,
13599
13600 /// Optional. The labels to associate with this job.
13601 /// Label **keys** must contain 1 to 63 characters, and must conform to
13602 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
13603 /// Label **values** can be empty, but, if present, must contain 1 to 63
13604 /// characters, and must conform to [RFC
13605 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
13606 /// associated with a job.
13607 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
13608
13609 /// Optional. Job scheduling configuration.
13610 pub scheduling: std::option::Option<crate::model::JobScheduling>,
13611
13612 /// Output only. A UUID that uniquely identifies a job within the project
13613 /// over time. This is in contrast to a user-settable reference.job_id that
13614 /// might be reused over time.
13615 pub job_uuid: std::string::String,
13616
13617 /// Output only. Indicates whether the job is completed. If the value is
13618 /// `false`, the job is still in progress. If `true`, the job is completed, and
13619 /// `status.state` field will indicate if it was successful, failed,
13620 /// or cancelled.
13621 pub done: bool,
13622
13623 /// Optional. Driver scheduling configuration.
13624 pub driver_scheduling_config: std::option::Option<crate::model::DriverSchedulingConfig>,
13625
13626 /// Required. The application/framework-specific portion of the job.
13627 pub type_job: std::option::Option<crate::model::job::TypeJob>,
13628
13629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13630}
13631
13632impl Job {
13633 pub fn new() -> Self {
13634 std::default::Default::default()
13635 }
13636
13637 /// Sets the value of [reference][crate::model::Job::reference].
13638 ///
13639 /// # Example
13640 /// ```ignore,no_run
13641 /// # use google_cloud_dataproc_v1::model::Job;
13642 /// use google_cloud_dataproc_v1::model::JobReference;
13643 /// let x = Job::new().set_reference(JobReference::default()/* use setters */);
13644 /// ```
13645 pub fn set_reference<T>(mut self, v: T) -> Self
13646 where
13647 T: std::convert::Into<crate::model::JobReference>,
13648 {
13649 self.reference = std::option::Option::Some(v.into());
13650 self
13651 }
13652
13653 /// Sets or clears the value of [reference][crate::model::Job::reference].
13654 ///
13655 /// # Example
13656 /// ```ignore,no_run
13657 /// # use google_cloud_dataproc_v1::model::Job;
13658 /// use google_cloud_dataproc_v1::model::JobReference;
13659 /// let x = Job::new().set_or_clear_reference(Some(JobReference::default()/* use setters */));
13660 /// let x = Job::new().set_or_clear_reference(None::<JobReference>);
13661 /// ```
13662 pub fn set_or_clear_reference<T>(mut self, v: std::option::Option<T>) -> Self
13663 where
13664 T: std::convert::Into<crate::model::JobReference>,
13665 {
13666 self.reference = v.map(|x| x.into());
13667 self
13668 }
13669
13670 /// Sets the value of [placement][crate::model::Job::placement].
13671 ///
13672 /// # Example
13673 /// ```ignore,no_run
13674 /// # use google_cloud_dataproc_v1::model::Job;
13675 /// use google_cloud_dataproc_v1::model::JobPlacement;
13676 /// let x = Job::new().set_placement(JobPlacement::default()/* use setters */);
13677 /// ```
13678 pub fn set_placement<T>(mut self, v: T) -> Self
13679 where
13680 T: std::convert::Into<crate::model::JobPlacement>,
13681 {
13682 self.placement = std::option::Option::Some(v.into());
13683 self
13684 }
13685
13686 /// Sets or clears the value of [placement][crate::model::Job::placement].
13687 ///
13688 /// # Example
13689 /// ```ignore,no_run
13690 /// # use google_cloud_dataproc_v1::model::Job;
13691 /// use google_cloud_dataproc_v1::model::JobPlacement;
13692 /// let x = Job::new().set_or_clear_placement(Some(JobPlacement::default()/* use setters */));
13693 /// let x = Job::new().set_or_clear_placement(None::<JobPlacement>);
13694 /// ```
13695 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
13696 where
13697 T: std::convert::Into<crate::model::JobPlacement>,
13698 {
13699 self.placement = v.map(|x| x.into());
13700 self
13701 }
13702
13703 /// Sets the value of [status][crate::model::Job::status].
13704 ///
13705 /// # Example
13706 /// ```ignore,no_run
13707 /// # use google_cloud_dataproc_v1::model::Job;
13708 /// use google_cloud_dataproc_v1::model::JobStatus;
13709 /// let x = Job::new().set_status(JobStatus::default()/* use setters */);
13710 /// ```
13711 pub fn set_status<T>(mut self, v: T) -> Self
13712 where
13713 T: std::convert::Into<crate::model::JobStatus>,
13714 {
13715 self.status = std::option::Option::Some(v.into());
13716 self
13717 }
13718
13719 /// Sets or clears the value of [status][crate::model::Job::status].
13720 ///
13721 /// # Example
13722 /// ```ignore,no_run
13723 /// # use google_cloud_dataproc_v1::model::Job;
13724 /// use google_cloud_dataproc_v1::model::JobStatus;
13725 /// let x = Job::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
13726 /// let x = Job::new().set_or_clear_status(None::<JobStatus>);
13727 /// ```
13728 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
13729 where
13730 T: std::convert::Into<crate::model::JobStatus>,
13731 {
13732 self.status = v.map(|x| x.into());
13733 self
13734 }
13735
13736 /// Sets the value of [status_history][crate::model::Job::status_history].
13737 ///
13738 /// # Example
13739 /// ```ignore,no_run
13740 /// # use google_cloud_dataproc_v1::model::Job;
13741 /// use google_cloud_dataproc_v1::model::JobStatus;
13742 /// let x = Job::new()
13743 /// .set_status_history([
13744 /// JobStatus::default()/* use setters */,
13745 /// JobStatus::default()/* use (different) setters */,
13746 /// ]);
13747 /// ```
13748 pub fn set_status_history<T, V>(mut self, v: T) -> Self
13749 where
13750 T: std::iter::IntoIterator<Item = V>,
13751 V: std::convert::Into<crate::model::JobStatus>,
13752 {
13753 use std::iter::Iterator;
13754 self.status_history = v.into_iter().map(|i| i.into()).collect();
13755 self
13756 }
13757
13758 /// Sets the value of [yarn_applications][crate::model::Job::yarn_applications].
13759 ///
13760 /// # Example
13761 /// ```ignore,no_run
13762 /// # use google_cloud_dataproc_v1::model::Job;
13763 /// use google_cloud_dataproc_v1::model::YarnApplication;
13764 /// let x = Job::new()
13765 /// .set_yarn_applications([
13766 /// YarnApplication::default()/* use setters */,
13767 /// YarnApplication::default()/* use (different) setters */,
13768 /// ]);
13769 /// ```
13770 pub fn set_yarn_applications<T, V>(mut self, v: T) -> Self
13771 where
13772 T: std::iter::IntoIterator<Item = V>,
13773 V: std::convert::Into<crate::model::YarnApplication>,
13774 {
13775 use std::iter::Iterator;
13776 self.yarn_applications = v.into_iter().map(|i| i.into()).collect();
13777 self
13778 }
13779
13780 /// Sets the value of [driver_output_resource_uri][crate::model::Job::driver_output_resource_uri].
13781 ///
13782 /// # Example
13783 /// ```ignore,no_run
13784 /// # use google_cloud_dataproc_v1::model::Job;
13785 /// let x = Job::new().set_driver_output_resource_uri("example");
13786 /// ```
13787 pub fn set_driver_output_resource_uri<T: std::convert::Into<std::string::String>>(
13788 mut self,
13789 v: T,
13790 ) -> Self {
13791 self.driver_output_resource_uri = v.into();
13792 self
13793 }
13794
13795 /// Sets the value of [driver_control_files_uri][crate::model::Job::driver_control_files_uri].
13796 ///
13797 /// # Example
13798 /// ```ignore,no_run
13799 /// # use google_cloud_dataproc_v1::model::Job;
13800 /// let x = Job::new().set_driver_control_files_uri("example");
13801 /// ```
13802 pub fn set_driver_control_files_uri<T: std::convert::Into<std::string::String>>(
13803 mut self,
13804 v: T,
13805 ) -> Self {
13806 self.driver_control_files_uri = v.into();
13807 self
13808 }
13809
13810 /// Sets the value of [labels][crate::model::Job::labels].
13811 ///
13812 /// # Example
13813 /// ```ignore,no_run
13814 /// # use google_cloud_dataproc_v1::model::Job;
13815 /// let x = Job::new().set_labels([
13816 /// ("key0", "abc"),
13817 /// ("key1", "xyz"),
13818 /// ]);
13819 /// ```
13820 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
13821 where
13822 T: std::iter::IntoIterator<Item = (K, V)>,
13823 K: std::convert::Into<std::string::String>,
13824 V: std::convert::Into<std::string::String>,
13825 {
13826 use std::iter::Iterator;
13827 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13828 self
13829 }
13830
13831 /// Sets the value of [scheduling][crate::model::Job::scheduling].
13832 ///
13833 /// # Example
13834 /// ```ignore,no_run
13835 /// # use google_cloud_dataproc_v1::model::Job;
13836 /// use google_cloud_dataproc_v1::model::JobScheduling;
13837 /// let x = Job::new().set_scheduling(JobScheduling::default()/* use setters */);
13838 /// ```
13839 pub fn set_scheduling<T>(mut self, v: T) -> Self
13840 where
13841 T: std::convert::Into<crate::model::JobScheduling>,
13842 {
13843 self.scheduling = std::option::Option::Some(v.into());
13844 self
13845 }
13846
13847 /// Sets or clears the value of [scheduling][crate::model::Job::scheduling].
13848 ///
13849 /// # Example
13850 /// ```ignore,no_run
13851 /// # use google_cloud_dataproc_v1::model::Job;
13852 /// use google_cloud_dataproc_v1::model::JobScheduling;
13853 /// let x = Job::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
13854 /// let x = Job::new().set_or_clear_scheduling(None::<JobScheduling>);
13855 /// ```
13856 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
13857 where
13858 T: std::convert::Into<crate::model::JobScheduling>,
13859 {
13860 self.scheduling = v.map(|x| x.into());
13861 self
13862 }
13863
13864 /// Sets the value of [job_uuid][crate::model::Job::job_uuid].
13865 ///
13866 /// # Example
13867 /// ```ignore,no_run
13868 /// # use google_cloud_dataproc_v1::model::Job;
13869 /// let x = Job::new().set_job_uuid("example");
13870 /// ```
13871 pub fn set_job_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13872 self.job_uuid = v.into();
13873 self
13874 }
13875
13876 /// Sets the value of [done][crate::model::Job::done].
13877 ///
13878 /// # Example
13879 /// ```ignore,no_run
13880 /// # use google_cloud_dataproc_v1::model::Job;
13881 /// let x = Job::new().set_done(true);
13882 /// ```
13883 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13884 self.done = v.into();
13885 self
13886 }
13887
13888 /// Sets the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
13889 ///
13890 /// # Example
13891 /// ```ignore,no_run
13892 /// # use google_cloud_dataproc_v1::model::Job;
13893 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
13894 /// let x = Job::new().set_driver_scheduling_config(DriverSchedulingConfig::default()/* use setters */);
13895 /// ```
13896 pub fn set_driver_scheduling_config<T>(mut self, v: T) -> Self
13897 where
13898 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
13899 {
13900 self.driver_scheduling_config = std::option::Option::Some(v.into());
13901 self
13902 }
13903
13904 /// Sets or clears the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
13905 ///
13906 /// # Example
13907 /// ```ignore,no_run
13908 /// # use google_cloud_dataproc_v1::model::Job;
13909 /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
13910 /// let x = Job::new().set_or_clear_driver_scheduling_config(Some(DriverSchedulingConfig::default()/* use setters */));
13911 /// let x = Job::new().set_or_clear_driver_scheduling_config(None::<DriverSchedulingConfig>);
13912 /// ```
13913 pub fn set_or_clear_driver_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
13914 where
13915 T: std::convert::Into<crate::model::DriverSchedulingConfig>,
13916 {
13917 self.driver_scheduling_config = v.map(|x| x.into());
13918 self
13919 }
13920
13921 /// Sets the value of [type_job][crate::model::Job::type_job].
13922 ///
13923 /// Note that all the setters affecting `type_job` are mutually
13924 /// exclusive.
13925 ///
13926 /// # Example
13927 /// ```ignore,no_run
13928 /// # use google_cloud_dataproc_v1::model::Job;
13929 /// use google_cloud_dataproc_v1::model::HadoopJob;
13930 /// let x = Job::new().set_type_job(Some(
13931 /// google_cloud_dataproc_v1::model::job::TypeJob::HadoopJob(HadoopJob::default().into())));
13932 /// ```
13933 pub fn set_type_job<T: std::convert::Into<std::option::Option<crate::model::job::TypeJob>>>(
13934 mut self,
13935 v: T,
13936 ) -> Self {
13937 self.type_job = v.into();
13938 self
13939 }
13940
13941 /// The value of [type_job][crate::model::Job::type_job]
13942 /// if it holds a `HadoopJob`, `None` if the field is not set or
13943 /// holds a different branch.
13944 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
13945 #[allow(unreachable_patterns)]
13946 self.type_job.as_ref().and_then(|v| match v {
13947 crate::model::job::TypeJob::HadoopJob(v) => std::option::Option::Some(v),
13948 _ => std::option::Option::None,
13949 })
13950 }
13951
13952 /// Sets the value of [type_job][crate::model::Job::type_job]
13953 /// to hold a `HadoopJob`.
13954 ///
13955 /// Note that all the setters affecting `type_job` are
13956 /// mutually exclusive.
13957 ///
13958 /// # Example
13959 /// ```ignore,no_run
13960 /// # use google_cloud_dataproc_v1::model::Job;
13961 /// use google_cloud_dataproc_v1::model::HadoopJob;
13962 /// let x = Job::new().set_hadoop_job(HadoopJob::default()/* use setters */);
13963 /// assert!(x.hadoop_job().is_some());
13964 /// assert!(x.spark_job().is_none());
13965 /// assert!(x.pyspark_job().is_none());
13966 /// assert!(x.hive_job().is_none());
13967 /// assert!(x.pig_job().is_none());
13968 /// assert!(x.spark_r_job().is_none());
13969 /// assert!(x.spark_sql_job().is_none());
13970 /// assert!(x.presto_job().is_none());
13971 /// assert!(x.trino_job().is_none());
13972 /// assert!(x.flink_job().is_none());
13973 /// ```
13974 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
13975 mut self,
13976 v: T,
13977 ) -> Self {
13978 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HadoopJob(v.into()));
13979 self
13980 }
13981
13982 /// The value of [type_job][crate::model::Job::type_job]
13983 /// if it holds a `SparkJob`, `None` if the field is not set or
13984 /// holds a different branch.
13985 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
13986 #[allow(unreachable_patterns)]
13987 self.type_job.as_ref().and_then(|v| match v {
13988 crate::model::job::TypeJob::SparkJob(v) => std::option::Option::Some(v),
13989 _ => std::option::Option::None,
13990 })
13991 }
13992
13993 /// Sets the value of [type_job][crate::model::Job::type_job]
13994 /// to hold a `SparkJob`.
13995 ///
13996 /// Note that all the setters affecting `type_job` are
13997 /// mutually exclusive.
13998 ///
13999 /// # Example
14000 /// ```ignore,no_run
14001 /// # use google_cloud_dataproc_v1::model::Job;
14002 /// use google_cloud_dataproc_v1::model::SparkJob;
14003 /// let x = Job::new().set_spark_job(SparkJob::default()/* use setters */);
14004 /// assert!(x.spark_job().is_some());
14005 /// assert!(x.hadoop_job().is_none());
14006 /// assert!(x.pyspark_job().is_none());
14007 /// assert!(x.hive_job().is_none());
14008 /// assert!(x.pig_job().is_none());
14009 /// assert!(x.spark_r_job().is_none());
14010 /// assert!(x.spark_sql_job().is_none());
14011 /// assert!(x.presto_job().is_none());
14012 /// assert!(x.trino_job().is_none());
14013 /// assert!(x.flink_job().is_none());
14014 /// ```
14015 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
14016 mut self,
14017 v: T,
14018 ) -> Self {
14019 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkJob(v.into()));
14020 self
14021 }
14022
14023 /// The value of [type_job][crate::model::Job::type_job]
14024 /// if it holds a `PysparkJob`, `None` if the field is not set or
14025 /// holds a different branch.
14026 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
14027 #[allow(unreachable_patterns)]
14028 self.type_job.as_ref().and_then(|v| match v {
14029 crate::model::job::TypeJob::PysparkJob(v) => std::option::Option::Some(v),
14030 _ => std::option::Option::None,
14031 })
14032 }
14033
14034 /// Sets the value of [type_job][crate::model::Job::type_job]
14035 /// to hold a `PysparkJob`.
14036 ///
14037 /// Note that all the setters affecting `type_job` are
14038 /// mutually exclusive.
14039 ///
14040 /// # Example
14041 /// ```ignore,no_run
14042 /// # use google_cloud_dataproc_v1::model::Job;
14043 /// use google_cloud_dataproc_v1::model::PySparkJob;
14044 /// let x = Job::new().set_pyspark_job(PySparkJob::default()/* use setters */);
14045 /// assert!(x.pyspark_job().is_some());
14046 /// assert!(x.hadoop_job().is_none());
14047 /// assert!(x.spark_job().is_none());
14048 /// assert!(x.hive_job().is_none());
14049 /// assert!(x.pig_job().is_none());
14050 /// assert!(x.spark_r_job().is_none());
14051 /// assert!(x.spark_sql_job().is_none());
14052 /// assert!(x.presto_job().is_none());
14053 /// assert!(x.trino_job().is_none());
14054 /// assert!(x.flink_job().is_none());
14055 /// ```
14056 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
14057 mut self,
14058 v: T,
14059 ) -> Self {
14060 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PysparkJob(v.into()));
14061 self
14062 }
14063
14064 /// The value of [type_job][crate::model::Job::type_job]
14065 /// if it holds a `HiveJob`, `None` if the field is not set or
14066 /// holds a different branch.
14067 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
14068 #[allow(unreachable_patterns)]
14069 self.type_job.as_ref().and_then(|v| match v {
14070 crate::model::job::TypeJob::HiveJob(v) => std::option::Option::Some(v),
14071 _ => std::option::Option::None,
14072 })
14073 }
14074
14075 /// Sets the value of [type_job][crate::model::Job::type_job]
14076 /// to hold a `HiveJob`.
14077 ///
14078 /// Note that all the setters affecting `type_job` are
14079 /// mutually exclusive.
14080 ///
14081 /// # Example
14082 /// ```ignore,no_run
14083 /// # use google_cloud_dataproc_v1::model::Job;
14084 /// use google_cloud_dataproc_v1::model::HiveJob;
14085 /// let x = Job::new().set_hive_job(HiveJob::default()/* use setters */);
14086 /// assert!(x.hive_job().is_some());
14087 /// assert!(x.hadoop_job().is_none());
14088 /// assert!(x.spark_job().is_none());
14089 /// assert!(x.pyspark_job().is_none());
14090 /// assert!(x.pig_job().is_none());
14091 /// assert!(x.spark_r_job().is_none());
14092 /// assert!(x.spark_sql_job().is_none());
14093 /// assert!(x.presto_job().is_none());
14094 /// assert!(x.trino_job().is_none());
14095 /// assert!(x.flink_job().is_none());
14096 /// ```
14097 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
14098 mut self,
14099 v: T,
14100 ) -> Self {
14101 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HiveJob(v.into()));
14102 self
14103 }
14104
14105 /// The value of [type_job][crate::model::Job::type_job]
14106 /// if it holds a `PigJob`, `None` if the field is not set or
14107 /// holds a different branch.
14108 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
14109 #[allow(unreachable_patterns)]
14110 self.type_job.as_ref().and_then(|v| match v {
14111 crate::model::job::TypeJob::PigJob(v) => std::option::Option::Some(v),
14112 _ => std::option::Option::None,
14113 })
14114 }
14115
14116 /// Sets the value of [type_job][crate::model::Job::type_job]
14117 /// to hold a `PigJob`.
14118 ///
14119 /// Note that all the setters affecting `type_job` are
14120 /// mutually exclusive.
14121 ///
14122 /// # Example
14123 /// ```ignore,no_run
14124 /// # use google_cloud_dataproc_v1::model::Job;
14125 /// use google_cloud_dataproc_v1::model::PigJob;
14126 /// let x = Job::new().set_pig_job(PigJob::default()/* use setters */);
14127 /// assert!(x.pig_job().is_some());
14128 /// assert!(x.hadoop_job().is_none());
14129 /// assert!(x.spark_job().is_none());
14130 /// assert!(x.pyspark_job().is_none());
14131 /// assert!(x.hive_job().is_none());
14132 /// assert!(x.spark_r_job().is_none());
14133 /// assert!(x.spark_sql_job().is_none());
14134 /// assert!(x.presto_job().is_none());
14135 /// assert!(x.trino_job().is_none());
14136 /// assert!(x.flink_job().is_none());
14137 /// ```
14138 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
14139 mut self,
14140 v: T,
14141 ) -> Self {
14142 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PigJob(v.into()));
14143 self
14144 }
14145
14146 /// The value of [type_job][crate::model::Job::type_job]
14147 /// if it holds a `SparkRJob`, `None` if the field is not set or
14148 /// holds a different branch.
14149 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
14150 #[allow(unreachable_patterns)]
14151 self.type_job.as_ref().and_then(|v| match v {
14152 crate::model::job::TypeJob::SparkRJob(v) => std::option::Option::Some(v),
14153 _ => std::option::Option::None,
14154 })
14155 }
14156
14157 /// Sets the value of [type_job][crate::model::Job::type_job]
14158 /// to hold a `SparkRJob`.
14159 ///
14160 /// Note that all the setters affecting `type_job` are
14161 /// mutually exclusive.
14162 ///
14163 /// # Example
14164 /// ```ignore,no_run
14165 /// # use google_cloud_dataproc_v1::model::Job;
14166 /// use google_cloud_dataproc_v1::model::SparkRJob;
14167 /// let x = Job::new().set_spark_r_job(SparkRJob::default()/* use setters */);
14168 /// assert!(x.spark_r_job().is_some());
14169 /// assert!(x.hadoop_job().is_none());
14170 /// assert!(x.spark_job().is_none());
14171 /// assert!(x.pyspark_job().is_none());
14172 /// assert!(x.hive_job().is_none());
14173 /// assert!(x.pig_job().is_none());
14174 /// assert!(x.spark_sql_job().is_none());
14175 /// assert!(x.presto_job().is_none());
14176 /// assert!(x.trino_job().is_none());
14177 /// assert!(x.flink_job().is_none());
14178 /// ```
14179 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
14180 mut self,
14181 v: T,
14182 ) -> Self {
14183 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkRJob(v.into()));
14184 self
14185 }
14186
14187 /// The value of [type_job][crate::model::Job::type_job]
14188 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
14189 /// holds a different branch.
14190 pub fn spark_sql_job(
14191 &self,
14192 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
14193 #[allow(unreachable_patterns)]
14194 self.type_job.as_ref().and_then(|v| match v {
14195 crate::model::job::TypeJob::SparkSqlJob(v) => std::option::Option::Some(v),
14196 _ => std::option::Option::None,
14197 })
14198 }
14199
14200 /// Sets the value of [type_job][crate::model::Job::type_job]
14201 /// to hold a `SparkSqlJob`.
14202 ///
14203 /// Note that all the setters affecting `type_job` are
14204 /// mutually exclusive.
14205 ///
14206 /// # Example
14207 /// ```ignore,no_run
14208 /// # use google_cloud_dataproc_v1::model::Job;
14209 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
14210 /// let x = Job::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
14211 /// assert!(x.spark_sql_job().is_some());
14212 /// assert!(x.hadoop_job().is_none());
14213 /// assert!(x.spark_job().is_none());
14214 /// assert!(x.pyspark_job().is_none());
14215 /// assert!(x.hive_job().is_none());
14216 /// assert!(x.pig_job().is_none());
14217 /// assert!(x.spark_r_job().is_none());
14218 /// assert!(x.presto_job().is_none());
14219 /// assert!(x.trino_job().is_none());
14220 /// assert!(x.flink_job().is_none());
14221 /// ```
14222 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
14223 mut self,
14224 v: T,
14225 ) -> Self {
14226 self.type_job =
14227 std::option::Option::Some(crate::model::job::TypeJob::SparkSqlJob(v.into()));
14228 self
14229 }
14230
14231 /// The value of [type_job][crate::model::Job::type_job]
14232 /// if it holds a `PrestoJob`, `None` if the field is not set or
14233 /// holds a different branch.
14234 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
14235 #[allow(unreachable_patterns)]
14236 self.type_job.as_ref().and_then(|v| match v {
14237 crate::model::job::TypeJob::PrestoJob(v) => std::option::Option::Some(v),
14238 _ => std::option::Option::None,
14239 })
14240 }
14241
14242 /// Sets the value of [type_job][crate::model::Job::type_job]
14243 /// to hold a `PrestoJob`.
14244 ///
14245 /// Note that all the setters affecting `type_job` are
14246 /// mutually exclusive.
14247 ///
14248 /// # Example
14249 /// ```ignore,no_run
14250 /// # use google_cloud_dataproc_v1::model::Job;
14251 /// use google_cloud_dataproc_v1::model::PrestoJob;
14252 /// let x = Job::new().set_presto_job(PrestoJob::default()/* use setters */);
14253 /// assert!(x.presto_job().is_some());
14254 /// assert!(x.hadoop_job().is_none());
14255 /// assert!(x.spark_job().is_none());
14256 /// assert!(x.pyspark_job().is_none());
14257 /// assert!(x.hive_job().is_none());
14258 /// assert!(x.pig_job().is_none());
14259 /// assert!(x.spark_r_job().is_none());
14260 /// assert!(x.spark_sql_job().is_none());
14261 /// assert!(x.trino_job().is_none());
14262 /// assert!(x.flink_job().is_none());
14263 /// ```
14264 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
14265 mut self,
14266 v: T,
14267 ) -> Self {
14268 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PrestoJob(v.into()));
14269 self
14270 }
14271
14272 /// The value of [type_job][crate::model::Job::type_job]
14273 /// if it holds a `TrinoJob`, `None` if the field is not set or
14274 /// holds a different branch.
14275 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
14276 #[allow(unreachable_patterns)]
14277 self.type_job.as_ref().and_then(|v| match v {
14278 crate::model::job::TypeJob::TrinoJob(v) => std::option::Option::Some(v),
14279 _ => std::option::Option::None,
14280 })
14281 }
14282
14283 /// Sets the value of [type_job][crate::model::Job::type_job]
14284 /// to hold a `TrinoJob`.
14285 ///
14286 /// Note that all the setters affecting `type_job` are
14287 /// mutually exclusive.
14288 ///
14289 /// # Example
14290 /// ```ignore,no_run
14291 /// # use google_cloud_dataproc_v1::model::Job;
14292 /// use google_cloud_dataproc_v1::model::TrinoJob;
14293 /// let x = Job::new().set_trino_job(TrinoJob::default()/* use setters */);
14294 /// assert!(x.trino_job().is_some());
14295 /// assert!(x.hadoop_job().is_none());
14296 /// assert!(x.spark_job().is_none());
14297 /// assert!(x.pyspark_job().is_none());
14298 /// assert!(x.hive_job().is_none());
14299 /// assert!(x.pig_job().is_none());
14300 /// assert!(x.spark_r_job().is_none());
14301 /// assert!(x.spark_sql_job().is_none());
14302 /// assert!(x.presto_job().is_none());
14303 /// assert!(x.flink_job().is_none());
14304 /// ```
14305 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
14306 mut self,
14307 v: T,
14308 ) -> Self {
14309 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::TrinoJob(v.into()));
14310 self
14311 }
14312
14313 /// The value of [type_job][crate::model::Job::type_job]
14314 /// if it holds a `FlinkJob`, `None` if the field is not set or
14315 /// holds a different branch.
14316 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
14317 #[allow(unreachable_patterns)]
14318 self.type_job.as_ref().and_then(|v| match v {
14319 crate::model::job::TypeJob::FlinkJob(v) => std::option::Option::Some(v),
14320 _ => std::option::Option::None,
14321 })
14322 }
14323
14324 /// Sets the value of [type_job][crate::model::Job::type_job]
14325 /// to hold a `FlinkJob`.
14326 ///
14327 /// Note that all the setters affecting `type_job` are
14328 /// mutually exclusive.
14329 ///
14330 /// # Example
14331 /// ```ignore,no_run
14332 /// # use google_cloud_dataproc_v1::model::Job;
14333 /// use google_cloud_dataproc_v1::model::FlinkJob;
14334 /// let x = Job::new().set_flink_job(FlinkJob::default()/* use setters */);
14335 /// assert!(x.flink_job().is_some());
14336 /// assert!(x.hadoop_job().is_none());
14337 /// assert!(x.spark_job().is_none());
14338 /// assert!(x.pyspark_job().is_none());
14339 /// assert!(x.hive_job().is_none());
14340 /// assert!(x.pig_job().is_none());
14341 /// assert!(x.spark_r_job().is_none());
14342 /// assert!(x.spark_sql_job().is_none());
14343 /// assert!(x.presto_job().is_none());
14344 /// assert!(x.trino_job().is_none());
14345 /// ```
14346 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
14347 mut self,
14348 v: T,
14349 ) -> Self {
14350 self.type_job = std::option::Option::Some(crate::model::job::TypeJob::FlinkJob(v.into()));
14351 self
14352 }
14353}
14354
14355impl wkt::message::Message for Job {
14356 fn typename() -> &'static str {
14357 "type.googleapis.com/google.cloud.dataproc.v1.Job"
14358 }
14359}
14360
14361/// Defines additional types related to [Job].
14362pub mod job {
14363 #[allow(unused_imports)]
14364 use super::*;
14365
14366 /// Required. The application/framework-specific portion of the job.
14367 #[derive(Clone, Debug, PartialEq)]
14368 #[non_exhaustive]
14369 pub enum TypeJob {
14370 /// Optional. Job is a Hadoop job.
14371 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
14372 /// Optional. Job is a Spark job.
14373 SparkJob(std::boxed::Box<crate::model::SparkJob>),
14374 /// Optional. Job is a PySpark job.
14375 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
14376 /// Optional. Job is a Hive job.
14377 HiveJob(std::boxed::Box<crate::model::HiveJob>),
14378 /// Optional. Job is a Pig job.
14379 PigJob(std::boxed::Box<crate::model::PigJob>),
14380 /// Optional. Job is a SparkR job.
14381 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
14382 /// Optional. Job is a SparkSql job.
14383 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
14384 /// Optional. Job is a Presto job.
14385 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
14386 /// Optional. Job is a Trino job.
14387 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
14388 /// Optional. Job is a Flink job.
14389 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
14390 }
14391}
14392
14393/// Driver scheduling configuration.
14394#[derive(Clone, Default, PartialEq)]
14395#[non_exhaustive]
14396pub struct DriverSchedulingConfig {
14397 /// Required. The amount of memory in MB the driver is requesting.
14398 pub memory_mb: i32,
14399
14400 /// Required. The number of vCPUs the driver is requesting.
14401 pub vcores: i32,
14402
14403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14404}
14405
14406impl DriverSchedulingConfig {
14407 pub fn new() -> Self {
14408 std::default::Default::default()
14409 }
14410
14411 /// Sets the value of [memory_mb][crate::model::DriverSchedulingConfig::memory_mb].
14412 ///
14413 /// # Example
14414 /// ```ignore,no_run
14415 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14416 /// let x = DriverSchedulingConfig::new().set_memory_mb(42);
14417 /// ```
14418 pub fn set_memory_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14419 self.memory_mb = v.into();
14420 self
14421 }
14422
14423 /// Sets the value of [vcores][crate::model::DriverSchedulingConfig::vcores].
14424 ///
14425 /// # Example
14426 /// ```ignore,no_run
14427 /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14428 /// let x = DriverSchedulingConfig::new().set_vcores(42);
14429 /// ```
14430 pub fn set_vcores<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14431 self.vcores = v.into();
14432 self
14433 }
14434}
14435
14436impl wkt::message::Message for DriverSchedulingConfig {
14437 fn typename() -> &'static str {
14438 "type.googleapis.com/google.cloud.dataproc.v1.DriverSchedulingConfig"
14439 }
14440}
14441
14442/// Job scheduling options.
14443#[derive(Clone, Default, PartialEq)]
14444#[non_exhaustive]
14445pub struct JobScheduling {
14446 /// Optional. Maximum number of times per hour a driver can be restarted as
14447 /// a result of driver exiting with non-zero code before job is
14448 /// reported failed.
14449 ///
14450 /// A job might be reported as thrashing if the driver exits with a non-zero
14451 /// code four times within a 10-minute window.
14452 ///
14453 /// Maximum value is 10.
14454 ///
14455 /// **Note:** This restartable job option is not supported in Dataproc
14456 /// [workflow templates]
14457 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template>).
14458 pub max_failures_per_hour: i32,
14459
14460 /// Optional. Maximum total number of times a driver can be restarted as a
14461 /// result of the driver exiting with a non-zero code. After the maximum number
14462 /// is reached, the job will be reported as failed.
14463 ///
14464 /// Maximum value is 240.
14465 ///
14466 /// **Note:** Currently, this restartable job option is
14467 /// not supported in Dataproc
14468 /// [workflow
14469 /// templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
14470 pub max_failures_total: i32,
14471
14472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14473}
14474
14475impl JobScheduling {
14476 pub fn new() -> Self {
14477 std::default::Default::default()
14478 }
14479
14480 /// Sets the value of [max_failures_per_hour][crate::model::JobScheduling::max_failures_per_hour].
14481 ///
14482 /// # Example
14483 /// ```ignore,no_run
14484 /// # use google_cloud_dataproc_v1::model::JobScheduling;
14485 /// let x = JobScheduling::new().set_max_failures_per_hour(42);
14486 /// ```
14487 pub fn set_max_failures_per_hour<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14488 self.max_failures_per_hour = v.into();
14489 self
14490 }
14491
14492 /// Sets the value of [max_failures_total][crate::model::JobScheduling::max_failures_total].
14493 ///
14494 /// # Example
14495 /// ```ignore,no_run
14496 /// # use google_cloud_dataproc_v1::model::JobScheduling;
14497 /// let x = JobScheduling::new().set_max_failures_total(42);
14498 /// ```
14499 pub fn set_max_failures_total<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14500 self.max_failures_total = v.into();
14501 self
14502 }
14503}
14504
14505impl wkt::message::Message for JobScheduling {
14506 fn typename() -> &'static str {
14507 "type.googleapis.com/google.cloud.dataproc.v1.JobScheduling"
14508 }
14509}
14510
14511/// A request to submit a job.
14512#[derive(Clone, Default, PartialEq)]
14513#[non_exhaustive]
14514pub struct SubmitJobRequest {
14515 /// Required. The ID of the Google Cloud Platform project that the job
14516 /// belongs to.
14517 pub project_id: std::string::String,
14518
14519 /// Required. The Dataproc region in which to handle the request.
14520 pub region: std::string::String,
14521
14522 /// Required. The job resource.
14523 pub job: std::option::Option<crate::model::Job>,
14524
14525 /// Optional. A unique id used to identify the request. If the server
14526 /// receives two
14527 /// [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
14528 /// with the same id, then the second request will be ignored and the
14529 /// first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend
14530 /// is returned.
14531 ///
14532 /// It is recommended to always set this value to a
14533 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
14534 ///
14535 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
14536 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
14537 ///
14538 /// [google.cloud.dataproc.v1.Job]: crate::model::Job
14539 pub request_id: std::string::String,
14540
14541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14542}
14543
14544impl SubmitJobRequest {
14545 pub fn new() -> Self {
14546 std::default::Default::default()
14547 }
14548
14549 /// Sets the value of [project_id][crate::model::SubmitJobRequest::project_id].
14550 ///
14551 /// # Example
14552 /// ```ignore,no_run
14553 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14554 /// let x = SubmitJobRequest::new().set_project_id("example");
14555 /// ```
14556 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14557 self.project_id = v.into();
14558 self
14559 }
14560
14561 /// Sets the value of [region][crate::model::SubmitJobRequest::region].
14562 ///
14563 /// # Example
14564 /// ```ignore,no_run
14565 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14566 /// let x = SubmitJobRequest::new().set_region("example");
14567 /// ```
14568 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14569 self.region = v.into();
14570 self
14571 }
14572
14573 /// Sets the value of [job][crate::model::SubmitJobRequest::job].
14574 ///
14575 /// # Example
14576 /// ```ignore,no_run
14577 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14578 /// use google_cloud_dataproc_v1::model::Job;
14579 /// let x = SubmitJobRequest::new().set_job(Job::default()/* use setters */);
14580 /// ```
14581 pub fn set_job<T>(mut self, v: T) -> Self
14582 where
14583 T: std::convert::Into<crate::model::Job>,
14584 {
14585 self.job = std::option::Option::Some(v.into());
14586 self
14587 }
14588
14589 /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
14590 ///
14591 /// # Example
14592 /// ```ignore,no_run
14593 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14594 /// use google_cloud_dataproc_v1::model::Job;
14595 /// let x = SubmitJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
14596 /// let x = SubmitJobRequest::new().set_or_clear_job(None::<Job>);
14597 /// ```
14598 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
14599 where
14600 T: std::convert::Into<crate::model::Job>,
14601 {
14602 self.job = v.map(|x| x.into());
14603 self
14604 }
14605
14606 /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
14607 ///
14608 /// # Example
14609 /// ```ignore,no_run
14610 /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14611 /// let x = SubmitJobRequest::new().set_request_id("example");
14612 /// ```
14613 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14614 self.request_id = v.into();
14615 self
14616 }
14617}
14618
14619impl wkt::message::Message for SubmitJobRequest {
14620 fn typename() -> &'static str {
14621 "type.googleapis.com/google.cloud.dataproc.v1.SubmitJobRequest"
14622 }
14623}
14624
14625/// Job Operation metadata.
14626#[derive(Clone, Default, PartialEq)]
14627#[non_exhaustive]
14628pub struct JobMetadata {
14629 /// Output only. The job id.
14630 pub job_id: std::string::String,
14631
14632 /// Output only. Most recent job status.
14633 pub status: std::option::Option<crate::model::JobStatus>,
14634
14635 /// Output only. Operation type.
14636 pub operation_type: std::string::String,
14637
14638 /// Output only. Job submission time.
14639 pub start_time: std::option::Option<wkt::Timestamp>,
14640
14641 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14642}
14643
14644impl JobMetadata {
14645 pub fn new() -> Self {
14646 std::default::Default::default()
14647 }
14648
14649 /// Sets the value of [job_id][crate::model::JobMetadata::job_id].
14650 ///
14651 /// # Example
14652 /// ```ignore,no_run
14653 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14654 /// let x = JobMetadata::new().set_job_id("example");
14655 /// ```
14656 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14657 self.job_id = v.into();
14658 self
14659 }
14660
14661 /// Sets the value of [status][crate::model::JobMetadata::status].
14662 ///
14663 /// # Example
14664 /// ```ignore,no_run
14665 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14666 /// use google_cloud_dataproc_v1::model::JobStatus;
14667 /// let x = JobMetadata::new().set_status(JobStatus::default()/* use setters */);
14668 /// ```
14669 pub fn set_status<T>(mut self, v: T) -> Self
14670 where
14671 T: std::convert::Into<crate::model::JobStatus>,
14672 {
14673 self.status = std::option::Option::Some(v.into());
14674 self
14675 }
14676
14677 /// Sets or clears the value of [status][crate::model::JobMetadata::status].
14678 ///
14679 /// # Example
14680 /// ```ignore,no_run
14681 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14682 /// use google_cloud_dataproc_v1::model::JobStatus;
14683 /// let x = JobMetadata::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
14684 /// let x = JobMetadata::new().set_or_clear_status(None::<JobStatus>);
14685 /// ```
14686 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
14687 where
14688 T: std::convert::Into<crate::model::JobStatus>,
14689 {
14690 self.status = v.map(|x| x.into());
14691 self
14692 }
14693
14694 /// Sets the value of [operation_type][crate::model::JobMetadata::operation_type].
14695 ///
14696 /// # Example
14697 /// ```ignore,no_run
14698 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14699 /// let x = JobMetadata::new().set_operation_type("example");
14700 /// ```
14701 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14702 self.operation_type = v.into();
14703 self
14704 }
14705
14706 /// Sets the value of [start_time][crate::model::JobMetadata::start_time].
14707 ///
14708 /// # Example
14709 /// ```ignore,no_run
14710 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14711 /// use wkt::Timestamp;
14712 /// let x = JobMetadata::new().set_start_time(Timestamp::default()/* use setters */);
14713 /// ```
14714 pub fn set_start_time<T>(mut self, v: T) -> Self
14715 where
14716 T: std::convert::Into<wkt::Timestamp>,
14717 {
14718 self.start_time = std::option::Option::Some(v.into());
14719 self
14720 }
14721
14722 /// Sets or clears the value of [start_time][crate::model::JobMetadata::start_time].
14723 ///
14724 /// # Example
14725 /// ```ignore,no_run
14726 /// # use google_cloud_dataproc_v1::model::JobMetadata;
14727 /// use wkt::Timestamp;
14728 /// let x = JobMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
14729 /// let x = JobMetadata::new().set_or_clear_start_time(None::<Timestamp>);
14730 /// ```
14731 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
14732 where
14733 T: std::convert::Into<wkt::Timestamp>,
14734 {
14735 self.start_time = v.map(|x| x.into());
14736 self
14737 }
14738}
14739
14740impl wkt::message::Message for JobMetadata {
14741 fn typename() -> &'static str {
14742 "type.googleapis.com/google.cloud.dataproc.v1.JobMetadata"
14743 }
14744}
14745
14746/// A request to get the resource representation for a job in a project.
14747#[derive(Clone, Default, PartialEq)]
14748#[non_exhaustive]
14749pub struct GetJobRequest {
14750 /// Required. The ID of the Google Cloud Platform project that the job
14751 /// belongs to.
14752 pub project_id: std::string::String,
14753
14754 /// Required. The Dataproc region in which to handle the request.
14755 pub region: std::string::String,
14756
14757 /// Required. The job ID.
14758 pub job_id: std::string::String,
14759
14760 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14761}
14762
14763impl GetJobRequest {
14764 pub fn new() -> Self {
14765 std::default::Default::default()
14766 }
14767
14768 /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
14769 ///
14770 /// # Example
14771 /// ```ignore,no_run
14772 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
14773 /// let x = GetJobRequest::new().set_project_id("example");
14774 /// ```
14775 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14776 self.project_id = v.into();
14777 self
14778 }
14779
14780 /// Sets the value of [region][crate::model::GetJobRequest::region].
14781 ///
14782 /// # Example
14783 /// ```ignore,no_run
14784 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
14785 /// let x = GetJobRequest::new().set_region("example");
14786 /// ```
14787 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14788 self.region = v.into();
14789 self
14790 }
14791
14792 /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
14793 ///
14794 /// # Example
14795 /// ```ignore,no_run
14796 /// # use google_cloud_dataproc_v1::model::GetJobRequest;
14797 /// let x = GetJobRequest::new().set_job_id("example");
14798 /// ```
14799 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14800 self.job_id = v.into();
14801 self
14802 }
14803}
14804
14805impl wkt::message::Message for GetJobRequest {
14806 fn typename() -> &'static str {
14807 "type.googleapis.com/google.cloud.dataproc.v1.GetJobRequest"
14808 }
14809}
14810
14811/// A request to list jobs in a project.
14812#[derive(Clone, Default, PartialEq)]
14813#[non_exhaustive]
14814pub struct ListJobsRequest {
14815 /// Required. The ID of the Google Cloud Platform project that the job
14816 /// belongs to.
14817 pub project_id: std::string::String,
14818
14819 /// Required. The Dataproc region in which to handle the request.
14820 pub region: std::string::String,
14821
14822 /// Optional. The number of results to return in each response.
14823 pub page_size: i32,
14824
14825 /// Optional. The page token, returned by a previous call, to request the
14826 /// next page of results.
14827 pub page_token: std::string::String,
14828
14829 /// Optional. If set, the returned jobs list includes only jobs that were
14830 /// submitted to the named cluster.
14831 pub cluster_name: std::string::String,
14832
14833 /// Optional. Specifies enumerated categories of jobs to list.
14834 /// (default = match ALL jobs).
14835 ///
14836 /// If `filter` is provided, `jobStateMatcher` will be ignored.
14837 pub job_state_matcher: crate::model::list_jobs_request::JobStateMatcher,
14838
14839 /// Optional. A filter constraining the jobs to list. Filters are
14840 /// case-sensitive and have the following syntax:
14841 ///
14842 /// [field = value] AND [field [= value]] ...
14843 ///
14844 /// where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label
14845 /// key. **value** can be `*` to match all values.
14846 /// `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
14847 /// Only the logical `AND` operator is supported; space-separated items are
14848 /// treated as having an implicit `AND` operator.
14849 ///
14850 /// Example filter:
14851 ///
14852 /// status.state = ACTIVE AND labels.env = staging AND labels.starred = *
14853 pub filter: std::string::String,
14854
14855 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14856}
14857
14858impl ListJobsRequest {
14859 pub fn new() -> Self {
14860 std::default::Default::default()
14861 }
14862
14863 /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
14864 ///
14865 /// # Example
14866 /// ```ignore,no_run
14867 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14868 /// let x = ListJobsRequest::new().set_project_id("example");
14869 /// ```
14870 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14871 self.project_id = v.into();
14872 self
14873 }
14874
14875 /// Sets the value of [region][crate::model::ListJobsRequest::region].
14876 ///
14877 /// # Example
14878 /// ```ignore,no_run
14879 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14880 /// let x = ListJobsRequest::new().set_region("example");
14881 /// ```
14882 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14883 self.region = v.into();
14884 self
14885 }
14886
14887 /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
14888 ///
14889 /// # Example
14890 /// ```ignore,no_run
14891 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14892 /// let x = ListJobsRequest::new().set_page_size(42);
14893 /// ```
14894 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14895 self.page_size = v.into();
14896 self
14897 }
14898
14899 /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
14900 ///
14901 /// # Example
14902 /// ```ignore,no_run
14903 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14904 /// let x = ListJobsRequest::new().set_page_token("example");
14905 /// ```
14906 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14907 self.page_token = v.into();
14908 self
14909 }
14910
14911 /// Sets the value of [cluster_name][crate::model::ListJobsRequest::cluster_name].
14912 ///
14913 /// # Example
14914 /// ```ignore,no_run
14915 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14916 /// let x = ListJobsRequest::new().set_cluster_name("example");
14917 /// ```
14918 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14919 self.cluster_name = v.into();
14920 self
14921 }
14922
14923 /// Sets the value of [job_state_matcher][crate::model::ListJobsRequest::job_state_matcher].
14924 ///
14925 /// # Example
14926 /// ```ignore,no_run
14927 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14928 /// use google_cloud_dataproc_v1::model::list_jobs_request::JobStateMatcher;
14929 /// let x0 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::Active);
14930 /// let x1 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::NonActive);
14931 /// ```
14932 pub fn set_job_state_matcher<
14933 T: std::convert::Into<crate::model::list_jobs_request::JobStateMatcher>,
14934 >(
14935 mut self,
14936 v: T,
14937 ) -> Self {
14938 self.job_state_matcher = v.into();
14939 self
14940 }
14941
14942 /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
14943 ///
14944 /// # Example
14945 /// ```ignore,no_run
14946 /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
14947 /// let x = ListJobsRequest::new().set_filter("example");
14948 /// ```
14949 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14950 self.filter = v.into();
14951 self
14952 }
14953}
14954
14955impl wkt::message::Message for ListJobsRequest {
14956 fn typename() -> &'static str {
14957 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsRequest"
14958 }
14959}
14960
14961/// Defines additional types related to [ListJobsRequest].
14962pub mod list_jobs_request {
14963 #[allow(unused_imports)]
14964 use super::*;
14965
14966 /// A matcher that specifies categories of job states.
14967 ///
14968 /// # Working with unknown values
14969 ///
14970 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14971 /// additional enum variants at any time. Adding new variants is not considered
14972 /// a breaking change. Applications should write their code in anticipation of:
14973 ///
14974 /// - New values appearing in future releases of the client library, **and**
14975 /// - New values received dynamically, without application changes.
14976 ///
14977 /// Please consult the [Working with enums] section in the user guide for some
14978 /// guidelines.
14979 ///
14980 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14981 #[derive(Clone, Debug, PartialEq)]
14982 #[non_exhaustive]
14983 pub enum JobStateMatcher {
14984 /// Match all jobs, regardless of state.
14985 All,
14986 /// Only match jobs in non-terminal states: PENDING, RUNNING, or
14987 /// CANCEL_PENDING.
14988 Active,
14989 /// Only match jobs in terminal states: CANCELLED, DONE, or ERROR.
14990 NonActive,
14991 /// If set, the enum was initialized with an unknown value.
14992 ///
14993 /// Applications can examine the value using [JobStateMatcher::value] or
14994 /// [JobStateMatcher::name].
14995 UnknownValue(job_state_matcher::UnknownValue),
14996 }
14997
14998 #[doc(hidden)]
14999 pub mod job_state_matcher {
15000 #[allow(unused_imports)]
15001 use super::*;
15002 #[derive(Clone, Debug, PartialEq)]
15003 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15004 }
15005
15006 impl JobStateMatcher {
15007 /// Gets the enum value.
15008 ///
15009 /// Returns `None` if the enum contains an unknown value deserialized from
15010 /// the string representation of enums.
15011 pub fn value(&self) -> std::option::Option<i32> {
15012 match self {
15013 Self::All => std::option::Option::Some(0),
15014 Self::Active => std::option::Option::Some(1),
15015 Self::NonActive => std::option::Option::Some(2),
15016 Self::UnknownValue(u) => u.0.value(),
15017 }
15018 }
15019
15020 /// Gets the enum value as a string.
15021 ///
15022 /// Returns `None` if the enum contains an unknown value deserialized from
15023 /// the integer representation of enums.
15024 pub fn name(&self) -> std::option::Option<&str> {
15025 match self {
15026 Self::All => std::option::Option::Some("ALL"),
15027 Self::Active => std::option::Option::Some("ACTIVE"),
15028 Self::NonActive => std::option::Option::Some("NON_ACTIVE"),
15029 Self::UnknownValue(u) => u.0.name(),
15030 }
15031 }
15032 }
15033
15034 impl std::default::Default for JobStateMatcher {
15035 fn default() -> Self {
15036 use std::convert::From;
15037 Self::from(0)
15038 }
15039 }
15040
15041 impl std::fmt::Display for JobStateMatcher {
15042 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15043 wkt::internal::display_enum(f, self.name(), self.value())
15044 }
15045 }
15046
15047 impl std::convert::From<i32> for JobStateMatcher {
15048 fn from(value: i32) -> Self {
15049 match value {
15050 0 => Self::All,
15051 1 => Self::Active,
15052 2 => Self::NonActive,
15053 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15054 wkt::internal::UnknownEnumValue::Integer(value),
15055 )),
15056 }
15057 }
15058 }
15059
15060 impl std::convert::From<&str> for JobStateMatcher {
15061 fn from(value: &str) -> Self {
15062 use std::string::ToString;
15063 match value {
15064 "ALL" => Self::All,
15065 "ACTIVE" => Self::Active,
15066 "NON_ACTIVE" => Self::NonActive,
15067 _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15068 wkt::internal::UnknownEnumValue::String(value.to_string()),
15069 )),
15070 }
15071 }
15072 }
15073
15074 impl serde::ser::Serialize for JobStateMatcher {
15075 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15076 where
15077 S: serde::Serializer,
15078 {
15079 match self {
15080 Self::All => serializer.serialize_i32(0),
15081 Self::Active => serializer.serialize_i32(1),
15082 Self::NonActive => serializer.serialize_i32(2),
15083 Self::UnknownValue(u) => u.0.serialize(serializer),
15084 }
15085 }
15086 }
15087
15088 impl<'de> serde::de::Deserialize<'de> for JobStateMatcher {
15089 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15090 where
15091 D: serde::Deserializer<'de>,
15092 {
15093 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobStateMatcher>::new(
15094 ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher",
15095 ))
15096 }
15097 }
15098}
15099
15100/// A request to update a job.
15101#[derive(Clone, Default, PartialEq)]
15102#[non_exhaustive]
15103pub struct UpdateJobRequest {
15104 /// Required. The ID of the Google Cloud Platform project that the job
15105 /// belongs to.
15106 pub project_id: std::string::String,
15107
15108 /// Required. The Dataproc region in which to handle the request.
15109 pub region: std::string::String,
15110
15111 /// Required. The job ID.
15112 pub job_id: std::string::String,
15113
15114 /// Required. The changes to the job.
15115 pub job: std::option::Option<crate::model::Job>,
15116
15117 /// Required. Specifies the path, relative to \<code\>Job\</code\>, of
15118 /// the field to update. For example, to update the labels of a Job the
15119 /// \<code\>update_mask\</code\> parameter would be specified as
15120 /// \<code\>labels\</code\>, and the `PATCH` request body would specify the new
15121 /// value. \<strong\>Note:\</strong\> Currently, \<code\>labels\</code\> is the only
15122 /// field that can be updated.
15123 pub update_mask: std::option::Option<wkt::FieldMask>,
15124
15125 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15126}
15127
15128impl UpdateJobRequest {
15129 pub fn new() -> Self {
15130 std::default::Default::default()
15131 }
15132
15133 /// Sets the value of [project_id][crate::model::UpdateJobRequest::project_id].
15134 ///
15135 /// # Example
15136 /// ```ignore,no_run
15137 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15138 /// let x = UpdateJobRequest::new().set_project_id("example");
15139 /// ```
15140 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15141 self.project_id = v.into();
15142 self
15143 }
15144
15145 /// Sets the value of [region][crate::model::UpdateJobRequest::region].
15146 ///
15147 /// # Example
15148 /// ```ignore,no_run
15149 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15150 /// let x = UpdateJobRequest::new().set_region("example");
15151 /// ```
15152 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15153 self.region = v.into();
15154 self
15155 }
15156
15157 /// Sets the value of [job_id][crate::model::UpdateJobRequest::job_id].
15158 ///
15159 /// # Example
15160 /// ```ignore,no_run
15161 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15162 /// let x = UpdateJobRequest::new().set_job_id("example");
15163 /// ```
15164 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15165 self.job_id = v.into();
15166 self
15167 }
15168
15169 /// Sets the value of [job][crate::model::UpdateJobRequest::job].
15170 ///
15171 /// # Example
15172 /// ```ignore,no_run
15173 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15174 /// use google_cloud_dataproc_v1::model::Job;
15175 /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
15176 /// ```
15177 pub fn set_job<T>(mut self, v: T) -> Self
15178 where
15179 T: std::convert::Into<crate::model::Job>,
15180 {
15181 self.job = std::option::Option::Some(v.into());
15182 self
15183 }
15184
15185 /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
15186 ///
15187 /// # Example
15188 /// ```ignore,no_run
15189 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15190 /// use google_cloud_dataproc_v1::model::Job;
15191 /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
15192 /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
15193 /// ```
15194 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
15195 where
15196 T: std::convert::Into<crate::model::Job>,
15197 {
15198 self.job = v.map(|x| x.into());
15199 self
15200 }
15201
15202 /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15203 ///
15204 /// # Example
15205 /// ```ignore,no_run
15206 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15207 /// use wkt::FieldMask;
15208 /// let x = UpdateJobRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15209 /// ```
15210 pub fn set_update_mask<T>(mut self, v: T) -> Self
15211 where
15212 T: std::convert::Into<wkt::FieldMask>,
15213 {
15214 self.update_mask = std::option::Option::Some(v.into());
15215 self
15216 }
15217
15218 /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15219 ///
15220 /// # Example
15221 /// ```ignore,no_run
15222 /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15223 /// use wkt::FieldMask;
15224 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15225 /// let x = UpdateJobRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15226 /// ```
15227 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15228 where
15229 T: std::convert::Into<wkt::FieldMask>,
15230 {
15231 self.update_mask = v.map(|x| x.into());
15232 self
15233 }
15234}
15235
15236impl wkt::message::Message for UpdateJobRequest {
15237 fn typename() -> &'static str {
15238 "type.googleapis.com/google.cloud.dataproc.v1.UpdateJobRequest"
15239 }
15240}
15241
15242/// A list of jobs in a project.
15243#[derive(Clone, Default, PartialEq)]
15244#[non_exhaustive]
15245pub struct ListJobsResponse {
15246 /// Output only. Jobs list.
15247 pub jobs: std::vec::Vec<crate::model::Job>,
15248
15249 /// Optional. This token is included in the response if there are more results
15250 /// to fetch. To fetch additional results, provide this value as the
15251 /// `page_token` in a subsequent \<code\>ListJobsRequest\</code\>.
15252 pub next_page_token: std::string::String,
15253
15254 /// Output only. List of jobs with
15255 /// [kms_key][google.cloud.dataproc.v1.EncryptionConfig.kms_key]-encrypted
15256 /// parameters that could not be decrypted. A response to a `jobs.get` request
15257 /// may indicate the reason for the decryption failure for a specific job.
15258 ///
15259 /// [google.cloud.dataproc.v1.EncryptionConfig.kms_key]: crate::model::EncryptionConfig::kms_key
15260 pub unreachable: std::vec::Vec<std::string::String>,
15261
15262 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15263}
15264
15265impl ListJobsResponse {
15266 pub fn new() -> Self {
15267 std::default::Default::default()
15268 }
15269
15270 /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
15271 ///
15272 /// # Example
15273 /// ```ignore,no_run
15274 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15275 /// use google_cloud_dataproc_v1::model::Job;
15276 /// let x = ListJobsResponse::new()
15277 /// .set_jobs([
15278 /// Job::default()/* use setters */,
15279 /// Job::default()/* use (different) setters */,
15280 /// ]);
15281 /// ```
15282 pub fn set_jobs<T, V>(mut self, v: T) -> Self
15283 where
15284 T: std::iter::IntoIterator<Item = V>,
15285 V: std::convert::Into<crate::model::Job>,
15286 {
15287 use std::iter::Iterator;
15288 self.jobs = v.into_iter().map(|i| i.into()).collect();
15289 self
15290 }
15291
15292 /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
15293 ///
15294 /// # Example
15295 /// ```ignore,no_run
15296 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15297 /// let x = ListJobsResponse::new().set_next_page_token("example");
15298 /// ```
15299 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15300 self.next_page_token = v.into();
15301 self
15302 }
15303
15304 /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
15305 ///
15306 /// # Example
15307 /// ```ignore,no_run
15308 /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15309 /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
15310 /// ```
15311 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
15312 where
15313 T: std::iter::IntoIterator<Item = V>,
15314 V: std::convert::Into<std::string::String>,
15315 {
15316 use std::iter::Iterator;
15317 self.unreachable = v.into_iter().map(|i| i.into()).collect();
15318 self
15319 }
15320}
15321
15322impl wkt::message::Message for ListJobsResponse {
15323 fn typename() -> &'static str {
15324 "type.googleapis.com/google.cloud.dataproc.v1.ListJobsResponse"
15325 }
15326}
15327
15328#[doc(hidden)]
15329impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
15330 type PageItem = crate::model::Job;
15331
15332 fn items(self) -> std::vec::Vec<Self::PageItem> {
15333 self.jobs
15334 }
15335
15336 fn next_page_token(&self) -> std::string::String {
15337 use std::clone::Clone;
15338 self.next_page_token.clone()
15339 }
15340}
15341
15342/// A request to cancel a job.
15343#[derive(Clone, Default, PartialEq)]
15344#[non_exhaustive]
15345pub struct CancelJobRequest {
15346 /// Required. The ID of the Google Cloud Platform project that the job
15347 /// belongs to.
15348 pub project_id: std::string::String,
15349
15350 /// Required. The Dataproc region in which to handle the request.
15351 pub region: std::string::String,
15352
15353 /// Required. The job ID.
15354 pub job_id: std::string::String,
15355
15356 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15357}
15358
15359impl CancelJobRequest {
15360 pub fn new() -> Self {
15361 std::default::Default::default()
15362 }
15363
15364 /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
15365 ///
15366 /// # Example
15367 /// ```ignore,no_run
15368 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15369 /// let x = CancelJobRequest::new().set_project_id("example");
15370 /// ```
15371 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15372 self.project_id = v.into();
15373 self
15374 }
15375
15376 /// Sets the value of [region][crate::model::CancelJobRequest::region].
15377 ///
15378 /// # Example
15379 /// ```ignore,no_run
15380 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15381 /// let x = CancelJobRequest::new().set_region("example");
15382 /// ```
15383 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15384 self.region = v.into();
15385 self
15386 }
15387
15388 /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
15389 ///
15390 /// # Example
15391 /// ```ignore,no_run
15392 /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15393 /// let x = CancelJobRequest::new().set_job_id("example");
15394 /// ```
15395 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15396 self.job_id = v.into();
15397 self
15398 }
15399}
15400
15401impl wkt::message::Message for CancelJobRequest {
15402 fn typename() -> &'static str {
15403 "type.googleapis.com/google.cloud.dataproc.v1.CancelJobRequest"
15404 }
15405}
15406
15407/// A request to delete a job.
15408#[derive(Clone, Default, PartialEq)]
15409#[non_exhaustive]
15410pub struct DeleteJobRequest {
15411 /// Required. The ID of the Google Cloud Platform project that the job
15412 /// belongs to.
15413 pub project_id: std::string::String,
15414
15415 /// Required. The Dataproc region in which to handle the request.
15416 pub region: std::string::String,
15417
15418 /// Required. The job ID.
15419 pub job_id: std::string::String,
15420
15421 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15422}
15423
15424impl DeleteJobRequest {
15425 pub fn new() -> Self {
15426 std::default::Default::default()
15427 }
15428
15429 /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
15430 ///
15431 /// # Example
15432 /// ```ignore,no_run
15433 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15434 /// let x = DeleteJobRequest::new().set_project_id("example");
15435 /// ```
15436 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15437 self.project_id = v.into();
15438 self
15439 }
15440
15441 /// Sets the value of [region][crate::model::DeleteJobRequest::region].
15442 ///
15443 /// # Example
15444 /// ```ignore,no_run
15445 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15446 /// let x = DeleteJobRequest::new().set_region("example");
15447 /// ```
15448 pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15449 self.region = v.into();
15450 self
15451 }
15452
15453 /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
15454 ///
15455 /// # Example
15456 /// ```ignore,no_run
15457 /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15458 /// let x = DeleteJobRequest::new().set_job_id("example");
15459 /// ```
15460 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15461 self.job_id = v.into();
15462 self
15463 }
15464}
15465
15466impl wkt::message::Message for DeleteJobRequest {
15467 fn typename() -> &'static str {
15468 "type.googleapis.com/google.cloud.dataproc.v1.DeleteJobRequest"
15469 }
15470}
15471
15472/// A request to create a node group.
15473#[derive(Clone, Default, PartialEq)]
15474#[non_exhaustive]
15475pub struct CreateNodeGroupRequest {
15476 /// Required. The parent resource where this node group will be created.
15477 /// Format: `projects/{project}/regions/{region}/clusters/{cluster}`
15478 pub parent: std::string::String,
15479
15480 /// Required. The node group to create.
15481 pub node_group: std::option::Option<crate::model::NodeGroup>,
15482
15483 /// Optional. An optional node group ID. Generated if not specified.
15484 ///
15485 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15486 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
15487 /// or hyphen. Must consist of from 3 to 33 characters.
15488 pub node_group_id: std::string::String,
15489
15490 /// Optional. A unique ID used to identify the request. If the server receives
15491 /// two
15492 /// [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests)
15493 /// with the same ID, the second request is ignored and the
15494 /// first [google.longrunning.Operation][google.longrunning.Operation] created
15495 /// and stored in the backend is returned.
15496 ///
15497 /// Recommendation: Set this value to a
15498 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15499 ///
15500 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15501 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15502 ///
15503 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
15504 pub request_id: std::string::String,
15505
15506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15507}
15508
15509impl CreateNodeGroupRequest {
15510 pub fn new() -> Self {
15511 std::default::Default::default()
15512 }
15513
15514 /// Sets the value of [parent][crate::model::CreateNodeGroupRequest::parent].
15515 ///
15516 /// # Example
15517 /// ```ignore,no_run
15518 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15519 /// let x = CreateNodeGroupRequest::new().set_parent("example");
15520 /// ```
15521 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15522 self.parent = v.into();
15523 self
15524 }
15525
15526 /// Sets the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
15527 ///
15528 /// # Example
15529 /// ```ignore,no_run
15530 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15531 /// use google_cloud_dataproc_v1::model::NodeGroup;
15532 /// let x = CreateNodeGroupRequest::new().set_node_group(NodeGroup::default()/* use setters */);
15533 /// ```
15534 pub fn set_node_group<T>(mut self, v: T) -> Self
15535 where
15536 T: std::convert::Into<crate::model::NodeGroup>,
15537 {
15538 self.node_group = std::option::Option::Some(v.into());
15539 self
15540 }
15541
15542 /// Sets or clears the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
15543 ///
15544 /// # Example
15545 /// ```ignore,no_run
15546 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15547 /// use google_cloud_dataproc_v1::model::NodeGroup;
15548 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
15549 /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(None::<NodeGroup>);
15550 /// ```
15551 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
15552 where
15553 T: std::convert::Into<crate::model::NodeGroup>,
15554 {
15555 self.node_group = v.map(|x| x.into());
15556 self
15557 }
15558
15559 /// Sets the value of [node_group_id][crate::model::CreateNodeGroupRequest::node_group_id].
15560 ///
15561 /// # Example
15562 /// ```ignore,no_run
15563 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15564 /// let x = CreateNodeGroupRequest::new().set_node_group_id("example");
15565 /// ```
15566 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15567 self.node_group_id = v.into();
15568 self
15569 }
15570
15571 /// Sets the value of [request_id][crate::model::CreateNodeGroupRequest::request_id].
15572 ///
15573 /// # Example
15574 /// ```ignore,no_run
15575 /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15576 /// let x = CreateNodeGroupRequest::new().set_request_id("example");
15577 /// ```
15578 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15579 self.request_id = v.into();
15580 self
15581 }
15582}
15583
15584impl wkt::message::Message for CreateNodeGroupRequest {
15585 fn typename() -> &'static str {
15586 "type.googleapis.com/google.cloud.dataproc.v1.CreateNodeGroupRequest"
15587 }
15588}
15589
15590/// A request to resize a node group.
15591#[derive(Clone, Default, PartialEq)]
15592#[non_exhaustive]
15593pub struct ResizeNodeGroupRequest {
15594 /// Required. The name of the node group to resize.
15595 /// Format:
15596 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
15597 pub name: std::string::String,
15598
15599 /// Required. The number of running instances for the node group to maintain.
15600 /// The group adds or removes instances to maintain the number of instances
15601 /// specified by this parameter.
15602 pub size: i32,
15603
15604 /// Optional. A unique ID used to identify the request. If the server receives
15605 /// two
15606 /// [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests)
15607 /// with the same ID, the second request is ignored and the
15608 /// first [google.longrunning.Operation][google.longrunning.Operation] created
15609 /// and stored in the backend is returned.
15610 ///
15611 /// Recommendation: Set this value to a
15612 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15613 ///
15614 /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15615 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15616 ///
15617 /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
15618 pub request_id: std::string::String,
15619
15620 /// Optional. Timeout for graceful YARN decommissioning. [Graceful
15621 /// decommissioning]
15622 /// (<https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning>)
15623 /// allows the removal of nodes from the Compute Engine node group
15624 /// without interrupting jobs in progress. This timeout specifies how long to
15625 /// wait for jobs in progress to finish before forcefully removing nodes (and
15626 /// potentially interrupting jobs). Default timeout is 0 (for forceful
15627 /// decommission), and the maximum allowed timeout is 1 day. (see JSON
15628 /// representation of
15629 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
15630 ///
15631 /// Only supported on Dataproc image versions 1.2 and higher.
15632 pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
15633
15634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15635}
15636
15637impl ResizeNodeGroupRequest {
15638 pub fn new() -> Self {
15639 std::default::Default::default()
15640 }
15641
15642 /// Sets the value of [name][crate::model::ResizeNodeGroupRequest::name].
15643 ///
15644 /// # Example
15645 /// ```ignore,no_run
15646 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15647 /// let x = ResizeNodeGroupRequest::new().set_name("example");
15648 /// ```
15649 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15650 self.name = v.into();
15651 self
15652 }
15653
15654 /// Sets the value of [size][crate::model::ResizeNodeGroupRequest::size].
15655 ///
15656 /// # Example
15657 /// ```ignore,no_run
15658 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15659 /// let x = ResizeNodeGroupRequest::new().set_size(42);
15660 /// ```
15661 pub fn set_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15662 self.size = v.into();
15663 self
15664 }
15665
15666 /// Sets the value of [request_id][crate::model::ResizeNodeGroupRequest::request_id].
15667 ///
15668 /// # Example
15669 /// ```ignore,no_run
15670 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15671 /// let x = ResizeNodeGroupRequest::new().set_request_id("example");
15672 /// ```
15673 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15674 self.request_id = v.into();
15675 self
15676 }
15677
15678 /// Sets the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
15679 ///
15680 /// # Example
15681 /// ```ignore,no_run
15682 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15683 /// use wkt::Duration;
15684 /// let x = ResizeNodeGroupRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
15685 /// ```
15686 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
15687 where
15688 T: std::convert::Into<wkt::Duration>,
15689 {
15690 self.graceful_decommission_timeout = std::option::Option::Some(v.into());
15691 self
15692 }
15693
15694 /// Sets or clears the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
15695 ///
15696 /// # Example
15697 /// ```ignore,no_run
15698 /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15699 /// use wkt::Duration;
15700 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
15701 /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
15702 /// ```
15703 pub fn set_or_clear_graceful_decommission_timeout<T>(
15704 mut self,
15705 v: std::option::Option<T>,
15706 ) -> Self
15707 where
15708 T: std::convert::Into<wkt::Duration>,
15709 {
15710 self.graceful_decommission_timeout = v.map(|x| x.into());
15711 self
15712 }
15713}
15714
15715impl wkt::message::Message for ResizeNodeGroupRequest {
15716 fn typename() -> &'static str {
15717 "type.googleapis.com/google.cloud.dataproc.v1.ResizeNodeGroupRequest"
15718 }
15719}
15720
15721/// A request to get a node group .
15722#[derive(Clone, Default, PartialEq)]
15723#[non_exhaustive]
15724pub struct GetNodeGroupRequest {
15725 /// Required. The name of the node group to retrieve.
15726 /// Format:
15727 /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
15728 pub name: std::string::String,
15729
15730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15731}
15732
15733impl GetNodeGroupRequest {
15734 pub fn new() -> Self {
15735 std::default::Default::default()
15736 }
15737
15738 /// Sets the value of [name][crate::model::GetNodeGroupRequest::name].
15739 ///
15740 /// # Example
15741 /// ```ignore,no_run
15742 /// # use google_cloud_dataproc_v1::model::GetNodeGroupRequest;
15743 /// let x = GetNodeGroupRequest::new().set_name("example");
15744 /// ```
15745 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15746 self.name = v.into();
15747 self
15748 }
15749}
15750
15751impl wkt::message::Message for GetNodeGroupRequest {
15752 fn typename() -> &'static str {
15753 "type.googleapis.com/google.cloud.dataproc.v1.GetNodeGroupRequest"
15754 }
15755}
15756
15757/// Metadata describing the Batch operation.
15758#[derive(Clone, Default, PartialEq)]
15759#[non_exhaustive]
15760pub struct BatchOperationMetadata {
15761 /// Name of the batch for the operation.
15762 pub batch: std::string::String,
15763
15764 /// Batch UUID for the operation.
15765 pub batch_uuid: std::string::String,
15766
15767 /// The time when the operation was created.
15768 pub create_time: std::option::Option<wkt::Timestamp>,
15769
15770 /// The time when the operation finished.
15771 pub done_time: std::option::Option<wkt::Timestamp>,
15772
15773 /// The operation type.
15774 pub operation_type: crate::model::batch_operation_metadata::BatchOperationType,
15775
15776 /// Short description of the operation.
15777 pub description: std::string::String,
15778
15779 /// Labels associated with the operation.
15780 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15781
15782 /// Warnings encountered during operation execution.
15783 pub warnings: std::vec::Vec<std::string::String>,
15784
15785 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15786}
15787
15788impl BatchOperationMetadata {
15789 pub fn new() -> Self {
15790 std::default::Default::default()
15791 }
15792
15793 /// Sets the value of [batch][crate::model::BatchOperationMetadata::batch].
15794 ///
15795 /// # Example
15796 /// ```ignore,no_run
15797 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15798 /// let x = BatchOperationMetadata::new().set_batch("example");
15799 /// ```
15800 pub fn set_batch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15801 self.batch = v.into();
15802 self
15803 }
15804
15805 /// Sets the value of [batch_uuid][crate::model::BatchOperationMetadata::batch_uuid].
15806 ///
15807 /// # Example
15808 /// ```ignore,no_run
15809 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15810 /// let x = BatchOperationMetadata::new().set_batch_uuid("example");
15811 /// ```
15812 pub fn set_batch_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15813 self.batch_uuid = v.into();
15814 self
15815 }
15816
15817 /// Sets the value of [create_time][crate::model::BatchOperationMetadata::create_time].
15818 ///
15819 /// # Example
15820 /// ```ignore,no_run
15821 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15822 /// use wkt::Timestamp;
15823 /// let x = BatchOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
15824 /// ```
15825 pub fn set_create_time<T>(mut self, v: T) -> Self
15826 where
15827 T: std::convert::Into<wkt::Timestamp>,
15828 {
15829 self.create_time = std::option::Option::Some(v.into());
15830 self
15831 }
15832
15833 /// Sets or clears the value of [create_time][crate::model::BatchOperationMetadata::create_time].
15834 ///
15835 /// # Example
15836 /// ```ignore,no_run
15837 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15838 /// use wkt::Timestamp;
15839 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15840 /// let x = BatchOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
15841 /// ```
15842 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15843 where
15844 T: std::convert::Into<wkt::Timestamp>,
15845 {
15846 self.create_time = v.map(|x| x.into());
15847 self
15848 }
15849
15850 /// Sets the value of [done_time][crate::model::BatchOperationMetadata::done_time].
15851 ///
15852 /// # Example
15853 /// ```ignore,no_run
15854 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15855 /// use wkt::Timestamp;
15856 /// let x = BatchOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
15857 /// ```
15858 pub fn set_done_time<T>(mut self, v: T) -> Self
15859 where
15860 T: std::convert::Into<wkt::Timestamp>,
15861 {
15862 self.done_time = std::option::Option::Some(v.into());
15863 self
15864 }
15865
15866 /// Sets or clears the value of [done_time][crate::model::BatchOperationMetadata::done_time].
15867 ///
15868 /// # Example
15869 /// ```ignore,no_run
15870 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15871 /// use wkt::Timestamp;
15872 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
15873 /// let x = BatchOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
15874 /// ```
15875 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
15876 where
15877 T: std::convert::Into<wkt::Timestamp>,
15878 {
15879 self.done_time = v.map(|x| x.into());
15880 self
15881 }
15882
15883 /// Sets the value of [operation_type][crate::model::BatchOperationMetadata::operation_type].
15884 ///
15885 /// # Example
15886 /// ```ignore,no_run
15887 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15888 /// use google_cloud_dataproc_v1::model::batch_operation_metadata::BatchOperationType;
15889 /// let x0 = BatchOperationMetadata::new().set_operation_type(BatchOperationType::Batch);
15890 /// ```
15891 pub fn set_operation_type<
15892 T: std::convert::Into<crate::model::batch_operation_metadata::BatchOperationType>,
15893 >(
15894 mut self,
15895 v: T,
15896 ) -> Self {
15897 self.operation_type = v.into();
15898 self
15899 }
15900
15901 /// Sets the value of [description][crate::model::BatchOperationMetadata::description].
15902 ///
15903 /// # Example
15904 /// ```ignore,no_run
15905 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15906 /// let x = BatchOperationMetadata::new().set_description("example");
15907 /// ```
15908 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15909 self.description = v.into();
15910 self
15911 }
15912
15913 /// Sets the value of [labels][crate::model::BatchOperationMetadata::labels].
15914 ///
15915 /// # Example
15916 /// ```ignore,no_run
15917 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15918 /// let x = BatchOperationMetadata::new().set_labels([
15919 /// ("key0", "abc"),
15920 /// ("key1", "xyz"),
15921 /// ]);
15922 /// ```
15923 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15924 where
15925 T: std::iter::IntoIterator<Item = (K, V)>,
15926 K: std::convert::Into<std::string::String>,
15927 V: std::convert::Into<std::string::String>,
15928 {
15929 use std::iter::Iterator;
15930 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15931 self
15932 }
15933
15934 /// Sets the value of [warnings][crate::model::BatchOperationMetadata::warnings].
15935 ///
15936 /// # Example
15937 /// ```ignore,no_run
15938 /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
15939 /// let x = BatchOperationMetadata::new().set_warnings(["a", "b", "c"]);
15940 /// ```
15941 pub fn set_warnings<T, V>(mut self, v: T) -> Self
15942 where
15943 T: std::iter::IntoIterator<Item = V>,
15944 V: std::convert::Into<std::string::String>,
15945 {
15946 use std::iter::Iterator;
15947 self.warnings = v.into_iter().map(|i| i.into()).collect();
15948 self
15949 }
15950}
15951
15952impl wkt::message::Message for BatchOperationMetadata {
15953 fn typename() -> &'static str {
15954 "type.googleapis.com/google.cloud.dataproc.v1.BatchOperationMetadata"
15955 }
15956}
15957
15958/// Defines additional types related to [BatchOperationMetadata].
15959pub mod batch_operation_metadata {
15960 #[allow(unused_imports)]
15961 use super::*;
15962
15963 /// Operation type for Batch resources
15964 ///
15965 /// # Working with unknown values
15966 ///
15967 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15968 /// additional enum variants at any time. Adding new variants is not considered
15969 /// a breaking change. Applications should write their code in anticipation of:
15970 ///
15971 /// - New values appearing in future releases of the client library, **and**
15972 /// - New values received dynamically, without application changes.
15973 ///
15974 /// Please consult the [Working with enums] section in the user guide for some
15975 /// guidelines.
15976 ///
15977 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15978 #[derive(Clone, Debug, PartialEq)]
15979 #[non_exhaustive]
15980 pub enum BatchOperationType {
15981 /// Batch operation type is unknown.
15982 Unspecified,
15983 /// Batch operation type.
15984 Batch,
15985 /// If set, the enum was initialized with an unknown value.
15986 ///
15987 /// Applications can examine the value using [BatchOperationType::value] or
15988 /// [BatchOperationType::name].
15989 UnknownValue(batch_operation_type::UnknownValue),
15990 }
15991
15992 #[doc(hidden)]
15993 pub mod batch_operation_type {
15994 #[allow(unused_imports)]
15995 use super::*;
15996 #[derive(Clone, Debug, PartialEq)]
15997 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15998 }
15999
16000 impl BatchOperationType {
16001 /// Gets the enum value.
16002 ///
16003 /// Returns `None` if the enum contains an unknown value deserialized from
16004 /// the string representation of enums.
16005 pub fn value(&self) -> std::option::Option<i32> {
16006 match self {
16007 Self::Unspecified => std::option::Option::Some(0),
16008 Self::Batch => std::option::Option::Some(1),
16009 Self::UnknownValue(u) => u.0.value(),
16010 }
16011 }
16012
16013 /// Gets the enum value as a string.
16014 ///
16015 /// Returns `None` if the enum contains an unknown value deserialized from
16016 /// the integer representation of enums.
16017 pub fn name(&self) -> std::option::Option<&str> {
16018 match self {
16019 Self::Unspecified => std::option::Option::Some("BATCH_OPERATION_TYPE_UNSPECIFIED"),
16020 Self::Batch => std::option::Option::Some("BATCH"),
16021 Self::UnknownValue(u) => u.0.name(),
16022 }
16023 }
16024 }
16025
16026 impl std::default::Default for BatchOperationType {
16027 fn default() -> Self {
16028 use std::convert::From;
16029 Self::from(0)
16030 }
16031 }
16032
16033 impl std::fmt::Display for BatchOperationType {
16034 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16035 wkt::internal::display_enum(f, self.name(), self.value())
16036 }
16037 }
16038
16039 impl std::convert::From<i32> for BatchOperationType {
16040 fn from(value: i32) -> Self {
16041 match value {
16042 0 => Self::Unspecified,
16043 1 => Self::Batch,
16044 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16045 wkt::internal::UnknownEnumValue::Integer(value),
16046 )),
16047 }
16048 }
16049 }
16050
16051 impl std::convert::From<&str> for BatchOperationType {
16052 fn from(value: &str) -> Self {
16053 use std::string::ToString;
16054 match value {
16055 "BATCH_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16056 "BATCH" => Self::Batch,
16057 _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16058 wkt::internal::UnknownEnumValue::String(value.to_string()),
16059 )),
16060 }
16061 }
16062 }
16063
16064 impl serde::ser::Serialize for BatchOperationType {
16065 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16066 where
16067 S: serde::Serializer,
16068 {
16069 match self {
16070 Self::Unspecified => serializer.serialize_i32(0),
16071 Self::Batch => serializer.serialize_i32(1),
16072 Self::UnknownValue(u) => u.0.serialize(serializer),
16073 }
16074 }
16075 }
16076
16077 impl<'de> serde::de::Deserialize<'de> for BatchOperationType {
16078 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16079 where
16080 D: serde::Deserializer<'de>,
16081 {
16082 deserializer.deserialize_any(wkt::internal::EnumVisitor::<BatchOperationType>::new(
16083 ".google.cloud.dataproc.v1.BatchOperationMetadata.BatchOperationType",
16084 ))
16085 }
16086 }
16087}
16088
16089/// Metadata describing the Session operation.
16090#[derive(Clone, Default, PartialEq)]
16091#[non_exhaustive]
16092pub struct SessionOperationMetadata {
16093 /// Name of the session for the operation.
16094 pub session: std::string::String,
16095
16096 /// Session UUID for the operation.
16097 pub session_uuid: std::string::String,
16098
16099 /// The time when the operation was created.
16100 pub create_time: std::option::Option<wkt::Timestamp>,
16101
16102 /// The time when the operation was finished.
16103 pub done_time: std::option::Option<wkt::Timestamp>,
16104
16105 /// The operation type.
16106 pub operation_type: crate::model::session_operation_metadata::SessionOperationType,
16107
16108 /// Short description of the operation.
16109 pub description: std::string::String,
16110
16111 /// Labels associated with the operation.
16112 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16113
16114 /// Warnings encountered during operation execution.
16115 pub warnings: std::vec::Vec<std::string::String>,
16116
16117 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16118}
16119
16120impl SessionOperationMetadata {
16121 pub fn new() -> Self {
16122 std::default::Default::default()
16123 }
16124
16125 /// Sets the value of [session][crate::model::SessionOperationMetadata::session].
16126 ///
16127 /// # Example
16128 /// ```ignore,no_run
16129 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16130 /// let x = SessionOperationMetadata::new().set_session("example");
16131 /// ```
16132 pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16133 self.session = v.into();
16134 self
16135 }
16136
16137 /// Sets the value of [session_uuid][crate::model::SessionOperationMetadata::session_uuid].
16138 ///
16139 /// # Example
16140 /// ```ignore,no_run
16141 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16142 /// let x = SessionOperationMetadata::new().set_session_uuid("example");
16143 /// ```
16144 pub fn set_session_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16145 self.session_uuid = v.into();
16146 self
16147 }
16148
16149 /// Sets the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16150 ///
16151 /// # Example
16152 /// ```ignore,no_run
16153 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16154 /// use wkt::Timestamp;
16155 /// let x = SessionOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16156 /// ```
16157 pub fn set_create_time<T>(mut self, v: T) -> Self
16158 where
16159 T: std::convert::Into<wkt::Timestamp>,
16160 {
16161 self.create_time = std::option::Option::Some(v.into());
16162 self
16163 }
16164
16165 /// Sets or clears the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16166 ///
16167 /// # Example
16168 /// ```ignore,no_run
16169 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16170 /// use wkt::Timestamp;
16171 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16172 /// let x = SessionOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16173 /// ```
16174 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16175 where
16176 T: std::convert::Into<wkt::Timestamp>,
16177 {
16178 self.create_time = v.map(|x| x.into());
16179 self
16180 }
16181
16182 /// Sets the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16183 ///
16184 /// # Example
16185 /// ```ignore,no_run
16186 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16187 /// use wkt::Timestamp;
16188 /// let x = SessionOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16189 /// ```
16190 pub fn set_done_time<T>(mut self, v: T) -> Self
16191 where
16192 T: std::convert::Into<wkt::Timestamp>,
16193 {
16194 self.done_time = std::option::Option::Some(v.into());
16195 self
16196 }
16197
16198 /// Sets or clears the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16199 ///
16200 /// # Example
16201 /// ```ignore,no_run
16202 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16203 /// use wkt::Timestamp;
16204 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16205 /// let x = SessionOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16206 /// ```
16207 pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16208 where
16209 T: std::convert::Into<wkt::Timestamp>,
16210 {
16211 self.done_time = v.map(|x| x.into());
16212 self
16213 }
16214
16215 /// Sets the value of [operation_type][crate::model::SessionOperationMetadata::operation_type].
16216 ///
16217 /// # Example
16218 /// ```ignore,no_run
16219 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16220 /// use google_cloud_dataproc_v1::model::session_operation_metadata::SessionOperationType;
16221 /// let x0 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Create);
16222 /// let x1 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Terminate);
16223 /// let x2 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Delete);
16224 /// ```
16225 pub fn set_operation_type<
16226 T: std::convert::Into<crate::model::session_operation_metadata::SessionOperationType>,
16227 >(
16228 mut self,
16229 v: T,
16230 ) -> Self {
16231 self.operation_type = v.into();
16232 self
16233 }
16234
16235 /// Sets the value of [description][crate::model::SessionOperationMetadata::description].
16236 ///
16237 /// # Example
16238 /// ```ignore,no_run
16239 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16240 /// let x = SessionOperationMetadata::new().set_description("example");
16241 /// ```
16242 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16243 self.description = v.into();
16244 self
16245 }
16246
16247 /// Sets the value of [labels][crate::model::SessionOperationMetadata::labels].
16248 ///
16249 /// # Example
16250 /// ```ignore,no_run
16251 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16252 /// let x = SessionOperationMetadata::new().set_labels([
16253 /// ("key0", "abc"),
16254 /// ("key1", "xyz"),
16255 /// ]);
16256 /// ```
16257 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16258 where
16259 T: std::iter::IntoIterator<Item = (K, V)>,
16260 K: std::convert::Into<std::string::String>,
16261 V: std::convert::Into<std::string::String>,
16262 {
16263 use std::iter::Iterator;
16264 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16265 self
16266 }
16267
16268 /// Sets the value of [warnings][crate::model::SessionOperationMetadata::warnings].
16269 ///
16270 /// # Example
16271 /// ```ignore,no_run
16272 /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16273 /// let x = SessionOperationMetadata::new().set_warnings(["a", "b", "c"]);
16274 /// ```
16275 pub fn set_warnings<T, V>(mut self, v: T) -> Self
16276 where
16277 T: std::iter::IntoIterator<Item = V>,
16278 V: std::convert::Into<std::string::String>,
16279 {
16280 use std::iter::Iterator;
16281 self.warnings = v.into_iter().map(|i| i.into()).collect();
16282 self
16283 }
16284}
16285
16286impl wkt::message::Message for SessionOperationMetadata {
16287 fn typename() -> &'static str {
16288 "type.googleapis.com/google.cloud.dataproc.v1.SessionOperationMetadata"
16289 }
16290}
16291
16292/// Defines additional types related to [SessionOperationMetadata].
16293pub mod session_operation_metadata {
16294 #[allow(unused_imports)]
16295 use super::*;
16296
16297 /// Operation type for Session resources
16298 ///
16299 /// # Working with unknown values
16300 ///
16301 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16302 /// additional enum variants at any time. Adding new variants is not considered
16303 /// a breaking change. Applications should write their code in anticipation of:
16304 ///
16305 /// - New values appearing in future releases of the client library, **and**
16306 /// - New values received dynamically, without application changes.
16307 ///
16308 /// Please consult the [Working with enums] section in the user guide for some
16309 /// guidelines.
16310 ///
16311 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16312 #[derive(Clone, Debug, PartialEq)]
16313 #[non_exhaustive]
16314 pub enum SessionOperationType {
16315 /// Session operation type is unknown.
16316 Unspecified,
16317 /// Create Session operation type.
16318 Create,
16319 /// Terminate Session operation type.
16320 Terminate,
16321 /// Delete Session operation type.
16322 Delete,
16323 /// If set, the enum was initialized with an unknown value.
16324 ///
16325 /// Applications can examine the value using [SessionOperationType::value] or
16326 /// [SessionOperationType::name].
16327 UnknownValue(session_operation_type::UnknownValue),
16328 }
16329
16330 #[doc(hidden)]
16331 pub mod session_operation_type {
16332 #[allow(unused_imports)]
16333 use super::*;
16334 #[derive(Clone, Debug, PartialEq)]
16335 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16336 }
16337
16338 impl SessionOperationType {
16339 /// Gets the enum value.
16340 ///
16341 /// Returns `None` if the enum contains an unknown value deserialized from
16342 /// the string representation of enums.
16343 pub fn value(&self) -> std::option::Option<i32> {
16344 match self {
16345 Self::Unspecified => std::option::Option::Some(0),
16346 Self::Create => std::option::Option::Some(1),
16347 Self::Terminate => std::option::Option::Some(2),
16348 Self::Delete => std::option::Option::Some(3),
16349 Self::UnknownValue(u) => u.0.value(),
16350 }
16351 }
16352
16353 /// Gets the enum value as a string.
16354 ///
16355 /// Returns `None` if the enum contains an unknown value deserialized from
16356 /// the integer representation of enums.
16357 pub fn name(&self) -> std::option::Option<&str> {
16358 match self {
16359 Self::Unspecified => {
16360 std::option::Option::Some("SESSION_OPERATION_TYPE_UNSPECIFIED")
16361 }
16362 Self::Create => std::option::Option::Some("CREATE"),
16363 Self::Terminate => std::option::Option::Some("TERMINATE"),
16364 Self::Delete => std::option::Option::Some("DELETE"),
16365 Self::UnknownValue(u) => u.0.name(),
16366 }
16367 }
16368 }
16369
16370 impl std::default::Default for SessionOperationType {
16371 fn default() -> Self {
16372 use std::convert::From;
16373 Self::from(0)
16374 }
16375 }
16376
16377 impl std::fmt::Display for SessionOperationType {
16378 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16379 wkt::internal::display_enum(f, self.name(), self.value())
16380 }
16381 }
16382
16383 impl std::convert::From<i32> for SessionOperationType {
16384 fn from(value: i32) -> Self {
16385 match value {
16386 0 => Self::Unspecified,
16387 1 => Self::Create,
16388 2 => Self::Terminate,
16389 3 => Self::Delete,
16390 _ => Self::UnknownValue(session_operation_type::UnknownValue(
16391 wkt::internal::UnknownEnumValue::Integer(value),
16392 )),
16393 }
16394 }
16395 }
16396
16397 impl std::convert::From<&str> for SessionOperationType {
16398 fn from(value: &str) -> Self {
16399 use std::string::ToString;
16400 match value {
16401 "SESSION_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16402 "CREATE" => Self::Create,
16403 "TERMINATE" => Self::Terminate,
16404 "DELETE" => Self::Delete,
16405 _ => Self::UnknownValue(session_operation_type::UnknownValue(
16406 wkt::internal::UnknownEnumValue::String(value.to_string()),
16407 )),
16408 }
16409 }
16410 }
16411
16412 impl serde::ser::Serialize for SessionOperationType {
16413 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16414 where
16415 S: serde::Serializer,
16416 {
16417 match self {
16418 Self::Unspecified => serializer.serialize_i32(0),
16419 Self::Create => serializer.serialize_i32(1),
16420 Self::Terminate => serializer.serialize_i32(2),
16421 Self::Delete => serializer.serialize_i32(3),
16422 Self::UnknownValue(u) => u.0.serialize(serializer),
16423 }
16424 }
16425 }
16426
16427 impl<'de> serde::de::Deserialize<'de> for SessionOperationType {
16428 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16429 where
16430 D: serde::Deserializer<'de>,
16431 {
16432 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionOperationType>::new(
16433 ".google.cloud.dataproc.v1.SessionOperationMetadata.SessionOperationType",
16434 ))
16435 }
16436 }
16437}
16438
16439/// The status of the operation.
16440#[derive(Clone, Default, PartialEq)]
16441#[non_exhaustive]
16442pub struct ClusterOperationStatus {
16443 /// Output only. A message containing the operation state.
16444 pub state: crate::model::cluster_operation_status::State,
16445
16446 /// Output only. A message containing the detailed operation state.
16447 pub inner_state: std::string::String,
16448
16449 /// Output only. A message containing any operation metadata details.
16450 pub details: std::string::String,
16451
16452 /// Output only. The time this state was entered.
16453 pub state_start_time: std::option::Option<wkt::Timestamp>,
16454
16455 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16456}
16457
16458impl ClusterOperationStatus {
16459 pub fn new() -> Self {
16460 std::default::Default::default()
16461 }
16462
16463 /// Sets the value of [state][crate::model::ClusterOperationStatus::state].
16464 ///
16465 /// # Example
16466 /// ```ignore,no_run
16467 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16468 /// use google_cloud_dataproc_v1::model::cluster_operation_status::State;
16469 /// let x0 = ClusterOperationStatus::new().set_state(State::Pending);
16470 /// let x1 = ClusterOperationStatus::new().set_state(State::Running);
16471 /// let x2 = ClusterOperationStatus::new().set_state(State::Done);
16472 /// ```
16473 pub fn set_state<T: std::convert::Into<crate::model::cluster_operation_status::State>>(
16474 mut self,
16475 v: T,
16476 ) -> Self {
16477 self.state = v.into();
16478 self
16479 }
16480
16481 /// Sets the value of [inner_state][crate::model::ClusterOperationStatus::inner_state].
16482 ///
16483 /// # Example
16484 /// ```ignore,no_run
16485 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16486 /// let x = ClusterOperationStatus::new().set_inner_state("example");
16487 /// ```
16488 pub fn set_inner_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16489 self.inner_state = v.into();
16490 self
16491 }
16492
16493 /// Sets the value of [details][crate::model::ClusterOperationStatus::details].
16494 ///
16495 /// # Example
16496 /// ```ignore,no_run
16497 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16498 /// let x = ClusterOperationStatus::new().set_details("example");
16499 /// ```
16500 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16501 self.details = v.into();
16502 self
16503 }
16504
16505 /// Sets the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
16506 ///
16507 /// # Example
16508 /// ```ignore,no_run
16509 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16510 /// use wkt::Timestamp;
16511 /// let x = ClusterOperationStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
16512 /// ```
16513 pub fn set_state_start_time<T>(mut self, v: T) -> Self
16514 where
16515 T: std::convert::Into<wkt::Timestamp>,
16516 {
16517 self.state_start_time = std::option::Option::Some(v.into());
16518 self
16519 }
16520
16521 /// Sets or clears the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
16522 ///
16523 /// # Example
16524 /// ```ignore,no_run
16525 /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16526 /// use wkt::Timestamp;
16527 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
16528 /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
16529 /// ```
16530 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
16531 where
16532 T: std::convert::Into<wkt::Timestamp>,
16533 {
16534 self.state_start_time = v.map(|x| x.into());
16535 self
16536 }
16537}
16538
16539impl wkt::message::Message for ClusterOperationStatus {
16540 fn typename() -> &'static str {
16541 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationStatus"
16542 }
16543}
16544
16545/// Defines additional types related to [ClusterOperationStatus].
16546pub mod cluster_operation_status {
16547 #[allow(unused_imports)]
16548 use super::*;
16549
16550 /// The operation state.
16551 ///
16552 /// # Working with unknown values
16553 ///
16554 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16555 /// additional enum variants at any time. Adding new variants is not considered
16556 /// a breaking change. Applications should write their code in anticipation of:
16557 ///
16558 /// - New values appearing in future releases of the client library, **and**
16559 /// - New values received dynamically, without application changes.
16560 ///
16561 /// Please consult the [Working with enums] section in the user guide for some
16562 /// guidelines.
16563 ///
16564 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16565 #[derive(Clone, Debug, PartialEq)]
16566 #[non_exhaustive]
16567 pub enum State {
16568 /// Unused.
16569 Unknown,
16570 /// The operation has been created.
16571 Pending,
16572 /// The operation is running.
16573 Running,
16574 /// The operation is done; either cancelled or completed.
16575 Done,
16576 /// If set, the enum was initialized with an unknown value.
16577 ///
16578 /// Applications can examine the value using [State::value] or
16579 /// [State::name].
16580 UnknownValue(state::UnknownValue),
16581 }
16582
16583 #[doc(hidden)]
16584 pub mod state {
16585 #[allow(unused_imports)]
16586 use super::*;
16587 #[derive(Clone, Debug, PartialEq)]
16588 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16589 }
16590
16591 impl State {
16592 /// Gets the enum value.
16593 ///
16594 /// Returns `None` if the enum contains an unknown value deserialized from
16595 /// the string representation of enums.
16596 pub fn value(&self) -> std::option::Option<i32> {
16597 match self {
16598 Self::Unknown => std::option::Option::Some(0),
16599 Self::Pending => std::option::Option::Some(1),
16600 Self::Running => std::option::Option::Some(2),
16601 Self::Done => std::option::Option::Some(3),
16602 Self::UnknownValue(u) => u.0.value(),
16603 }
16604 }
16605
16606 /// Gets the enum value as a string.
16607 ///
16608 /// Returns `None` if the enum contains an unknown value deserialized from
16609 /// the integer representation of enums.
16610 pub fn name(&self) -> std::option::Option<&str> {
16611 match self {
16612 Self::Unknown => std::option::Option::Some("UNKNOWN"),
16613 Self::Pending => std::option::Option::Some("PENDING"),
16614 Self::Running => std::option::Option::Some("RUNNING"),
16615 Self::Done => std::option::Option::Some("DONE"),
16616 Self::UnknownValue(u) => u.0.name(),
16617 }
16618 }
16619 }
16620
16621 impl std::default::Default for State {
16622 fn default() -> Self {
16623 use std::convert::From;
16624 Self::from(0)
16625 }
16626 }
16627
16628 impl std::fmt::Display for State {
16629 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16630 wkt::internal::display_enum(f, self.name(), self.value())
16631 }
16632 }
16633
16634 impl std::convert::From<i32> for State {
16635 fn from(value: i32) -> Self {
16636 match value {
16637 0 => Self::Unknown,
16638 1 => Self::Pending,
16639 2 => Self::Running,
16640 3 => Self::Done,
16641 _ => Self::UnknownValue(state::UnknownValue(
16642 wkt::internal::UnknownEnumValue::Integer(value),
16643 )),
16644 }
16645 }
16646 }
16647
16648 impl std::convert::From<&str> for State {
16649 fn from(value: &str) -> Self {
16650 use std::string::ToString;
16651 match value {
16652 "UNKNOWN" => Self::Unknown,
16653 "PENDING" => Self::Pending,
16654 "RUNNING" => Self::Running,
16655 "DONE" => Self::Done,
16656 _ => Self::UnknownValue(state::UnknownValue(
16657 wkt::internal::UnknownEnumValue::String(value.to_string()),
16658 )),
16659 }
16660 }
16661 }
16662
16663 impl serde::ser::Serialize for State {
16664 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16665 where
16666 S: serde::Serializer,
16667 {
16668 match self {
16669 Self::Unknown => serializer.serialize_i32(0),
16670 Self::Pending => serializer.serialize_i32(1),
16671 Self::Running => serializer.serialize_i32(2),
16672 Self::Done => serializer.serialize_i32(3),
16673 Self::UnknownValue(u) => u.0.serialize(serializer),
16674 }
16675 }
16676 }
16677
16678 impl<'de> serde::de::Deserialize<'de> for State {
16679 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16680 where
16681 D: serde::Deserializer<'de>,
16682 {
16683 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
16684 ".google.cloud.dataproc.v1.ClusterOperationStatus.State",
16685 ))
16686 }
16687 }
16688}
16689
16690/// Metadata describing the operation.
16691#[derive(Clone, Default, PartialEq)]
16692#[non_exhaustive]
16693pub struct ClusterOperationMetadata {
16694 /// Output only. Name of the cluster for the operation.
16695 pub cluster_name: std::string::String,
16696
16697 /// Output only. Cluster UUID for the operation.
16698 pub cluster_uuid: std::string::String,
16699
16700 /// Output only. Current operation status.
16701 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
16702
16703 /// Output only. The previous operation status.
16704 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
16705
16706 /// Output only. The operation type.
16707 pub operation_type: std::string::String,
16708
16709 /// Output only. Short description of operation.
16710 pub description: std::string::String,
16711
16712 /// Output only. Labels associated with the operation
16713 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16714
16715 /// Output only. Errors encountered during operation execution.
16716 pub warnings: std::vec::Vec<std::string::String>,
16717
16718 /// Output only. Child operation ids
16719 pub child_operation_ids: std::vec::Vec<std::string::String>,
16720
16721 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16722}
16723
16724impl ClusterOperationMetadata {
16725 pub fn new() -> Self {
16726 std::default::Default::default()
16727 }
16728
16729 /// Sets the value of [cluster_name][crate::model::ClusterOperationMetadata::cluster_name].
16730 ///
16731 /// # Example
16732 /// ```ignore,no_run
16733 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16734 /// let x = ClusterOperationMetadata::new().set_cluster_name("example");
16735 /// ```
16736 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16737 self.cluster_name = v.into();
16738 self
16739 }
16740
16741 /// Sets the value of [cluster_uuid][crate::model::ClusterOperationMetadata::cluster_uuid].
16742 ///
16743 /// # Example
16744 /// ```ignore,no_run
16745 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16746 /// let x = ClusterOperationMetadata::new().set_cluster_uuid("example");
16747 /// ```
16748 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16749 self.cluster_uuid = v.into();
16750 self
16751 }
16752
16753 /// Sets the value of [status][crate::model::ClusterOperationMetadata::status].
16754 ///
16755 /// # Example
16756 /// ```ignore,no_run
16757 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16758 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16759 /// let x = ClusterOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
16760 /// ```
16761 pub fn set_status<T>(mut self, v: T) -> Self
16762 where
16763 T: std::convert::Into<crate::model::ClusterOperationStatus>,
16764 {
16765 self.status = std::option::Option::Some(v.into());
16766 self
16767 }
16768
16769 /// Sets or clears the value of [status][crate::model::ClusterOperationMetadata::status].
16770 ///
16771 /// # Example
16772 /// ```ignore,no_run
16773 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16774 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16775 /// let x = ClusterOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
16776 /// let x = ClusterOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
16777 /// ```
16778 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
16779 where
16780 T: std::convert::Into<crate::model::ClusterOperationStatus>,
16781 {
16782 self.status = v.map(|x| x.into());
16783 self
16784 }
16785
16786 /// Sets the value of [status_history][crate::model::ClusterOperationMetadata::status_history].
16787 ///
16788 /// # Example
16789 /// ```ignore,no_run
16790 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16791 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16792 /// let x = ClusterOperationMetadata::new()
16793 /// .set_status_history([
16794 /// ClusterOperationStatus::default()/* use setters */,
16795 /// ClusterOperationStatus::default()/* use (different) setters */,
16796 /// ]);
16797 /// ```
16798 pub fn set_status_history<T, V>(mut self, v: T) -> Self
16799 where
16800 T: std::iter::IntoIterator<Item = V>,
16801 V: std::convert::Into<crate::model::ClusterOperationStatus>,
16802 {
16803 use std::iter::Iterator;
16804 self.status_history = v.into_iter().map(|i| i.into()).collect();
16805 self
16806 }
16807
16808 /// Sets the value of [operation_type][crate::model::ClusterOperationMetadata::operation_type].
16809 ///
16810 /// # Example
16811 /// ```ignore,no_run
16812 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16813 /// let x = ClusterOperationMetadata::new().set_operation_type("example");
16814 /// ```
16815 pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16816 self.operation_type = v.into();
16817 self
16818 }
16819
16820 /// Sets the value of [description][crate::model::ClusterOperationMetadata::description].
16821 ///
16822 /// # Example
16823 /// ```ignore,no_run
16824 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16825 /// let x = ClusterOperationMetadata::new().set_description("example");
16826 /// ```
16827 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16828 self.description = v.into();
16829 self
16830 }
16831
16832 /// Sets the value of [labels][crate::model::ClusterOperationMetadata::labels].
16833 ///
16834 /// # Example
16835 /// ```ignore,no_run
16836 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16837 /// let x = ClusterOperationMetadata::new().set_labels([
16838 /// ("key0", "abc"),
16839 /// ("key1", "xyz"),
16840 /// ]);
16841 /// ```
16842 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16843 where
16844 T: std::iter::IntoIterator<Item = (K, V)>,
16845 K: std::convert::Into<std::string::String>,
16846 V: std::convert::Into<std::string::String>,
16847 {
16848 use std::iter::Iterator;
16849 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16850 self
16851 }
16852
16853 /// Sets the value of [warnings][crate::model::ClusterOperationMetadata::warnings].
16854 ///
16855 /// # Example
16856 /// ```ignore,no_run
16857 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16858 /// let x = ClusterOperationMetadata::new().set_warnings(["a", "b", "c"]);
16859 /// ```
16860 pub fn set_warnings<T, V>(mut self, v: T) -> Self
16861 where
16862 T: std::iter::IntoIterator<Item = V>,
16863 V: std::convert::Into<std::string::String>,
16864 {
16865 use std::iter::Iterator;
16866 self.warnings = v.into_iter().map(|i| i.into()).collect();
16867 self
16868 }
16869
16870 /// Sets the value of [child_operation_ids][crate::model::ClusterOperationMetadata::child_operation_ids].
16871 ///
16872 /// # Example
16873 /// ```ignore,no_run
16874 /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
16875 /// let x = ClusterOperationMetadata::new().set_child_operation_ids(["a", "b", "c"]);
16876 /// ```
16877 pub fn set_child_operation_ids<T, V>(mut self, v: T) -> Self
16878 where
16879 T: std::iter::IntoIterator<Item = V>,
16880 V: std::convert::Into<std::string::String>,
16881 {
16882 use std::iter::Iterator;
16883 self.child_operation_ids = v.into_iter().map(|i| i.into()).collect();
16884 self
16885 }
16886}
16887
16888impl wkt::message::Message for ClusterOperationMetadata {
16889 fn typename() -> &'static str {
16890 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationMetadata"
16891 }
16892}
16893
16894/// Metadata describing the node group operation.
16895#[derive(Clone, Default, PartialEq)]
16896#[non_exhaustive]
16897pub struct NodeGroupOperationMetadata {
16898 /// Output only. Node group ID for the operation.
16899 pub node_group_id: std::string::String,
16900
16901 /// Output only. Cluster UUID associated with the node group operation.
16902 pub cluster_uuid: std::string::String,
16903
16904 /// Output only. Current operation status.
16905 pub status: std::option::Option<crate::model::ClusterOperationStatus>,
16906
16907 /// Output only. The previous operation status.
16908 pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
16909
16910 /// The operation type.
16911 pub operation_type: crate::model::node_group_operation_metadata::NodeGroupOperationType,
16912
16913 /// Output only. Short description of operation.
16914 pub description: std::string::String,
16915
16916 /// Output only. Labels associated with the operation.
16917 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16918
16919 /// Output only. Errors encountered during operation execution.
16920 pub warnings: std::vec::Vec<std::string::String>,
16921
16922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16923}
16924
16925impl NodeGroupOperationMetadata {
16926 pub fn new() -> Self {
16927 std::default::Default::default()
16928 }
16929
16930 /// Sets the value of [node_group_id][crate::model::NodeGroupOperationMetadata::node_group_id].
16931 ///
16932 /// # Example
16933 /// ```ignore,no_run
16934 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16935 /// let x = NodeGroupOperationMetadata::new().set_node_group_id("example");
16936 /// ```
16937 pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16938 self.node_group_id = v.into();
16939 self
16940 }
16941
16942 /// Sets the value of [cluster_uuid][crate::model::NodeGroupOperationMetadata::cluster_uuid].
16943 ///
16944 /// # Example
16945 /// ```ignore,no_run
16946 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16947 /// let x = NodeGroupOperationMetadata::new().set_cluster_uuid("example");
16948 /// ```
16949 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16950 self.cluster_uuid = v.into();
16951 self
16952 }
16953
16954 /// Sets the value of [status][crate::model::NodeGroupOperationMetadata::status].
16955 ///
16956 /// # Example
16957 /// ```ignore,no_run
16958 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16959 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16960 /// let x = NodeGroupOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
16961 /// ```
16962 pub fn set_status<T>(mut self, v: T) -> Self
16963 where
16964 T: std::convert::Into<crate::model::ClusterOperationStatus>,
16965 {
16966 self.status = std::option::Option::Some(v.into());
16967 self
16968 }
16969
16970 /// Sets or clears the value of [status][crate::model::NodeGroupOperationMetadata::status].
16971 ///
16972 /// # Example
16973 /// ```ignore,no_run
16974 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16975 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16976 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
16977 /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
16978 /// ```
16979 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
16980 where
16981 T: std::convert::Into<crate::model::ClusterOperationStatus>,
16982 {
16983 self.status = v.map(|x| x.into());
16984 self
16985 }
16986
16987 /// Sets the value of [status_history][crate::model::NodeGroupOperationMetadata::status_history].
16988 ///
16989 /// # Example
16990 /// ```ignore,no_run
16991 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
16992 /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16993 /// let x = NodeGroupOperationMetadata::new()
16994 /// .set_status_history([
16995 /// ClusterOperationStatus::default()/* use setters */,
16996 /// ClusterOperationStatus::default()/* use (different) setters */,
16997 /// ]);
16998 /// ```
16999 pub fn set_status_history<T, V>(mut self, v: T) -> Self
17000 where
17001 T: std::iter::IntoIterator<Item = V>,
17002 V: std::convert::Into<crate::model::ClusterOperationStatus>,
17003 {
17004 use std::iter::Iterator;
17005 self.status_history = v.into_iter().map(|i| i.into()).collect();
17006 self
17007 }
17008
17009 /// Sets the value of [operation_type][crate::model::NodeGroupOperationMetadata::operation_type].
17010 ///
17011 /// # Example
17012 /// ```ignore,no_run
17013 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17014 /// use google_cloud_dataproc_v1::model::node_group_operation_metadata::NodeGroupOperationType;
17015 /// let x0 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Create);
17016 /// let x1 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Update);
17017 /// let x2 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Delete);
17018 /// ```
17019 pub fn set_operation_type<
17020 T: std::convert::Into<crate::model::node_group_operation_metadata::NodeGroupOperationType>,
17021 >(
17022 mut self,
17023 v: T,
17024 ) -> Self {
17025 self.operation_type = v.into();
17026 self
17027 }
17028
17029 /// Sets the value of [description][crate::model::NodeGroupOperationMetadata::description].
17030 ///
17031 /// # Example
17032 /// ```ignore,no_run
17033 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17034 /// let x = NodeGroupOperationMetadata::new().set_description("example");
17035 /// ```
17036 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17037 self.description = v.into();
17038 self
17039 }
17040
17041 /// Sets the value of [labels][crate::model::NodeGroupOperationMetadata::labels].
17042 ///
17043 /// # Example
17044 /// ```ignore,no_run
17045 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17046 /// let x = NodeGroupOperationMetadata::new().set_labels([
17047 /// ("key0", "abc"),
17048 /// ("key1", "xyz"),
17049 /// ]);
17050 /// ```
17051 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17052 where
17053 T: std::iter::IntoIterator<Item = (K, V)>,
17054 K: std::convert::Into<std::string::String>,
17055 V: std::convert::Into<std::string::String>,
17056 {
17057 use std::iter::Iterator;
17058 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17059 self
17060 }
17061
17062 /// Sets the value of [warnings][crate::model::NodeGroupOperationMetadata::warnings].
17063 ///
17064 /// # Example
17065 /// ```ignore,no_run
17066 /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17067 /// let x = NodeGroupOperationMetadata::new().set_warnings(["a", "b", "c"]);
17068 /// ```
17069 pub fn set_warnings<T, V>(mut self, v: T) -> Self
17070 where
17071 T: std::iter::IntoIterator<Item = V>,
17072 V: std::convert::Into<std::string::String>,
17073 {
17074 use std::iter::Iterator;
17075 self.warnings = v.into_iter().map(|i| i.into()).collect();
17076 self
17077 }
17078}
17079
17080impl wkt::message::Message for NodeGroupOperationMetadata {
17081 fn typename() -> &'static str {
17082 "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupOperationMetadata"
17083 }
17084}
17085
17086/// Defines additional types related to [NodeGroupOperationMetadata].
17087pub mod node_group_operation_metadata {
17088 #[allow(unused_imports)]
17089 use super::*;
17090
17091 /// Operation type for node group resources.
17092 ///
17093 /// # Working with unknown values
17094 ///
17095 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17096 /// additional enum variants at any time. Adding new variants is not considered
17097 /// a breaking change. Applications should write their code in anticipation of:
17098 ///
17099 /// - New values appearing in future releases of the client library, **and**
17100 /// - New values received dynamically, without application changes.
17101 ///
17102 /// Please consult the [Working with enums] section in the user guide for some
17103 /// guidelines.
17104 ///
17105 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17106 #[derive(Clone, Debug, PartialEq)]
17107 #[non_exhaustive]
17108 pub enum NodeGroupOperationType {
17109 /// Node group operation type is unknown.
17110 Unspecified,
17111 /// Create node group operation type.
17112 Create,
17113 /// Update node group operation type.
17114 Update,
17115 /// Delete node group operation type.
17116 Delete,
17117 /// Resize node group operation type.
17118 Resize,
17119 /// If set, the enum was initialized with an unknown value.
17120 ///
17121 /// Applications can examine the value using [NodeGroupOperationType::value] or
17122 /// [NodeGroupOperationType::name].
17123 UnknownValue(node_group_operation_type::UnknownValue),
17124 }
17125
17126 #[doc(hidden)]
17127 pub mod node_group_operation_type {
17128 #[allow(unused_imports)]
17129 use super::*;
17130 #[derive(Clone, Debug, PartialEq)]
17131 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17132 }
17133
17134 impl NodeGroupOperationType {
17135 /// Gets the enum value.
17136 ///
17137 /// Returns `None` if the enum contains an unknown value deserialized from
17138 /// the string representation of enums.
17139 pub fn value(&self) -> std::option::Option<i32> {
17140 match self {
17141 Self::Unspecified => std::option::Option::Some(0),
17142 Self::Create => std::option::Option::Some(1),
17143 Self::Update => std::option::Option::Some(2),
17144 Self::Delete => std::option::Option::Some(3),
17145 Self::Resize => std::option::Option::Some(4),
17146 Self::UnknownValue(u) => u.0.value(),
17147 }
17148 }
17149
17150 /// Gets the enum value as a string.
17151 ///
17152 /// Returns `None` if the enum contains an unknown value deserialized from
17153 /// the integer representation of enums.
17154 pub fn name(&self) -> std::option::Option<&str> {
17155 match self {
17156 Self::Unspecified => {
17157 std::option::Option::Some("NODE_GROUP_OPERATION_TYPE_UNSPECIFIED")
17158 }
17159 Self::Create => std::option::Option::Some("CREATE"),
17160 Self::Update => std::option::Option::Some("UPDATE"),
17161 Self::Delete => std::option::Option::Some("DELETE"),
17162 Self::Resize => std::option::Option::Some("RESIZE"),
17163 Self::UnknownValue(u) => u.0.name(),
17164 }
17165 }
17166 }
17167
17168 impl std::default::Default for NodeGroupOperationType {
17169 fn default() -> Self {
17170 use std::convert::From;
17171 Self::from(0)
17172 }
17173 }
17174
17175 impl std::fmt::Display for NodeGroupOperationType {
17176 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17177 wkt::internal::display_enum(f, self.name(), self.value())
17178 }
17179 }
17180
17181 impl std::convert::From<i32> for NodeGroupOperationType {
17182 fn from(value: i32) -> Self {
17183 match value {
17184 0 => Self::Unspecified,
17185 1 => Self::Create,
17186 2 => Self::Update,
17187 3 => Self::Delete,
17188 4 => Self::Resize,
17189 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17190 wkt::internal::UnknownEnumValue::Integer(value),
17191 )),
17192 }
17193 }
17194 }
17195
17196 impl std::convert::From<&str> for NodeGroupOperationType {
17197 fn from(value: &str) -> Self {
17198 use std::string::ToString;
17199 match value {
17200 "NODE_GROUP_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17201 "CREATE" => Self::Create,
17202 "UPDATE" => Self::Update,
17203 "DELETE" => Self::Delete,
17204 "RESIZE" => Self::Resize,
17205 _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17206 wkt::internal::UnknownEnumValue::String(value.to_string()),
17207 )),
17208 }
17209 }
17210 }
17211
17212 impl serde::ser::Serialize for NodeGroupOperationType {
17213 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17214 where
17215 S: serde::Serializer,
17216 {
17217 match self {
17218 Self::Unspecified => serializer.serialize_i32(0),
17219 Self::Create => serializer.serialize_i32(1),
17220 Self::Update => serializer.serialize_i32(2),
17221 Self::Delete => serializer.serialize_i32(3),
17222 Self::Resize => serializer.serialize_i32(4),
17223 Self::UnknownValue(u) => u.0.serialize(serializer),
17224 }
17225 }
17226 }
17227
17228 impl<'de> serde::de::Deserialize<'de> for NodeGroupOperationType {
17229 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17230 where
17231 D: serde::Deserializer<'de>,
17232 {
17233 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeGroupOperationType>::new(
17234 ".google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType",
17235 ))
17236 }
17237 }
17238}
17239
17240/// A request to create a session template.
17241#[derive(Clone, Default, PartialEq)]
17242#[non_exhaustive]
17243pub struct CreateSessionTemplateRequest {
17244 /// Required. The parent resource where this session template will be created.
17245 pub parent: std::string::String,
17246
17247 /// Required. The session template to create.
17248 pub session_template: std::option::Option<crate::model::SessionTemplate>,
17249
17250 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17251}
17252
17253impl CreateSessionTemplateRequest {
17254 pub fn new() -> Self {
17255 std::default::Default::default()
17256 }
17257
17258 /// Sets the value of [parent][crate::model::CreateSessionTemplateRequest::parent].
17259 ///
17260 /// # Example
17261 /// ```ignore,no_run
17262 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17263 /// let x = CreateSessionTemplateRequest::new().set_parent("example");
17264 /// ```
17265 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17266 self.parent = v.into();
17267 self
17268 }
17269
17270 /// Sets the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
17271 ///
17272 /// # Example
17273 /// ```ignore,no_run
17274 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17275 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17276 /// let x = CreateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
17277 /// ```
17278 pub fn set_session_template<T>(mut self, v: T) -> Self
17279 where
17280 T: std::convert::Into<crate::model::SessionTemplate>,
17281 {
17282 self.session_template = std::option::Option::Some(v.into());
17283 self
17284 }
17285
17286 /// Sets or clears the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
17287 ///
17288 /// # Example
17289 /// ```ignore,no_run
17290 /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17291 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17292 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
17293 /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
17294 /// ```
17295 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
17296 where
17297 T: std::convert::Into<crate::model::SessionTemplate>,
17298 {
17299 self.session_template = v.map(|x| x.into());
17300 self
17301 }
17302}
17303
17304impl wkt::message::Message for CreateSessionTemplateRequest {
17305 fn typename() -> &'static str {
17306 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionTemplateRequest"
17307 }
17308}
17309
17310/// A request to update a session template.
17311#[derive(Clone, Default, PartialEq)]
17312#[non_exhaustive]
17313pub struct UpdateSessionTemplateRequest {
17314 /// Required. The updated session template.
17315 pub session_template: std::option::Option<crate::model::SessionTemplate>,
17316
17317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17318}
17319
17320impl UpdateSessionTemplateRequest {
17321 pub fn new() -> Self {
17322 std::default::Default::default()
17323 }
17324
17325 /// Sets the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
17326 ///
17327 /// # Example
17328 /// ```ignore,no_run
17329 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
17330 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17331 /// let x = UpdateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
17332 /// ```
17333 pub fn set_session_template<T>(mut self, v: T) -> Self
17334 where
17335 T: std::convert::Into<crate::model::SessionTemplate>,
17336 {
17337 self.session_template = std::option::Option::Some(v.into());
17338 self
17339 }
17340
17341 /// Sets or clears the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
17342 ///
17343 /// # Example
17344 /// ```ignore,no_run
17345 /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
17346 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17347 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
17348 /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
17349 /// ```
17350 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
17351 where
17352 T: std::convert::Into<crate::model::SessionTemplate>,
17353 {
17354 self.session_template = v.map(|x| x.into());
17355 self
17356 }
17357}
17358
17359impl wkt::message::Message for UpdateSessionTemplateRequest {
17360 fn typename() -> &'static str {
17361 "type.googleapis.com/google.cloud.dataproc.v1.UpdateSessionTemplateRequest"
17362 }
17363}
17364
17365/// A request to get the resource representation for a session template.
17366#[derive(Clone, Default, PartialEq)]
17367#[non_exhaustive]
17368pub struct GetSessionTemplateRequest {
17369 /// Required. The name of the session template to retrieve.
17370 pub name: std::string::String,
17371
17372 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17373}
17374
17375impl GetSessionTemplateRequest {
17376 pub fn new() -> Self {
17377 std::default::Default::default()
17378 }
17379
17380 /// Sets the value of [name][crate::model::GetSessionTemplateRequest::name].
17381 ///
17382 /// # Example
17383 /// ```ignore,no_run
17384 /// # use google_cloud_dataproc_v1::model::GetSessionTemplateRequest;
17385 /// let x = GetSessionTemplateRequest::new().set_name("example");
17386 /// ```
17387 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17388 self.name = v.into();
17389 self
17390 }
17391}
17392
17393impl wkt::message::Message for GetSessionTemplateRequest {
17394 fn typename() -> &'static str {
17395 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionTemplateRequest"
17396 }
17397}
17398
17399/// A request to list session templates in a project.
17400#[derive(Clone, Default, PartialEq)]
17401#[non_exhaustive]
17402pub struct ListSessionTemplatesRequest {
17403 /// Required. The parent that owns this collection of session templates.
17404 pub parent: std::string::String,
17405
17406 /// Optional. The maximum number of sessions to return in each response.
17407 /// The service may return fewer than this value.
17408 pub page_size: i32,
17409
17410 /// Optional. A page token received from a previous `ListSessions` call.
17411 /// Provide this token to retrieve the subsequent page.
17412 pub page_token: std::string::String,
17413
17414 /// Optional. A filter for the session templates to return in the response.
17415 /// Filters are case sensitive and have the following syntax:
17416 ///
17417 /// [field = value] AND [field [= value]] ...
17418 pub filter: std::string::String,
17419
17420 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17421}
17422
17423impl ListSessionTemplatesRequest {
17424 pub fn new() -> Self {
17425 std::default::Default::default()
17426 }
17427
17428 /// Sets the value of [parent][crate::model::ListSessionTemplatesRequest::parent].
17429 ///
17430 /// # Example
17431 /// ```ignore,no_run
17432 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17433 /// let x = ListSessionTemplatesRequest::new().set_parent("example");
17434 /// ```
17435 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17436 self.parent = v.into();
17437 self
17438 }
17439
17440 /// Sets the value of [page_size][crate::model::ListSessionTemplatesRequest::page_size].
17441 ///
17442 /// # Example
17443 /// ```ignore,no_run
17444 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17445 /// let x = ListSessionTemplatesRequest::new().set_page_size(42);
17446 /// ```
17447 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17448 self.page_size = v.into();
17449 self
17450 }
17451
17452 /// Sets the value of [page_token][crate::model::ListSessionTemplatesRequest::page_token].
17453 ///
17454 /// # Example
17455 /// ```ignore,no_run
17456 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17457 /// let x = ListSessionTemplatesRequest::new().set_page_token("example");
17458 /// ```
17459 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17460 self.page_token = v.into();
17461 self
17462 }
17463
17464 /// Sets the value of [filter][crate::model::ListSessionTemplatesRequest::filter].
17465 ///
17466 /// # Example
17467 /// ```ignore,no_run
17468 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17469 /// let x = ListSessionTemplatesRequest::new().set_filter("example");
17470 /// ```
17471 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17472 self.filter = v.into();
17473 self
17474 }
17475}
17476
17477impl wkt::message::Message for ListSessionTemplatesRequest {
17478 fn typename() -> &'static str {
17479 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesRequest"
17480 }
17481}
17482
17483/// A list of session templates.
17484#[derive(Clone, Default, PartialEq)]
17485#[non_exhaustive]
17486pub struct ListSessionTemplatesResponse {
17487 /// Output only. Session template list
17488 pub session_templates: std::vec::Vec<crate::model::SessionTemplate>,
17489
17490 /// A token, which can be sent as `page_token` to retrieve the next page.
17491 /// If this field is omitted, there are no subsequent pages.
17492 pub next_page_token: std::string::String,
17493
17494 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17495}
17496
17497impl ListSessionTemplatesResponse {
17498 pub fn new() -> Self {
17499 std::default::Default::default()
17500 }
17501
17502 /// Sets the value of [session_templates][crate::model::ListSessionTemplatesResponse::session_templates].
17503 ///
17504 /// # Example
17505 /// ```ignore,no_run
17506 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
17507 /// use google_cloud_dataproc_v1::model::SessionTemplate;
17508 /// let x = ListSessionTemplatesResponse::new()
17509 /// .set_session_templates([
17510 /// SessionTemplate::default()/* use setters */,
17511 /// SessionTemplate::default()/* use (different) setters */,
17512 /// ]);
17513 /// ```
17514 pub fn set_session_templates<T, V>(mut self, v: T) -> Self
17515 where
17516 T: std::iter::IntoIterator<Item = V>,
17517 V: std::convert::Into<crate::model::SessionTemplate>,
17518 {
17519 use std::iter::Iterator;
17520 self.session_templates = v.into_iter().map(|i| i.into()).collect();
17521 self
17522 }
17523
17524 /// Sets the value of [next_page_token][crate::model::ListSessionTemplatesResponse::next_page_token].
17525 ///
17526 /// # Example
17527 /// ```ignore,no_run
17528 /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
17529 /// let x = ListSessionTemplatesResponse::new().set_next_page_token("example");
17530 /// ```
17531 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17532 self.next_page_token = v.into();
17533 self
17534 }
17535}
17536
17537impl wkt::message::Message for ListSessionTemplatesResponse {
17538 fn typename() -> &'static str {
17539 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesResponse"
17540 }
17541}
17542
17543#[doc(hidden)]
17544impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionTemplatesResponse {
17545 type PageItem = crate::model::SessionTemplate;
17546
17547 fn items(self) -> std::vec::Vec<Self::PageItem> {
17548 self.session_templates
17549 }
17550
17551 fn next_page_token(&self) -> std::string::String {
17552 use std::clone::Clone;
17553 self.next_page_token.clone()
17554 }
17555}
17556
17557/// A request to delete a session template.
17558#[derive(Clone, Default, PartialEq)]
17559#[non_exhaustive]
17560pub struct DeleteSessionTemplateRequest {
17561 /// Required. The name of the session template resource to delete.
17562 pub name: std::string::String,
17563
17564 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17565}
17566
17567impl DeleteSessionTemplateRequest {
17568 pub fn new() -> Self {
17569 std::default::Default::default()
17570 }
17571
17572 /// Sets the value of [name][crate::model::DeleteSessionTemplateRequest::name].
17573 ///
17574 /// # Example
17575 /// ```ignore,no_run
17576 /// # use google_cloud_dataproc_v1::model::DeleteSessionTemplateRequest;
17577 /// let x = DeleteSessionTemplateRequest::new().set_name("example");
17578 /// ```
17579 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17580 self.name = v.into();
17581 self
17582 }
17583}
17584
17585impl wkt::message::Message for DeleteSessionTemplateRequest {
17586 fn typename() -> &'static str {
17587 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionTemplateRequest"
17588 }
17589}
17590
17591/// A representation of a session template.
17592#[derive(Clone, Default, PartialEq)]
17593#[non_exhaustive]
17594pub struct SessionTemplate {
17595 /// Required. The resource name of the session template.
17596 pub name: std::string::String,
17597
17598 /// Optional. Brief description of the template.
17599 pub description: std::string::String,
17600
17601 /// Output only. The time when the template was created.
17602 pub create_time: std::option::Option<wkt::Timestamp>,
17603
17604 /// Output only. The email address of the user who created the template.
17605 pub creator: std::string::String,
17606
17607 /// Optional. Labels to associate with sessions created using this template.
17608 /// Label **keys** must contain 1 to 63 characters, and must conform to
17609 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
17610 /// Label **values** can be empty, but, if present, must contain 1 to 63
17611 /// characters and conform to [RFC
17612 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
17613 /// associated with a session.
17614 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17615
17616 /// Optional. Runtime configuration for session execution.
17617 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
17618
17619 /// Optional. Environment configuration for session execution.
17620 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
17621
17622 /// Output only. The time the template was last updated.
17623 pub update_time: std::option::Option<wkt::Timestamp>,
17624
17625 /// Output only. A session template UUID (Unique Universal Identifier). The
17626 /// service generates this value when it creates the session template.
17627 pub uuid: std::string::String,
17628
17629 /// The session configuration.
17630 pub session_config: std::option::Option<crate::model::session_template::SessionConfig>,
17631
17632 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17633}
17634
17635impl SessionTemplate {
17636 pub fn new() -> Self {
17637 std::default::Default::default()
17638 }
17639
17640 /// Sets the value of [name][crate::model::SessionTemplate::name].
17641 ///
17642 /// # Example
17643 /// ```ignore,no_run
17644 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17645 /// let x = SessionTemplate::new().set_name("example");
17646 /// ```
17647 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17648 self.name = v.into();
17649 self
17650 }
17651
17652 /// Sets the value of [description][crate::model::SessionTemplate::description].
17653 ///
17654 /// # Example
17655 /// ```ignore,no_run
17656 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17657 /// let x = SessionTemplate::new().set_description("example");
17658 /// ```
17659 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17660 self.description = v.into();
17661 self
17662 }
17663
17664 /// Sets the value of [create_time][crate::model::SessionTemplate::create_time].
17665 ///
17666 /// # Example
17667 /// ```ignore,no_run
17668 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17669 /// use wkt::Timestamp;
17670 /// let x = SessionTemplate::new().set_create_time(Timestamp::default()/* use setters */);
17671 /// ```
17672 pub fn set_create_time<T>(mut self, v: T) -> Self
17673 where
17674 T: std::convert::Into<wkt::Timestamp>,
17675 {
17676 self.create_time = std::option::Option::Some(v.into());
17677 self
17678 }
17679
17680 /// Sets or clears the value of [create_time][crate::model::SessionTemplate::create_time].
17681 ///
17682 /// # Example
17683 /// ```ignore,no_run
17684 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17685 /// use wkt::Timestamp;
17686 /// let x = SessionTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17687 /// let x = SessionTemplate::new().set_or_clear_create_time(None::<Timestamp>);
17688 /// ```
17689 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17690 where
17691 T: std::convert::Into<wkt::Timestamp>,
17692 {
17693 self.create_time = v.map(|x| x.into());
17694 self
17695 }
17696
17697 /// Sets the value of [creator][crate::model::SessionTemplate::creator].
17698 ///
17699 /// # Example
17700 /// ```ignore,no_run
17701 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17702 /// let x = SessionTemplate::new().set_creator("example");
17703 /// ```
17704 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17705 self.creator = v.into();
17706 self
17707 }
17708
17709 /// Sets the value of [labels][crate::model::SessionTemplate::labels].
17710 ///
17711 /// # Example
17712 /// ```ignore,no_run
17713 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17714 /// let x = SessionTemplate::new().set_labels([
17715 /// ("key0", "abc"),
17716 /// ("key1", "xyz"),
17717 /// ]);
17718 /// ```
17719 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17720 where
17721 T: std::iter::IntoIterator<Item = (K, V)>,
17722 K: std::convert::Into<std::string::String>,
17723 V: std::convert::Into<std::string::String>,
17724 {
17725 use std::iter::Iterator;
17726 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17727 self
17728 }
17729
17730 /// Sets the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
17731 ///
17732 /// # Example
17733 /// ```ignore,no_run
17734 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17735 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
17736 /// let x = SessionTemplate::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
17737 /// ```
17738 pub fn set_runtime_config<T>(mut self, v: T) -> Self
17739 where
17740 T: std::convert::Into<crate::model::RuntimeConfig>,
17741 {
17742 self.runtime_config = std::option::Option::Some(v.into());
17743 self
17744 }
17745
17746 /// Sets or clears the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
17747 ///
17748 /// # Example
17749 /// ```ignore,no_run
17750 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17751 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
17752 /// let x = SessionTemplate::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
17753 /// let x = SessionTemplate::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
17754 /// ```
17755 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
17756 where
17757 T: std::convert::Into<crate::model::RuntimeConfig>,
17758 {
17759 self.runtime_config = v.map(|x| x.into());
17760 self
17761 }
17762
17763 /// Sets the value of [environment_config][crate::model::SessionTemplate::environment_config].
17764 ///
17765 /// # Example
17766 /// ```ignore,no_run
17767 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17768 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
17769 /// let x = SessionTemplate::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
17770 /// ```
17771 pub fn set_environment_config<T>(mut self, v: T) -> Self
17772 where
17773 T: std::convert::Into<crate::model::EnvironmentConfig>,
17774 {
17775 self.environment_config = std::option::Option::Some(v.into());
17776 self
17777 }
17778
17779 /// Sets or clears the value of [environment_config][crate::model::SessionTemplate::environment_config].
17780 ///
17781 /// # Example
17782 /// ```ignore,no_run
17783 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17784 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
17785 /// let x = SessionTemplate::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
17786 /// let x = SessionTemplate::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
17787 /// ```
17788 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
17789 where
17790 T: std::convert::Into<crate::model::EnvironmentConfig>,
17791 {
17792 self.environment_config = v.map(|x| x.into());
17793 self
17794 }
17795
17796 /// Sets the value of [update_time][crate::model::SessionTemplate::update_time].
17797 ///
17798 /// # Example
17799 /// ```ignore,no_run
17800 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17801 /// use wkt::Timestamp;
17802 /// let x = SessionTemplate::new().set_update_time(Timestamp::default()/* use setters */);
17803 /// ```
17804 pub fn set_update_time<T>(mut self, v: T) -> Self
17805 where
17806 T: std::convert::Into<wkt::Timestamp>,
17807 {
17808 self.update_time = std::option::Option::Some(v.into());
17809 self
17810 }
17811
17812 /// Sets or clears the value of [update_time][crate::model::SessionTemplate::update_time].
17813 ///
17814 /// # Example
17815 /// ```ignore,no_run
17816 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17817 /// use wkt::Timestamp;
17818 /// let x = SessionTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
17819 /// let x = SessionTemplate::new().set_or_clear_update_time(None::<Timestamp>);
17820 /// ```
17821 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17822 where
17823 T: std::convert::Into<wkt::Timestamp>,
17824 {
17825 self.update_time = v.map(|x| x.into());
17826 self
17827 }
17828
17829 /// Sets the value of [uuid][crate::model::SessionTemplate::uuid].
17830 ///
17831 /// # Example
17832 /// ```ignore,no_run
17833 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17834 /// let x = SessionTemplate::new().set_uuid("example");
17835 /// ```
17836 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17837 self.uuid = v.into();
17838 self
17839 }
17840
17841 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config].
17842 ///
17843 /// Note that all the setters affecting `session_config` are mutually
17844 /// exclusive.
17845 ///
17846 /// # Example
17847 /// ```ignore,no_run
17848 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17849 /// use google_cloud_dataproc_v1::model::JupyterConfig;
17850 /// let x = SessionTemplate::new().set_session_config(Some(
17851 /// google_cloud_dataproc_v1::model::session_template::SessionConfig::JupyterSession(JupyterConfig::default().into())));
17852 /// ```
17853 pub fn set_session_config<
17854 T: std::convert::Into<std::option::Option<crate::model::session_template::SessionConfig>>,
17855 >(
17856 mut self,
17857 v: T,
17858 ) -> Self {
17859 self.session_config = v.into();
17860 self
17861 }
17862
17863 /// The value of [session_config][crate::model::SessionTemplate::session_config]
17864 /// if it holds a `JupyterSession`, `None` if the field is not set or
17865 /// holds a different branch.
17866 pub fn jupyter_session(
17867 &self,
17868 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
17869 #[allow(unreachable_patterns)]
17870 self.session_config.as_ref().and_then(|v| match v {
17871 crate::model::session_template::SessionConfig::JupyterSession(v) => {
17872 std::option::Option::Some(v)
17873 }
17874 _ => std::option::Option::None,
17875 })
17876 }
17877
17878 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
17879 /// to hold a `JupyterSession`.
17880 ///
17881 /// Note that all the setters affecting `session_config` are
17882 /// mutually exclusive.
17883 ///
17884 /// # Example
17885 /// ```ignore,no_run
17886 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17887 /// use google_cloud_dataproc_v1::model::JupyterConfig;
17888 /// let x = SessionTemplate::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
17889 /// assert!(x.jupyter_session().is_some());
17890 /// assert!(x.spark_connect_session().is_none());
17891 /// ```
17892 pub fn set_jupyter_session<
17893 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
17894 >(
17895 mut self,
17896 v: T,
17897 ) -> Self {
17898 self.session_config = std::option::Option::Some(
17899 crate::model::session_template::SessionConfig::JupyterSession(v.into()),
17900 );
17901 self
17902 }
17903
17904 /// The value of [session_config][crate::model::SessionTemplate::session_config]
17905 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
17906 /// holds a different branch.
17907 pub fn spark_connect_session(
17908 &self,
17909 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
17910 #[allow(unreachable_patterns)]
17911 self.session_config.as_ref().and_then(|v| match v {
17912 crate::model::session_template::SessionConfig::SparkConnectSession(v) => {
17913 std::option::Option::Some(v)
17914 }
17915 _ => std::option::Option::None,
17916 })
17917 }
17918
17919 /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
17920 /// to hold a `SparkConnectSession`.
17921 ///
17922 /// Note that all the setters affecting `session_config` are
17923 /// mutually exclusive.
17924 ///
17925 /// # Example
17926 /// ```ignore,no_run
17927 /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17928 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
17929 /// let x = SessionTemplate::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
17930 /// assert!(x.spark_connect_session().is_some());
17931 /// assert!(x.jupyter_session().is_none());
17932 /// ```
17933 pub fn set_spark_connect_session<
17934 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
17935 >(
17936 mut self,
17937 v: T,
17938 ) -> Self {
17939 self.session_config = std::option::Option::Some(
17940 crate::model::session_template::SessionConfig::SparkConnectSession(v.into()),
17941 );
17942 self
17943 }
17944}
17945
17946impl wkt::message::Message for SessionTemplate {
17947 fn typename() -> &'static str {
17948 "type.googleapis.com/google.cloud.dataproc.v1.SessionTemplate"
17949 }
17950}
17951
17952/// Defines additional types related to [SessionTemplate].
17953pub mod session_template {
17954 #[allow(unused_imports)]
17955 use super::*;
17956
17957 /// The session configuration.
17958 #[derive(Clone, Debug, PartialEq)]
17959 #[non_exhaustive]
17960 pub enum SessionConfig {
17961 /// Optional. Jupyter session config.
17962 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
17963 /// Optional. Spark Connect session config.
17964 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
17965 }
17966}
17967
17968/// A request to create a session.
17969#[derive(Clone, Default, PartialEq)]
17970#[non_exhaustive]
17971pub struct CreateSessionRequest {
17972 /// Required. The parent resource where this session will be created.
17973 pub parent: std::string::String,
17974
17975 /// Required. The interactive session to create.
17976 pub session: std::option::Option<crate::model::Session>,
17977
17978 /// Required. The ID to use for the session, which becomes the final component
17979 /// of the session's resource name.
17980 ///
17981 /// This value must be 4-63 characters. Valid characters
17982 /// are /[a-z][0-9]-/.
17983 pub session_id: std::string::String,
17984
17985 /// Optional. A unique ID used to identify the request. If the service
17986 /// receives two
17987 /// [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
17988 /// with the same ID, the second request is ignored, and the
17989 /// first [Session][google.cloud.dataproc.v1.Session] is created and stored in
17990 /// the backend.
17991 ///
17992 /// Recommendation: Set this value to a
17993 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
17994 ///
17995 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
17996 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
17997 ///
17998 /// [google.cloud.dataproc.v1.Session]: crate::model::Session
17999 pub request_id: std::string::String,
18000
18001 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18002}
18003
18004impl CreateSessionRequest {
18005 pub fn new() -> Self {
18006 std::default::Default::default()
18007 }
18008
18009 /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
18010 ///
18011 /// # Example
18012 /// ```ignore,no_run
18013 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18014 /// let x = CreateSessionRequest::new().set_parent("example");
18015 /// ```
18016 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18017 self.parent = v.into();
18018 self
18019 }
18020
18021 /// Sets the value of [session][crate::model::CreateSessionRequest::session].
18022 ///
18023 /// # Example
18024 /// ```ignore,no_run
18025 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18026 /// use google_cloud_dataproc_v1::model::Session;
18027 /// let x = CreateSessionRequest::new().set_session(Session::default()/* use setters */);
18028 /// ```
18029 pub fn set_session<T>(mut self, v: T) -> Self
18030 where
18031 T: std::convert::Into<crate::model::Session>,
18032 {
18033 self.session = std::option::Option::Some(v.into());
18034 self
18035 }
18036
18037 /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
18038 ///
18039 /// # Example
18040 /// ```ignore,no_run
18041 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18042 /// use google_cloud_dataproc_v1::model::Session;
18043 /// let x = CreateSessionRequest::new().set_or_clear_session(Some(Session::default()/* use setters */));
18044 /// let x = CreateSessionRequest::new().set_or_clear_session(None::<Session>);
18045 /// ```
18046 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
18047 where
18048 T: std::convert::Into<crate::model::Session>,
18049 {
18050 self.session = v.map(|x| x.into());
18051 self
18052 }
18053
18054 /// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
18055 ///
18056 /// # Example
18057 /// ```ignore,no_run
18058 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18059 /// let x = CreateSessionRequest::new().set_session_id("example");
18060 /// ```
18061 pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18062 self.session_id = v.into();
18063 self
18064 }
18065
18066 /// Sets the value of [request_id][crate::model::CreateSessionRequest::request_id].
18067 ///
18068 /// # Example
18069 /// ```ignore,no_run
18070 /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18071 /// let x = CreateSessionRequest::new().set_request_id("example");
18072 /// ```
18073 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18074 self.request_id = v.into();
18075 self
18076 }
18077}
18078
18079impl wkt::message::Message for CreateSessionRequest {
18080 fn typename() -> &'static str {
18081 "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionRequest"
18082 }
18083}
18084
18085/// A request to get the resource representation for a session.
18086#[derive(Clone, Default, PartialEq)]
18087#[non_exhaustive]
18088pub struct GetSessionRequest {
18089 /// Required. The name of the session to retrieve.
18090 pub name: std::string::String,
18091
18092 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18093}
18094
18095impl GetSessionRequest {
18096 pub fn new() -> Self {
18097 std::default::Default::default()
18098 }
18099
18100 /// Sets the value of [name][crate::model::GetSessionRequest::name].
18101 ///
18102 /// # Example
18103 /// ```ignore,no_run
18104 /// # use google_cloud_dataproc_v1::model::GetSessionRequest;
18105 /// let x = GetSessionRequest::new().set_name("example");
18106 /// ```
18107 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18108 self.name = v.into();
18109 self
18110 }
18111}
18112
18113impl wkt::message::Message for GetSessionRequest {
18114 fn typename() -> &'static str {
18115 "type.googleapis.com/google.cloud.dataproc.v1.GetSessionRequest"
18116 }
18117}
18118
18119/// A request to list sessions in a project.
18120#[derive(Clone, Default, PartialEq)]
18121#[non_exhaustive]
18122pub struct ListSessionsRequest {
18123 /// Required. The parent, which owns this collection of sessions.
18124 pub parent: std::string::String,
18125
18126 /// Optional. The maximum number of sessions to return in each response.
18127 /// The service may return fewer than this value.
18128 pub page_size: i32,
18129
18130 /// Optional. A page token received from a previous `ListSessions` call.
18131 /// Provide this token to retrieve the subsequent page.
18132 pub page_token: std::string::String,
18133
18134 /// Optional. A filter for the sessions to return in the response.
18135 ///
18136 /// A filter is a logical expression constraining the values of various fields
18137 /// in each session resource. Filters are case sensitive, and may contain
18138 /// multiple clauses combined with logical operators (AND, OR).
18139 /// Supported fields are `session_id`, `session_uuid`, `state`, `create_time`,
18140 /// and `labels`.
18141 ///
18142 /// Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
18143 /// is a filter for sessions in an ACTIVE state that were created before
18144 /// 2023-01-01. `state = ACTIVE and labels.environment=production` is a filter
18145 /// for sessions in an ACTIVE state that have a production environment label.
18146 ///
18147 /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
18148 /// description of the filter syntax and a list of supported comparators.
18149 pub filter: std::string::String,
18150
18151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18152}
18153
18154impl ListSessionsRequest {
18155 pub fn new() -> Self {
18156 std::default::Default::default()
18157 }
18158
18159 /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
18160 ///
18161 /// # Example
18162 /// ```ignore,no_run
18163 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18164 /// let x = ListSessionsRequest::new().set_parent("example");
18165 /// ```
18166 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18167 self.parent = v.into();
18168 self
18169 }
18170
18171 /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
18172 ///
18173 /// # Example
18174 /// ```ignore,no_run
18175 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18176 /// let x = ListSessionsRequest::new().set_page_size(42);
18177 /// ```
18178 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18179 self.page_size = v.into();
18180 self
18181 }
18182
18183 /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
18184 ///
18185 /// # Example
18186 /// ```ignore,no_run
18187 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18188 /// let x = ListSessionsRequest::new().set_page_token("example");
18189 /// ```
18190 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18191 self.page_token = v.into();
18192 self
18193 }
18194
18195 /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
18196 ///
18197 /// # Example
18198 /// ```ignore,no_run
18199 /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18200 /// let x = ListSessionsRequest::new().set_filter("example");
18201 /// ```
18202 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18203 self.filter = v.into();
18204 self
18205 }
18206}
18207
18208impl wkt::message::Message for ListSessionsRequest {
18209 fn typename() -> &'static str {
18210 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsRequest"
18211 }
18212}
18213
18214/// A list of interactive sessions.
18215#[derive(Clone, Default, PartialEq)]
18216#[non_exhaustive]
18217pub struct ListSessionsResponse {
18218 /// Output only. The sessions from the specified collection.
18219 pub sessions: std::vec::Vec<crate::model::Session>,
18220
18221 /// A token, which can be sent as `page_token`, to retrieve the next page.
18222 /// If this field is omitted, there are no subsequent pages.
18223 pub next_page_token: std::string::String,
18224
18225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18226}
18227
18228impl ListSessionsResponse {
18229 pub fn new() -> Self {
18230 std::default::Default::default()
18231 }
18232
18233 /// Sets the value of [sessions][crate::model::ListSessionsResponse::sessions].
18234 ///
18235 /// # Example
18236 /// ```ignore,no_run
18237 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18238 /// use google_cloud_dataproc_v1::model::Session;
18239 /// let x = ListSessionsResponse::new()
18240 /// .set_sessions([
18241 /// Session::default()/* use setters */,
18242 /// Session::default()/* use (different) setters */,
18243 /// ]);
18244 /// ```
18245 pub fn set_sessions<T, V>(mut self, v: T) -> Self
18246 where
18247 T: std::iter::IntoIterator<Item = V>,
18248 V: std::convert::Into<crate::model::Session>,
18249 {
18250 use std::iter::Iterator;
18251 self.sessions = v.into_iter().map(|i| i.into()).collect();
18252 self
18253 }
18254
18255 /// Sets the value of [next_page_token][crate::model::ListSessionsResponse::next_page_token].
18256 ///
18257 /// # Example
18258 /// ```ignore,no_run
18259 /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18260 /// let x = ListSessionsResponse::new().set_next_page_token("example");
18261 /// ```
18262 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18263 self.next_page_token = v.into();
18264 self
18265 }
18266}
18267
18268impl wkt::message::Message for ListSessionsResponse {
18269 fn typename() -> &'static str {
18270 "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsResponse"
18271 }
18272}
18273
18274#[doc(hidden)]
18275impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionsResponse {
18276 type PageItem = crate::model::Session;
18277
18278 fn items(self) -> std::vec::Vec<Self::PageItem> {
18279 self.sessions
18280 }
18281
18282 fn next_page_token(&self) -> std::string::String {
18283 use std::clone::Clone;
18284 self.next_page_token.clone()
18285 }
18286}
18287
18288/// A request to terminate an interactive session.
18289#[derive(Clone, Default, PartialEq)]
18290#[non_exhaustive]
18291pub struct TerminateSessionRequest {
18292 /// Required. The name of the session resource to terminate.
18293 pub name: std::string::String,
18294
18295 /// Optional. A unique ID used to identify the request. If the service
18296 /// receives two
18297 /// [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
18298 /// with the same ID, the second request is ignored.
18299 ///
18300 /// Recommendation: Set this value to a
18301 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18302 ///
18303 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18304 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18305 pub request_id: std::string::String,
18306
18307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18308}
18309
18310impl TerminateSessionRequest {
18311 pub fn new() -> Self {
18312 std::default::Default::default()
18313 }
18314
18315 /// Sets the value of [name][crate::model::TerminateSessionRequest::name].
18316 ///
18317 /// # Example
18318 /// ```ignore,no_run
18319 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
18320 /// let x = TerminateSessionRequest::new().set_name("example");
18321 /// ```
18322 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18323 self.name = v.into();
18324 self
18325 }
18326
18327 /// Sets the value of [request_id][crate::model::TerminateSessionRequest::request_id].
18328 ///
18329 /// # Example
18330 /// ```ignore,no_run
18331 /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
18332 /// let x = TerminateSessionRequest::new().set_request_id("example");
18333 /// ```
18334 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18335 self.request_id = v.into();
18336 self
18337 }
18338}
18339
18340impl wkt::message::Message for TerminateSessionRequest {
18341 fn typename() -> &'static str {
18342 "type.googleapis.com/google.cloud.dataproc.v1.TerminateSessionRequest"
18343 }
18344}
18345
18346/// A request to delete a session.
18347#[derive(Clone, Default, PartialEq)]
18348#[non_exhaustive]
18349pub struct DeleteSessionRequest {
18350 /// Required. The name of the session resource to delete.
18351 pub name: std::string::String,
18352
18353 /// Optional. A unique ID used to identify the request. If the service
18354 /// receives two
18355 /// [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
18356 /// with the same ID, the second request is ignored.
18357 ///
18358 /// Recommendation: Set this value to a
18359 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18360 ///
18361 /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18362 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18363 pub request_id: std::string::String,
18364
18365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18366}
18367
18368impl DeleteSessionRequest {
18369 pub fn new() -> Self {
18370 std::default::Default::default()
18371 }
18372
18373 /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
18374 ///
18375 /// # Example
18376 /// ```ignore,no_run
18377 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
18378 /// let x = DeleteSessionRequest::new().set_name("example");
18379 /// ```
18380 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18381 self.name = v.into();
18382 self
18383 }
18384
18385 /// Sets the value of [request_id][crate::model::DeleteSessionRequest::request_id].
18386 ///
18387 /// # Example
18388 /// ```ignore,no_run
18389 /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
18390 /// let x = DeleteSessionRequest::new().set_request_id("example");
18391 /// ```
18392 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18393 self.request_id = v.into();
18394 self
18395 }
18396}
18397
18398impl wkt::message::Message for DeleteSessionRequest {
18399 fn typename() -> &'static str {
18400 "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionRequest"
18401 }
18402}
18403
18404/// A representation of a session.
18405#[derive(Clone, Default, PartialEq)]
18406#[non_exhaustive]
18407pub struct Session {
18408 /// Required. The resource name of the session.
18409 pub name: std::string::String,
18410
18411 /// Output only. A session UUID (Unique Universal Identifier). The service
18412 /// generates this value when it creates the session.
18413 pub uuid: std::string::String,
18414
18415 /// Output only. The time when the session was created.
18416 pub create_time: std::option::Option<wkt::Timestamp>,
18417
18418 /// Output only. Runtime information about session execution.
18419 pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
18420
18421 /// Output only. A state of the session.
18422 pub state: crate::model::session::State,
18423
18424 /// Output only. Session state details, such as the failure
18425 /// description if the state is `FAILED`.
18426 pub state_message: std::string::String,
18427
18428 /// Output only. The time when the session entered the current state.
18429 pub state_time: std::option::Option<wkt::Timestamp>,
18430
18431 /// Output only. The email address of the user who created the session.
18432 pub creator: std::string::String,
18433
18434 /// Optional. The labels to associate with the session.
18435 /// Label **keys** must contain 1 to 63 characters, and must conform to
18436 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
18437 /// Label **values** may be empty, but, if present, must contain 1 to 63
18438 /// characters, and must conform to [RFC
18439 /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
18440 /// associated with a session.
18441 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18442
18443 /// Optional. Runtime configuration for the session execution.
18444 pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
18445
18446 /// Optional. Environment configuration for the session execution.
18447 pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
18448
18449 /// Optional. The email address of the user who owns the session.
18450 pub user: std::string::String,
18451
18452 /// Output only. Historical state information for the session.
18453 pub state_history: std::vec::Vec<crate::model::session::SessionStateHistory>,
18454
18455 /// Optional. The session template used by the session.
18456 ///
18457 /// Only resource names, including project ID and location, are valid.
18458 ///
18459 /// Example:
18460 ///
18461 /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
18462 /// * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
18463 ///
18464 /// The template must be in the same project and Dataproc region as the
18465 /// session.
18466 pub session_template: std::string::String,
18467
18468 /// The session configuration.
18469 pub session_config: std::option::Option<crate::model::session::SessionConfig>,
18470
18471 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18472}
18473
18474impl Session {
18475 pub fn new() -> Self {
18476 std::default::Default::default()
18477 }
18478
18479 /// Sets the value of [name][crate::model::Session::name].
18480 ///
18481 /// # Example
18482 /// ```ignore,no_run
18483 /// # use google_cloud_dataproc_v1::model::Session;
18484 /// let x = Session::new().set_name("example");
18485 /// ```
18486 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18487 self.name = v.into();
18488 self
18489 }
18490
18491 /// Sets the value of [uuid][crate::model::Session::uuid].
18492 ///
18493 /// # Example
18494 /// ```ignore,no_run
18495 /// # use google_cloud_dataproc_v1::model::Session;
18496 /// let x = Session::new().set_uuid("example");
18497 /// ```
18498 pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18499 self.uuid = v.into();
18500 self
18501 }
18502
18503 /// Sets the value of [create_time][crate::model::Session::create_time].
18504 ///
18505 /// # Example
18506 /// ```ignore,no_run
18507 /// # use google_cloud_dataproc_v1::model::Session;
18508 /// use wkt::Timestamp;
18509 /// let x = Session::new().set_create_time(Timestamp::default()/* use setters */);
18510 /// ```
18511 pub fn set_create_time<T>(mut self, v: T) -> Self
18512 where
18513 T: std::convert::Into<wkt::Timestamp>,
18514 {
18515 self.create_time = std::option::Option::Some(v.into());
18516 self
18517 }
18518
18519 /// Sets or clears the value of [create_time][crate::model::Session::create_time].
18520 ///
18521 /// # Example
18522 /// ```ignore,no_run
18523 /// # use google_cloud_dataproc_v1::model::Session;
18524 /// use wkt::Timestamp;
18525 /// let x = Session::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18526 /// let x = Session::new().set_or_clear_create_time(None::<Timestamp>);
18527 /// ```
18528 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18529 where
18530 T: std::convert::Into<wkt::Timestamp>,
18531 {
18532 self.create_time = v.map(|x| x.into());
18533 self
18534 }
18535
18536 /// Sets the value of [runtime_info][crate::model::Session::runtime_info].
18537 ///
18538 /// # Example
18539 /// ```ignore,no_run
18540 /// # use google_cloud_dataproc_v1::model::Session;
18541 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
18542 /// let x = Session::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
18543 /// ```
18544 pub fn set_runtime_info<T>(mut self, v: T) -> Self
18545 where
18546 T: std::convert::Into<crate::model::RuntimeInfo>,
18547 {
18548 self.runtime_info = std::option::Option::Some(v.into());
18549 self
18550 }
18551
18552 /// Sets or clears the value of [runtime_info][crate::model::Session::runtime_info].
18553 ///
18554 /// # Example
18555 /// ```ignore,no_run
18556 /// # use google_cloud_dataproc_v1::model::Session;
18557 /// use google_cloud_dataproc_v1::model::RuntimeInfo;
18558 /// let x = Session::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
18559 /// let x = Session::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
18560 /// ```
18561 pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
18562 where
18563 T: std::convert::Into<crate::model::RuntimeInfo>,
18564 {
18565 self.runtime_info = v.map(|x| x.into());
18566 self
18567 }
18568
18569 /// Sets the value of [state][crate::model::Session::state].
18570 ///
18571 /// # Example
18572 /// ```ignore,no_run
18573 /// # use google_cloud_dataproc_v1::model::Session;
18574 /// use google_cloud_dataproc_v1::model::session::State;
18575 /// let x0 = Session::new().set_state(State::Creating);
18576 /// let x1 = Session::new().set_state(State::Active);
18577 /// let x2 = Session::new().set_state(State::Terminating);
18578 /// ```
18579 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(mut self, v: T) -> Self {
18580 self.state = v.into();
18581 self
18582 }
18583
18584 /// Sets the value of [state_message][crate::model::Session::state_message].
18585 ///
18586 /// # Example
18587 /// ```ignore,no_run
18588 /// # use google_cloud_dataproc_v1::model::Session;
18589 /// let x = Session::new().set_state_message("example");
18590 /// ```
18591 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18592 self.state_message = v.into();
18593 self
18594 }
18595
18596 /// Sets the value of [state_time][crate::model::Session::state_time].
18597 ///
18598 /// # Example
18599 /// ```ignore,no_run
18600 /// # use google_cloud_dataproc_v1::model::Session;
18601 /// use wkt::Timestamp;
18602 /// let x = Session::new().set_state_time(Timestamp::default()/* use setters */);
18603 /// ```
18604 pub fn set_state_time<T>(mut self, v: T) -> Self
18605 where
18606 T: std::convert::Into<wkt::Timestamp>,
18607 {
18608 self.state_time = std::option::Option::Some(v.into());
18609 self
18610 }
18611
18612 /// Sets or clears the value of [state_time][crate::model::Session::state_time].
18613 ///
18614 /// # Example
18615 /// ```ignore,no_run
18616 /// # use google_cloud_dataproc_v1::model::Session;
18617 /// use wkt::Timestamp;
18618 /// let x = Session::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
18619 /// let x = Session::new().set_or_clear_state_time(None::<Timestamp>);
18620 /// ```
18621 pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
18622 where
18623 T: std::convert::Into<wkt::Timestamp>,
18624 {
18625 self.state_time = v.map(|x| x.into());
18626 self
18627 }
18628
18629 /// Sets the value of [creator][crate::model::Session::creator].
18630 ///
18631 /// # Example
18632 /// ```ignore,no_run
18633 /// # use google_cloud_dataproc_v1::model::Session;
18634 /// let x = Session::new().set_creator("example");
18635 /// ```
18636 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18637 self.creator = v.into();
18638 self
18639 }
18640
18641 /// Sets the value of [labels][crate::model::Session::labels].
18642 ///
18643 /// # Example
18644 /// ```ignore,no_run
18645 /// # use google_cloud_dataproc_v1::model::Session;
18646 /// let x = Session::new().set_labels([
18647 /// ("key0", "abc"),
18648 /// ("key1", "xyz"),
18649 /// ]);
18650 /// ```
18651 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18652 where
18653 T: std::iter::IntoIterator<Item = (K, V)>,
18654 K: std::convert::Into<std::string::String>,
18655 V: std::convert::Into<std::string::String>,
18656 {
18657 use std::iter::Iterator;
18658 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18659 self
18660 }
18661
18662 /// Sets the value of [runtime_config][crate::model::Session::runtime_config].
18663 ///
18664 /// # Example
18665 /// ```ignore,no_run
18666 /// # use google_cloud_dataproc_v1::model::Session;
18667 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18668 /// let x = Session::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
18669 /// ```
18670 pub fn set_runtime_config<T>(mut self, v: T) -> Self
18671 where
18672 T: std::convert::Into<crate::model::RuntimeConfig>,
18673 {
18674 self.runtime_config = std::option::Option::Some(v.into());
18675 self
18676 }
18677
18678 /// Sets or clears the value of [runtime_config][crate::model::Session::runtime_config].
18679 ///
18680 /// # Example
18681 /// ```ignore,no_run
18682 /// # use google_cloud_dataproc_v1::model::Session;
18683 /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18684 /// let x = Session::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
18685 /// let x = Session::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
18686 /// ```
18687 pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
18688 where
18689 T: std::convert::Into<crate::model::RuntimeConfig>,
18690 {
18691 self.runtime_config = v.map(|x| x.into());
18692 self
18693 }
18694
18695 /// Sets the value of [environment_config][crate::model::Session::environment_config].
18696 ///
18697 /// # Example
18698 /// ```ignore,no_run
18699 /// # use google_cloud_dataproc_v1::model::Session;
18700 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18701 /// let x = Session::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
18702 /// ```
18703 pub fn set_environment_config<T>(mut self, v: T) -> Self
18704 where
18705 T: std::convert::Into<crate::model::EnvironmentConfig>,
18706 {
18707 self.environment_config = std::option::Option::Some(v.into());
18708 self
18709 }
18710
18711 /// Sets or clears the value of [environment_config][crate::model::Session::environment_config].
18712 ///
18713 /// # Example
18714 /// ```ignore,no_run
18715 /// # use google_cloud_dataproc_v1::model::Session;
18716 /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18717 /// let x = Session::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
18718 /// let x = Session::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
18719 /// ```
18720 pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
18721 where
18722 T: std::convert::Into<crate::model::EnvironmentConfig>,
18723 {
18724 self.environment_config = v.map(|x| x.into());
18725 self
18726 }
18727
18728 /// Sets the value of [user][crate::model::Session::user].
18729 ///
18730 /// # Example
18731 /// ```ignore,no_run
18732 /// # use google_cloud_dataproc_v1::model::Session;
18733 /// let x = Session::new().set_user("example");
18734 /// ```
18735 pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18736 self.user = v.into();
18737 self
18738 }
18739
18740 /// Sets the value of [state_history][crate::model::Session::state_history].
18741 ///
18742 /// # Example
18743 /// ```ignore,no_run
18744 /// # use google_cloud_dataproc_v1::model::Session;
18745 /// use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18746 /// let x = Session::new()
18747 /// .set_state_history([
18748 /// SessionStateHistory::default()/* use setters */,
18749 /// SessionStateHistory::default()/* use (different) setters */,
18750 /// ]);
18751 /// ```
18752 pub fn set_state_history<T, V>(mut self, v: T) -> Self
18753 where
18754 T: std::iter::IntoIterator<Item = V>,
18755 V: std::convert::Into<crate::model::session::SessionStateHistory>,
18756 {
18757 use std::iter::Iterator;
18758 self.state_history = v.into_iter().map(|i| i.into()).collect();
18759 self
18760 }
18761
18762 /// Sets the value of [session_template][crate::model::Session::session_template].
18763 ///
18764 /// # Example
18765 /// ```ignore,no_run
18766 /// # use google_cloud_dataproc_v1::model::Session;
18767 /// let x = Session::new().set_session_template("example");
18768 /// ```
18769 pub fn set_session_template<T: std::convert::Into<std::string::String>>(
18770 mut self,
18771 v: T,
18772 ) -> Self {
18773 self.session_template = v.into();
18774 self
18775 }
18776
18777 /// Sets the value of [session_config][crate::model::Session::session_config].
18778 ///
18779 /// Note that all the setters affecting `session_config` are mutually
18780 /// exclusive.
18781 ///
18782 /// # Example
18783 /// ```ignore,no_run
18784 /// # use google_cloud_dataproc_v1::model::Session;
18785 /// use google_cloud_dataproc_v1::model::JupyterConfig;
18786 /// let x = Session::new().set_session_config(Some(
18787 /// google_cloud_dataproc_v1::model::session::SessionConfig::JupyterSession(JupyterConfig::default().into())));
18788 /// ```
18789 pub fn set_session_config<
18790 T: std::convert::Into<std::option::Option<crate::model::session::SessionConfig>>,
18791 >(
18792 mut self,
18793 v: T,
18794 ) -> Self {
18795 self.session_config = v.into();
18796 self
18797 }
18798
18799 /// The value of [session_config][crate::model::Session::session_config]
18800 /// if it holds a `JupyterSession`, `None` if the field is not set or
18801 /// holds a different branch.
18802 pub fn jupyter_session(
18803 &self,
18804 ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
18805 #[allow(unreachable_patterns)]
18806 self.session_config.as_ref().and_then(|v| match v {
18807 crate::model::session::SessionConfig::JupyterSession(v) => std::option::Option::Some(v),
18808 _ => std::option::Option::None,
18809 })
18810 }
18811
18812 /// Sets the value of [session_config][crate::model::Session::session_config]
18813 /// to hold a `JupyterSession`.
18814 ///
18815 /// Note that all the setters affecting `session_config` are
18816 /// mutually exclusive.
18817 ///
18818 /// # Example
18819 /// ```ignore,no_run
18820 /// # use google_cloud_dataproc_v1::model::Session;
18821 /// use google_cloud_dataproc_v1::model::JupyterConfig;
18822 /// let x = Session::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
18823 /// assert!(x.jupyter_session().is_some());
18824 /// assert!(x.spark_connect_session().is_none());
18825 /// ```
18826 pub fn set_jupyter_session<
18827 T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
18828 >(
18829 mut self,
18830 v: T,
18831 ) -> Self {
18832 self.session_config = std::option::Option::Some(
18833 crate::model::session::SessionConfig::JupyterSession(v.into()),
18834 );
18835 self
18836 }
18837
18838 /// The value of [session_config][crate::model::Session::session_config]
18839 /// if it holds a `SparkConnectSession`, `None` if the field is not set or
18840 /// holds a different branch.
18841 pub fn spark_connect_session(
18842 &self,
18843 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
18844 #[allow(unreachable_patterns)]
18845 self.session_config.as_ref().and_then(|v| match v {
18846 crate::model::session::SessionConfig::SparkConnectSession(v) => {
18847 std::option::Option::Some(v)
18848 }
18849 _ => std::option::Option::None,
18850 })
18851 }
18852
18853 /// Sets the value of [session_config][crate::model::Session::session_config]
18854 /// to hold a `SparkConnectSession`.
18855 ///
18856 /// Note that all the setters affecting `session_config` are
18857 /// mutually exclusive.
18858 ///
18859 /// # Example
18860 /// ```ignore,no_run
18861 /// # use google_cloud_dataproc_v1::model::Session;
18862 /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
18863 /// let x = Session::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
18864 /// assert!(x.spark_connect_session().is_some());
18865 /// assert!(x.jupyter_session().is_none());
18866 /// ```
18867 pub fn set_spark_connect_session<
18868 T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
18869 >(
18870 mut self,
18871 v: T,
18872 ) -> Self {
18873 self.session_config = std::option::Option::Some(
18874 crate::model::session::SessionConfig::SparkConnectSession(v.into()),
18875 );
18876 self
18877 }
18878}
18879
18880impl wkt::message::Message for Session {
18881 fn typename() -> &'static str {
18882 "type.googleapis.com/google.cloud.dataproc.v1.Session"
18883 }
18884}
18885
18886/// Defines additional types related to [Session].
18887pub mod session {
18888 #[allow(unused_imports)]
18889 use super::*;
18890
18891 /// Historical state information.
18892 #[derive(Clone, Default, PartialEq)]
18893 #[non_exhaustive]
18894 pub struct SessionStateHistory {
18895 /// Output only. The state of the session at this point in the session
18896 /// history.
18897 pub state: crate::model::session::State,
18898
18899 /// Output only. Details about the state at this point in the session
18900 /// history.
18901 pub state_message: std::string::String,
18902
18903 /// Output only. The time when the session entered the historical state.
18904 pub state_start_time: std::option::Option<wkt::Timestamp>,
18905
18906 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18907 }
18908
18909 impl SessionStateHistory {
18910 pub fn new() -> Self {
18911 std::default::Default::default()
18912 }
18913
18914 /// Sets the value of [state][crate::model::session::SessionStateHistory::state].
18915 ///
18916 /// # Example
18917 /// ```ignore,no_run
18918 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18919 /// use google_cloud_dataproc_v1::model::session::State;
18920 /// let x0 = SessionStateHistory::new().set_state(State::Creating);
18921 /// let x1 = SessionStateHistory::new().set_state(State::Active);
18922 /// let x2 = SessionStateHistory::new().set_state(State::Terminating);
18923 /// ```
18924 pub fn set_state<T: std::convert::Into<crate::model::session::State>>(
18925 mut self,
18926 v: T,
18927 ) -> Self {
18928 self.state = v.into();
18929 self
18930 }
18931
18932 /// Sets the value of [state_message][crate::model::session::SessionStateHistory::state_message].
18933 ///
18934 /// # Example
18935 /// ```ignore,no_run
18936 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18937 /// let x = SessionStateHistory::new().set_state_message("example");
18938 /// ```
18939 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
18940 mut self,
18941 v: T,
18942 ) -> Self {
18943 self.state_message = v.into();
18944 self
18945 }
18946
18947 /// Sets the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
18948 ///
18949 /// # Example
18950 /// ```ignore,no_run
18951 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18952 /// use wkt::Timestamp;
18953 /// let x = SessionStateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
18954 /// ```
18955 pub fn set_state_start_time<T>(mut self, v: T) -> Self
18956 where
18957 T: std::convert::Into<wkt::Timestamp>,
18958 {
18959 self.state_start_time = std::option::Option::Some(v.into());
18960 self
18961 }
18962
18963 /// Sets or clears the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
18964 ///
18965 /// # Example
18966 /// ```ignore,no_run
18967 /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
18968 /// use wkt::Timestamp;
18969 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
18970 /// let x = SessionStateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
18971 /// ```
18972 pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
18973 where
18974 T: std::convert::Into<wkt::Timestamp>,
18975 {
18976 self.state_start_time = v.map(|x| x.into());
18977 self
18978 }
18979 }
18980
18981 impl wkt::message::Message for SessionStateHistory {
18982 fn typename() -> &'static str {
18983 "type.googleapis.com/google.cloud.dataproc.v1.Session.SessionStateHistory"
18984 }
18985 }
18986
18987 /// The session state.
18988 ///
18989 /// # Working with unknown values
18990 ///
18991 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18992 /// additional enum variants at any time. Adding new variants is not considered
18993 /// a breaking change. Applications should write their code in anticipation of:
18994 ///
18995 /// - New values appearing in future releases of the client library, **and**
18996 /// - New values received dynamically, without application changes.
18997 ///
18998 /// Please consult the [Working with enums] section in the user guide for some
18999 /// guidelines.
19000 ///
19001 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19002 #[derive(Clone, Debug, PartialEq)]
19003 #[non_exhaustive]
19004 pub enum State {
19005 /// The session state is unknown.
19006 Unspecified,
19007 /// The session is created prior to running.
19008 Creating,
19009 /// The session is running.
19010 Active,
19011 /// The session is terminating.
19012 Terminating,
19013 /// The session is terminated successfully.
19014 Terminated,
19015 /// The session is no longer running due to an error.
19016 Failed,
19017 /// If set, the enum was initialized with an unknown value.
19018 ///
19019 /// Applications can examine the value using [State::value] or
19020 /// [State::name].
19021 UnknownValue(state::UnknownValue),
19022 }
19023
19024 #[doc(hidden)]
19025 pub mod state {
19026 #[allow(unused_imports)]
19027 use super::*;
19028 #[derive(Clone, Debug, PartialEq)]
19029 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19030 }
19031
19032 impl State {
19033 /// Gets the enum value.
19034 ///
19035 /// Returns `None` if the enum contains an unknown value deserialized from
19036 /// the string representation of enums.
19037 pub fn value(&self) -> std::option::Option<i32> {
19038 match self {
19039 Self::Unspecified => std::option::Option::Some(0),
19040 Self::Creating => std::option::Option::Some(1),
19041 Self::Active => std::option::Option::Some(2),
19042 Self::Terminating => std::option::Option::Some(3),
19043 Self::Terminated => std::option::Option::Some(4),
19044 Self::Failed => std::option::Option::Some(5),
19045 Self::UnknownValue(u) => u.0.value(),
19046 }
19047 }
19048
19049 /// Gets the enum value as a string.
19050 ///
19051 /// Returns `None` if the enum contains an unknown value deserialized from
19052 /// the integer representation of enums.
19053 pub fn name(&self) -> std::option::Option<&str> {
19054 match self {
19055 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19056 Self::Creating => std::option::Option::Some("CREATING"),
19057 Self::Active => std::option::Option::Some("ACTIVE"),
19058 Self::Terminating => std::option::Option::Some("TERMINATING"),
19059 Self::Terminated => std::option::Option::Some("TERMINATED"),
19060 Self::Failed => std::option::Option::Some("FAILED"),
19061 Self::UnknownValue(u) => u.0.name(),
19062 }
19063 }
19064 }
19065
19066 impl std::default::Default for State {
19067 fn default() -> Self {
19068 use std::convert::From;
19069 Self::from(0)
19070 }
19071 }
19072
19073 impl std::fmt::Display for State {
19074 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19075 wkt::internal::display_enum(f, self.name(), self.value())
19076 }
19077 }
19078
19079 impl std::convert::From<i32> for State {
19080 fn from(value: i32) -> Self {
19081 match value {
19082 0 => Self::Unspecified,
19083 1 => Self::Creating,
19084 2 => Self::Active,
19085 3 => Self::Terminating,
19086 4 => Self::Terminated,
19087 5 => Self::Failed,
19088 _ => Self::UnknownValue(state::UnknownValue(
19089 wkt::internal::UnknownEnumValue::Integer(value),
19090 )),
19091 }
19092 }
19093 }
19094
19095 impl std::convert::From<&str> for State {
19096 fn from(value: &str) -> Self {
19097 use std::string::ToString;
19098 match value {
19099 "STATE_UNSPECIFIED" => Self::Unspecified,
19100 "CREATING" => Self::Creating,
19101 "ACTIVE" => Self::Active,
19102 "TERMINATING" => Self::Terminating,
19103 "TERMINATED" => Self::Terminated,
19104 "FAILED" => Self::Failed,
19105 _ => Self::UnknownValue(state::UnknownValue(
19106 wkt::internal::UnknownEnumValue::String(value.to_string()),
19107 )),
19108 }
19109 }
19110 }
19111
19112 impl serde::ser::Serialize for State {
19113 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19114 where
19115 S: serde::Serializer,
19116 {
19117 match self {
19118 Self::Unspecified => serializer.serialize_i32(0),
19119 Self::Creating => serializer.serialize_i32(1),
19120 Self::Active => serializer.serialize_i32(2),
19121 Self::Terminating => serializer.serialize_i32(3),
19122 Self::Terminated => serializer.serialize_i32(4),
19123 Self::Failed => serializer.serialize_i32(5),
19124 Self::UnknownValue(u) => u.0.serialize(serializer),
19125 }
19126 }
19127 }
19128
19129 impl<'de> serde::de::Deserialize<'de> for State {
19130 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19131 where
19132 D: serde::Deserializer<'de>,
19133 {
19134 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19135 ".google.cloud.dataproc.v1.Session.State",
19136 ))
19137 }
19138 }
19139
19140 /// The session configuration.
19141 #[derive(Clone, Debug, PartialEq)]
19142 #[non_exhaustive]
19143 pub enum SessionConfig {
19144 /// Optional. Jupyter session config.
19145 JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
19146 /// Optional. Spark Connect session config.
19147 SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
19148 }
19149}
19150
19151/// Jupyter configuration for an interactive session.
19152#[derive(Clone, Default, PartialEq)]
19153#[non_exhaustive]
19154pub struct JupyterConfig {
19155 /// Optional. Kernel
19156 pub kernel: crate::model::jupyter_config::Kernel,
19157
19158 /// Optional. Display name, shown in the Jupyter kernelspec card.
19159 pub display_name: std::string::String,
19160
19161 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19162}
19163
19164impl JupyterConfig {
19165 pub fn new() -> Self {
19166 std::default::Default::default()
19167 }
19168
19169 /// Sets the value of [kernel][crate::model::JupyterConfig::kernel].
19170 ///
19171 /// # Example
19172 /// ```ignore,no_run
19173 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19174 /// use google_cloud_dataproc_v1::model::jupyter_config::Kernel;
19175 /// let x0 = JupyterConfig::new().set_kernel(Kernel::Python);
19176 /// let x1 = JupyterConfig::new().set_kernel(Kernel::Scala);
19177 /// ```
19178 pub fn set_kernel<T: std::convert::Into<crate::model::jupyter_config::Kernel>>(
19179 mut self,
19180 v: T,
19181 ) -> Self {
19182 self.kernel = v.into();
19183 self
19184 }
19185
19186 /// Sets the value of [display_name][crate::model::JupyterConfig::display_name].
19187 ///
19188 /// # Example
19189 /// ```ignore,no_run
19190 /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19191 /// let x = JupyterConfig::new().set_display_name("example");
19192 /// ```
19193 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19194 self.display_name = v.into();
19195 self
19196 }
19197}
19198
19199impl wkt::message::Message for JupyterConfig {
19200 fn typename() -> &'static str {
19201 "type.googleapis.com/google.cloud.dataproc.v1.JupyterConfig"
19202 }
19203}
19204
19205/// Defines additional types related to [JupyterConfig].
19206pub mod jupyter_config {
19207 #[allow(unused_imports)]
19208 use super::*;
19209
19210 /// Jupyter kernel types.
19211 ///
19212 /// # Working with unknown values
19213 ///
19214 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19215 /// additional enum variants at any time. Adding new variants is not considered
19216 /// a breaking change. Applications should write their code in anticipation of:
19217 ///
19218 /// - New values appearing in future releases of the client library, **and**
19219 /// - New values received dynamically, without application changes.
19220 ///
19221 /// Please consult the [Working with enums] section in the user guide for some
19222 /// guidelines.
19223 ///
19224 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19225 #[derive(Clone, Debug, PartialEq)]
19226 #[non_exhaustive]
19227 pub enum Kernel {
19228 /// The kernel is unknown.
19229 Unspecified,
19230 /// Python kernel.
19231 Python,
19232 /// Scala kernel.
19233 Scala,
19234 /// If set, the enum was initialized with an unknown value.
19235 ///
19236 /// Applications can examine the value using [Kernel::value] or
19237 /// [Kernel::name].
19238 UnknownValue(kernel::UnknownValue),
19239 }
19240
19241 #[doc(hidden)]
19242 pub mod kernel {
19243 #[allow(unused_imports)]
19244 use super::*;
19245 #[derive(Clone, Debug, PartialEq)]
19246 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19247 }
19248
19249 impl Kernel {
19250 /// Gets the enum value.
19251 ///
19252 /// Returns `None` if the enum contains an unknown value deserialized from
19253 /// the string representation of enums.
19254 pub fn value(&self) -> std::option::Option<i32> {
19255 match self {
19256 Self::Unspecified => std::option::Option::Some(0),
19257 Self::Python => std::option::Option::Some(1),
19258 Self::Scala => std::option::Option::Some(2),
19259 Self::UnknownValue(u) => u.0.value(),
19260 }
19261 }
19262
19263 /// Gets the enum value as a string.
19264 ///
19265 /// Returns `None` if the enum contains an unknown value deserialized from
19266 /// the integer representation of enums.
19267 pub fn name(&self) -> std::option::Option<&str> {
19268 match self {
19269 Self::Unspecified => std::option::Option::Some("KERNEL_UNSPECIFIED"),
19270 Self::Python => std::option::Option::Some("PYTHON"),
19271 Self::Scala => std::option::Option::Some("SCALA"),
19272 Self::UnknownValue(u) => u.0.name(),
19273 }
19274 }
19275 }
19276
19277 impl std::default::Default for Kernel {
19278 fn default() -> Self {
19279 use std::convert::From;
19280 Self::from(0)
19281 }
19282 }
19283
19284 impl std::fmt::Display for Kernel {
19285 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19286 wkt::internal::display_enum(f, self.name(), self.value())
19287 }
19288 }
19289
19290 impl std::convert::From<i32> for Kernel {
19291 fn from(value: i32) -> Self {
19292 match value {
19293 0 => Self::Unspecified,
19294 1 => Self::Python,
19295 2 => Self::Scala,
19296 _ => Self::UnknownValue(kernel::UnknownValue(
19297 wkt::internal::UnknownEnumValue::Integer(value),
19298 )),
19299 }
19300 }
19301 }
19302
19303 impl std::convert::From<&str> for Kernel {
19304 fn from(value: &str) -> Self {
19305 use std::string::ToString;
19306 match value {
19307 "KERNEL_UNSPECIFIED" => Self::Unspecified,
19308 "PYTHON" => Self::Python,
19309 "SCALA" => Self::Scala,
19310 _ => Self::UnknownValue(kernel::UnknownValue(
19311 wkt::internal::UnknownEnumValue::String(value.to_string()),
19312 )),
19313 }
19314 }
19315 }
19316
19317 impl serde::ser::Serialize for Kernel {
19318 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19319 where
19320 S: serde::Serializer,
19321 {
19322 match self {
19323 Self::Unspecified => serializer.serialize_i32(0),
19324 Self::Python => serializer.serialize_i32(1),
19325 Self::Scala => serializer.serialize_i32(2),
19326 Self::UnknownValue(u) => u.0.serialize(serializer),
19327 }
19328 }
19329 }
19330
19331 impl<'de> serde::de::Deserialize<'de> for Kernel {
19332 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19333 where
19334 D: serde::Deserializer<'de>,
19335 {
19336 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kernel>::new(
19337 ".google.cloud.dataproc.v1.JupyterConfig.Kernel",
19338 ))
19339 }
19340 }
19341}
19342
19343/// Spark Connect configuration for an interactive session.
19344#[derive(Clone, Default, PartialEq)]
19345#[non_exhaustive]
19346pub struct SparkConnectConfig {
19347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19348}
19349
19350impl SparkConnectConfig {
19351 pub fn new() -> Self {
19352 std::default::Default::default()
19353 }
19354}
19355
19356impl wkt::message::Message for SparkConnectConfig {
19357 fn typename() -> &'static str {
19358 "type.googleapis.com/google.cloud.dataproc.v1.SparkConnectConfig"
19359 }
19360}
19361
19362/// Runtime configuration for a workload.
19363#[derive(Clone, Default, PartialEq)]
19364#[non_exhaustive]
19365pub struct RuntimeConfig {
19366 /// Optional. Version of the batch runtime.
19367 pub version: std::string::String,
19368
19369 /// Optional. Optional custom container image for the job runtime environment.
19370 /// If not specified, a default container image will be used.
19371 pub container_image: std::string::String,
19372
19373 /// Optional. A mapping of property names to values, which are used to
19374 /// configure workload execution.
19375 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
19376
19377 /// Optional. Dependency repository configuration.
19378 pub repository_config: std::option::Option<crate::model::RepositoryConfig>,
19379
19380 /// Optional. Autotuning configuration of the workload.
19381 pub autotuning_config: std::option::Option<crate::model::AutotuningConfig>,
19382
19383 /// Optional. Cohort identifier. Identifies families of the workloads having
19384 /// the same shape, e.g. daily ETL jobs.
19385 pub cohort: std::string::String,
19386
19387 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19388}
19389
19390impl RuntimeConfig {
19391 pub fn new() -> Self {
19392 std::default::Default::default()
19393 }
19394
19395 /// Sets the value of [version][crate::model::RuntimeConfig::version].
19396 ///
19397 /// # Example
19398 /// ```ignore,no_run
19399 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19400 /// let x = RuntimeConfig::new().set_version("example");
19401 /// ```
19402 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19403 self.version = v.into();
19404 self
19405 }
19406
19407 /// Sets the value of [container_image][crate::model::RuntimeConfig::container_image].
19408 ///
19409 /// # Example
19410 /// ```ignore,no_run
19411 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19412 /// let x = RuntimeConfig::new().set_container_image("example");
19413 /// ```
19414 pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19415 self.container_image = v.into();
19416 self
19417 }
19418
19419 /// Sets the value of [properties][crate::model::RuntimeConfig::properties].
19420 ///
19421 /// # Example
19422 /// ```ignore,no_run
19423 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19424 /// let x = RuntimeConfig::new().set_properties([
19425 /// ("key0", "abc"),
19426 /// ("key1", "xyz"),
19427 /// ]);
19428 /// ```
19429 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
19430 where
19431 T: std::iter::IntoIterator<Item = (K, V)>,
19432 K: std::convert::Into<std::string::String>,
19433 V: std::convert::Into<std::string::String>,
19434 {
19435 use std::iter::Iterator;
19436 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
19437 self
19438 }
19439
19440 /// Sets the value of [repository_config][crate::model::RuntimeConfig::repository_config].
19441 ///
19442 /// # Example
19443 /// ```ignore,no_run
19444 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19445 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
19446 /// let x = RuntimeConfig::new().set_repository_config(RepositoryConfig::default()/* use setters */);
19447 /// ```
19448 pub fn set_repository_config<T>(mut self, v: T) -> Self
19449 where
19450 T: std::convert::Into<crate::model::RepositoryConfig>,
19451 {
19452 self.repository_config = std::option::Option::Some(v.into());
19453 self
19454 }
19455
19456 /// Sets or clears the value of [repository_config][crate::model::RuntimeConfig::repository_config].
19457 ///
19458 /// # Example
19459 /// ```ignore,no_run
19460 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19461 /// use google_cloud_dataproc_v1::model::RepositoryConfig;
19462 /// let x = RuntimeConfig::new().set_or_clear_repository_config(Some(RepositoryConfig::default()/* use setters */));
19463 /// let x = RuntimeConfig::new().set_or_clear_repository_config(None::<RepositoryConfig>);
19464 /// ```
19465 pub fn set_or_clear_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
19466 where
19467 T: std::convert::Into<crate::model::RepositoryConfig>,
19468 {
19469 self.repository_config = v.map(|x| x.into());
19470 self
19471 }
19472
19473 /// Sets the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
19474 ///
19475 /// # Example
19476 /// ```ignore,no_run
19477 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19478 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
19479 /// let x = RuntimeConfig::new().set_autotuning_config(AutotuningConfig::default()/* use setters */);
19480 /// ```
19481 pub fn set_autotuning_config<T>(mut self, v: T) -> Self
19482 where
19483 T: std::convert::Into<crate::model::AutotuningConfig>,
19484 {
19485 self.autotuning_config = std::option::Option::Some(v.into());
19486 self
19487 }
19488
19489 /// Sets or clears the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
19490 ///
19491 /// # Example
19492 /// ```ignore,no_run
19493 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19494 /// use google_cloud_dataproc_v1::model::AutotuningConfig;
19495 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(Some(AutotuningConfig::default()/* use setters */));
19496 /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(None::<AutotuningConfig>);
19497 /// ```
19498 pub fn set_or_clear_autotuning_config<T>(mut self, v: std::option::Option<T>) -> Self
19499 where
19500 T: std::convert::Into<crate::model::AutotuningConfig>,
19501 {
19502 self.autotuning_config = v.map(|x| x.into());
19503 self
19504 }
19505
19506 /// Sets the value of [cohort][crate::model::RuntimeConfig::cohort].
19507 ///
19508 /// # Example
19509 /// ```ignore,no_run
19510 /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19511 /// let x = RuntimeConfig::new().set_cohort("example");
19512 /// ```
19513 pub fn set_cohort<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19514 self.cohort = v.into();
19515 self
19516 }
19517}
19518
19519impl wkt::message::Message for RuntimeConfig {
19520 fn typename() -> &'static str {
19521 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeConfig"
19522 }
19523}
19524
19525/// Environment configuration for a workload.
19526#[derive(Clone, Default, PartialEq)]
19527#[non_exhaustive]
19528pub struct EnvironmentConfig {
19529 /// Optional. Execution configuration for a workload.
19530 pub execution_config: std::option::Option<crate::model::ExecutionConfig>,
19531
19532 /// Optional. Peripherals configuration that workload has access to.
19533 pub peripherals_config: std::option::Option<crate::model::PeripheralsConfig>,
19534
19535 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19536}
19537
19538impl EnvironmentConfig {
19539 pub fn new() -> Self {
19540 std::default::Default::default()
19541 }
19542
19543 /// Sets the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
19544 ///
19545 /// # Example
19546 /// ```ignore,no_run
19547 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19548 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
19549 /// let x = EnvironmentConfig::new().set_execution_config(ExecutionConfig::default()/* use setters */);
19550 /// ```
19551 pub fn set_execution_config<T>(mut self, v: T) -> Self
19552 where
19553 T: std::convert::Into<crate::model::ExecutionConfig>,
19554 {
19555 self.execution_config = std::option::Option::Some(v.into());
19556 self
19557 }
19558
19559 /// Sets or clears the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
19560 ///
19561 /// # Example
19562 /// ```ignore,no_run
19563 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19564 /// use google_cloud_dataproc_v1::model::ExecutionConfig;
19565 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(Some(ExecutionConfig::default()/* use setters */));
19566 /// let x = EnvironmentConfig::new().set_or_clear_execution_config(None::<ExecutionConfig>);
19567 /// ```
19568 pub fn set_or_clear_execution_config<T>(mut self, v: std::option::Option<T>) -> Self
19569 where
19570 T: std::convert::Into<crate::model::ExecutionConfig>,
19571 {
19572 self.execution_config = v.map(|x| x.into());
19573 self
19574 }
19575
19576 /// Sets the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
19577 ///
19578 /// # Example
19579 /// ```ignore,no_run
19580 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19581 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
19582 /// let x = EnvironmentConfig::new().set_peripherals_config(PeripheralsConfig::default()/* use setters */);
19583 /// ```
19584 pub fn set_peripherals_config<T>(mut self, v: T) -> Self
19585 where
19586 T: std::convert::Into<crate::model::PeripheralsConfig>,
19587 {
19588 self.peripherals_config = std::option::Option::Some(v.into());
19589 self
19590 }
19591
19592 /// Sets or clears the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
19593 ///
19594 /// # Example
19595 /// ```ignore,no_run
19596 /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19597 /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
19598 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(Some(PeripheralsConfig::default()/* use setters */));
19599 /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(None::<PeripheralsConfig>);
19600 /// ```
19601 pub fn set_or_clear_peripherals_config<T>(mut self, v: std::option::Option<T>) -> Self
19602 where
19603 T: std::convert::Into<crate::model::PeripheralsConfig>,
19604 {
19605 self.peripherals_config = v.map(|x| x.into());
19606 self
19607 }
19608}
19609
19610impl wkt::message::Message for EnvironmentConfig {
19611 fn typename() -> &'static str {
19612 "type.googleapis.com/google.cloud.dataproc.v1.EnvironmentConfig"
19613 }
19614}
19615
19616/// Execution configuration for a workload.
19617#[derive(Clone, Default, PartialEq)]
19618#[non_exhaustive]
19619pub struct ExecutionConfig {
19620 /// Optional. Service account that used to execute workload.
19621 pub service_account: std::string::String,
19622
19623 /// Optional. Tags used for network traffic control.
19624 pub network_tags: std::vec::Vec<std::string::String>,
19625
19626 /// Optional. The Cloud KMS key to use for encryption.
19627 pub kms_key: std::string::String,
19628
19629 /// Optional. Applies to sessions only. The duration to keep the session alive
19630 /// while it's idling. Exceeding this threshold causes the session to
19631 /// terminate. This field cannot be set on a batch workload. Minimum value is
19632 /// 10 minutes; maximum value is 14 days (see JSON representation of
19633 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
19634 /// Defaults to 1 hour if not set.
19635 /// If both `ttl` and `idle_ttl` are specified for an interactive session,
19636 /// the conditions are treated as `OR` conditions: the workload will be
19637 /// terminated when it has been idle for `idle_ttl` or when `ttl` has been
19638 /// exceeded, whichever occurs first.
19639 pub idle_ttl: std::option::Option<wkt::Duration>,
19640
19641 /// Optional. The duration after which the workload will be terminated,
19642 /// specified as the JSON representation for
19643 /// [Duration](https://protobuf.dev/programming-guides/proto3/#json).
19644 /// When the workload exceeds this duration, it will be unconditionally
19645 /// terminated without waiting for ongoing work to finish. If `ttl` is not
19646 /// specified for a batch workload, the workload will be allowed to run until
19647 /// it exits naturally (or run forever without exiting). If `ttl` is not
19648 /// specified for an interactive session, it defaults to 24 hours. If `ttl` is
19649 /// not specified for a batch that uses 2.1+ runtime version, it defaults to 4
19650 /// hours. Minimum value is 10 minutes; maximum value is 14 days. If both `ttl`
19651 /// and `idle_ttl` are specified (for an interactive session), the conditions
19652 /// are treated as `OR` conditions: the workload will be terminated when it has
19653 /// been idle for `idle_ttl` or when `ttl` has been exceeded, whichever occurs
19654 /// first.
19655 pub ttl: std::option::Option<wkt::Duration>,
19656
19657 /// Optional. A Cloud Storage bucket used to stage workload dependencies,
19658 /// config files, and store workload output and other ephemeral data, such as
19659 /// Spark history files. If you do not specify a staging bucket, Cloud Dataproc
19660 /// will determine a Cloud Storage location according to the region where your
19661 /// workload is running, and then create and manage project-level, per-location
19662 /// staging and temporary buckets.
19663 /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
19664 /// a Cloud Storage bucket.**
19665 pub staging_bucket: std::string::String,
19666
19667 /// Optional. Authentication configuration used to set the default identity for
19668 /// the workload execution. The config specifies the type of identity
19669 /// (service account or user) that will be used by workloads to access
19670 /// resources on the project(s).
19671 pub authentication_config: std::option::Option<crate::model::AuthenticationConfig>,
19672
19673 /// Network configuration for workload execution.
19674 pub network: std::option::Option<crate::model::execution_config::Network>,
19675
19676 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19677}
19678
19679impl ExecutionConfig {
19680 pub fn new() -> Self {
19681 std::default::Default::default()
19682 }
19683
19684 /// Sets the value of [service_account][crate::model::ExecutionConfig::service_account].
19685 ///
19686 /// # Example
19687 /// ```ignore,no_run
19688 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19689 /// let x = ExecutionConfig::new().set_service_account("example");
19690 /// ```
19691 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19692 self.service_account = v.into();
19693 self
19694 }
19695
19696 /// Sets the value of [network_tags][crate::model::ExecutionConfig::network_tags].
19697 ///
19698 /// # Example
19699 /// ```ignore,no_run
19700 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19701 /// let x = ExecutionConfig::new().set_network_tags(["a", "b", "c"]);
19702 /// ```
19703 pub fn set_network_tags<T, V>(mut self, v: T) -> Self
19704 where
19705 T: std::iter::IntoIterator<Item = V>,
19706 V: std::convert::Into<std::string::String>,
19707 {
19708 use std::iter::Iterator;
19709 self.network_tags = v.into_iter().map(|i| i.into()).collect();
19710 self
19711 }
19712
19713 /// Sets the value of [kms_key][crate::model::ExecutionConfig::kms_key].
19714 ///
19715 /// # Example
19716 /// ```ignore,no_run
19717 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19718 /// let x = ExecutionConfig::new().set_kms_key("example");
19719 /// ```
19720 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19721 self.kms_key = v.into();
19722 self
19723 }
19724
19725 /// Sets the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
19726 ///
19727 /// # Example
19728 /// ```ignore,no_run
19729 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19730 /// use wkt::Duration;
19731 /// let x = ExecutionConfig::new().set_idle_ttl(Duration::default()/* use setters */);
19732 /// ```
19733 pub fn set_idle_ttl<T>(mut self, v: T) -> Self
19734 where
19735 T: std::convert::Into<wkt::Duration>,
19736 {
19737 self.idle_ttl = std::option::Option::Some(v.into());
19738 self
19739 }
19740
19741 /// Sets or clears the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
19742 ///
19743 /// # Example
19744 /// ```ignore,no_run
19745 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19746 /// use wkt::Duration;
19747 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(Some(Duration::default()/* use setters */));
19748 /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(None::<Duration>);
19749 /// ```
19750 pub fn set_or_clear_idle_ttl<T>(mut self, v: std::option::Option<T>) -> Self
19751 where
19752 T: std::convert::Into<wkt::Duration>,
19753 {
19754 self.idle_ttl = v.map(|x| x.into());
19755 self
19756 }
19757
19758 /// Sets the value of [ttl][crate::model::ExecutionConfig::ttl].
19759 ///
19760 /// # Example
19761 /// ```ignore,no_run
19762 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19763 /// use wkt::Duration;
19764 /// let x = ExecutionConfig::new().set_ttl(Duration::default()/* use setters */);
19765 /// ```
19766 pub fn set_ttl<T>(mut self, v: T) -> Self
19767 where
19768 T: std::convert::Into<wkt::Duration>,
19769 {
19770 self.ttl = std::option::Option::Some(v.into());
19771 self
19772 }
19773
19774 /// Sets or clears the value of [ttl][crate::model::ExecutionConfig::ttl].
19775 ///
19776 /// # Example
19777 /// ```ignore,no_run
19778 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19779 /// use wkt::Duration;
19780 /// let x = ExecutionConfig::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
19781 /// let x = ExecutionConfig::new().set_or_clear_ttl(None::<Duration>);
19782 /// ```
19783 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
19784 where
19785 T: std::convert::Into<wkt::Duration>,
19786 {
19787 self.ttl = v.map(|x| x.into());
19788 self
19789 }
19790
19791 /// Sets the value of [staging_bucket][crate::model::ExecutionConfig::staging_bucket].
19792 ///
19793 /// # Example
19794 /// ```ignore,no_run
19795 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19796 /// let x = ExecutionConfig::new().set_staging_bucket("example");
19797 /// ```
19798 pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19799 self.staging_bucket = v.into();
19800 self
19801 }
19802
19803 /// Sets the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
19804 ///
19805 /// # Example
19806 /// ```ignore,no_run
19807 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19808 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
19809 /// let x = ExecutionConfig::new().set_authentication_config(AuthenticationConfig::default()/* use setters */);
19810 /// ```
19811 pub fn set_authentication_config<T>(mut self, v: T) -> Self
19812 where
19813 T: std::convert::Into<crate::model::AuthenticationConfig>,
19814 {
19815 self.authentication_config = std::option::Option::Some(v.into());
19816 self
19817 }
19818
19819 /// Sets or clears the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
19820 ///
19821 /// # Example
19822 /// ```ignore,no_run
19823 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19824 /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
19825 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(Some(AuthenticationConfig::default()/* use setters */));
19826 /// let x = ExecutionConfig::new().set_or_clear_authentication_config(None::<AuthenticationConfig>);
19827 /// ```
19828 pub fn set_or_clear_authentication_config<T>(mut self, v: std::option::Option<T>) -> Self
19829 where
19830 T: std::convert::Into<crate::model::AuthenticationConfig>,
19831 {
19832 self.authentication_config = v.map(|x| x.into());
19833 self
19834 }
19835
19836 /// Sets the value of [network][crate::model::ExecutionConfig::network].
19837 ///
19838 /// Note that all the setters affecting `network` are mutually
19839 /// exclusive.
19840 ///
19841 /// # Example
19842 /// ```ignore,no_run
19843 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19844 /// use google_cloud_dataproc_v1::model::execution_config::Network;
19845 /// let x = ExecutionConfig::new().set_network(Some(Network::NetworkUri("example".to_string())));
19846 /// ```
19847 pub fn set_network<
19848 T: std::convert::Into<std::option::Option<crate::model::execution_config::Network>>,
19849 >(
19850 mut self,
19851 v: T,
19852 ) -> Self {
19853 self.network = v.into();
19854 self
19855 }
19856
19857 /// The value of [network][crate::model::ExecutionConfig::network]
19858 /// if it holds a `NetworkUri`, `None` if the field is not set or
19859 /// holds a different branch.
19860 pub fn network_uri(&self) -> std::option::Option<&std::string::String> {
19861 #[allow(unreachable_patterns)]
19862 self.network.as_ref().and_then(|v| match v {
19863 crate::model::execution_config::Network::NetworkUri(v) => std::option::Option::Some(v),
19864 _ => std::option::Option::None,
19865 })
19866 }
19867
19868 /// Sets the value of [network][crate::model::ExecutionConfig::network]
19869 /// to hold a `NetworkUri`.
19870 ///
19871 /// Note that all the setters affecting `network` are
19872 /// mutually exclusive.
19873 ///
19874 /// # Example
19875 /// ```ignore,no_run
19876 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19877 /// let x = ExecutionConfig::new().set_network_uri("example");
19878 /// assert!(x.network_uri().is_some());
19879 /// assert!(x.subnetwork_uri().is_none());
19880 /// ```
19881 pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19882 self.network = std::option::Option::Some(
19883 crate::model::execution_config::Network::NetworkUri(v.into()),
19884 );
19885 self
19886 }
19887
19888 /// The value of [network][crate::model::ExecutionConfig::network]
19889 /// if it holds a `SubnetworkUri`, `None` if the field is not set or
19890 /// holds a different branch.
19891 pub fn subnetwork_uri(&self) -> std::option::Option<&std::string::String> {
19892 #[allow(unreachable_patterns)]
19893 self.network.as_ref().and_then(|v| match v {
19894 crate::model::execution_config::Network::SubnetworkUri(v) => {
19895 std::option::Option::Some(v)
19896 }
19897 _ => std::option::Option::None,
19898 })
19899 }
19900
19901 /// Sets the value of [network][crate::model::ExecutionConfig::network]
19902 /// to hold a `SubnetworkUri`.
19903 ///
19904 /// Note that all the setters affecting `network` are
19905 /// mutually exclusive.
19906 ///
19907 /// # Example
19908 /// ```ignore,no_run
19909 /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
19910 /// let x = ExecutionConfig::new().set_subnetwork_uri("example");
19911 /// assert!(x.subnetwork_uri().is_some());
19912 /// assert!(x.network_uri().is_none());
19913 /// ```
19914 pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19915 self.network = std::option::Option::Some(
19916 crate::model::execution_config::Network::SubnetworkUri(v.into()),
19917 );
19918 self
19919 }
19920}
19921
19922impl wkt::message::Message for ExecutionConfig {
19923 fn typename() -> &'static str {
19924 "type.googleapis.com/google.cloud.dataproc.v1.ExecutionConfig"
19925 }
19926}
19927
19928/// Defines additional types related to [ExecutionConfig].
19929pub mod execution_config {
19930 #[allow(unused_imports)]
19931 use super::*;
19932
19933 /// Network configuration for workload execution.
19934 #[derive(Clone, Debug, PartialEq)]
19935 #[non_exhaustive]
19936 pub enum Network {
19937 /// Optional. Network URI to connect workload to.
19938 NetworkUri(std::string::String),
19939 /// Optional. Subnetwork URI to connect workload to.
19940 SubnetworkUri(std::string::String),
19941 }
19942}
19943
19944/// Spark History Server configuration for the workload.
19945#[derive(Clone, Default, PartialEq)]
19946#[non_exhaustive]
19947pub struct SparkHistoryServerConfig {
19948 /// Optional. Resource name of an existing Dataproc Cluster to act as a Spark
19949 /// History Server for the workload.
19950 ///
19951 /// Example:
19952 ///
19953 /// * `projects/[project_id]/regions/[region]/clusters/[cluster_name]`
19954 pub dataproc_cluster: std::string::String,
19955
19956 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19957}
19958
19959impl SparkHistoryServerConfig {
19960 pub fn new() -> Self {
19961 std::default::Default::default()
19962 }
19963
19964 /// Sets the value of [dataproc_cluster][crate::model::SparkHistoryServerConfig::dataproc_cluster].
19965 ///
19966 /// # Example
19967 /// ```ignore,no_run
19968 /// # use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
19969 /// let x = SparkHistoryServerConfig::new().set_dataproc_cluster("example");
19970 /// ```
19971 pub fn set_dataproc_cluster<T: std::convert::Into<std::string::String>>(
19972 mut self,
19973 v: T,
19974 ) -> Self {
19975 self.dataproc_cluster = v.into();
19976 self
19977 }
19978}
19979
19980impl wkt::message::Message for SparkHistoryServerConfig {
19981 fn typename() -> &'static str {
19982 "type.googleapis.com/google.cloud.dataproc.v1.SparkHistoryServerConfig"
19983 }
19984}
19985
19986/// Auxiliary services configuration for a workload.
19987#[derive(Clone, Default, PartialEq)]
19988#[non_exhaustive]
19989pub struct PeripheralsConfig {
19990 /// Optional. Resource name of an existing Dataproc Metastore service.
19991 ///
19992 /// Example:
19993 ///
19994 /// * `projects/[project_id]/locations/[region]/services/[service_id]`
19995 pub metastore_service: std::string::String,
19996
19997 /// Optional. The Spark History Server configuration for the workload.
19998 pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
19999
20000 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20001}
20002
20003impl PeripheralsConfig {
20004 pub fn new() -> Self {
20005 std::default::Default::default()
20006 }
20007
20008 /// Sets the value of [metastore_service][crate::model::PeripheralsConfig::metastore_service].
20009 ///
20010 /// # Example
20011 /// ```ignore,no_run
20012 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20013 /// let x = PeripheralsConfig::new().set_metastore_service("example");
20014 /// ```
20015 pub fn set_metastore_service<T: std::convert::Into<std::string::String>>(
20016 mut self,
20017 v: T,
20018 ) -> Self {
20019 self.metastore_service = v.into();
20020 self
20021 }
20022
20023 /// Sets the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20024 ///
20025 /// # Example
20026 /// ```ignore,no_run
20027 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20028 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20029 /// let x = PeripheralsConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
20030 /// ```
20031 pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
20032 where
20033 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20034 {
20035 self.spark_history_server_config = std::option::Option::Some(v.into());
20036 self
20037 }
20038
20039 /// Sets or clears the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20040 ///
20041 /// # Example
20042 /// ```ignore,no_run
20043 /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20044 /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20045 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
20046 /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
20047 /// ```
20048 pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
20049 where
20050 T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20051 {
20052 self.spark_history_server_config = v.map(|x| x.into());
20053 self
20054 }
20055}
20056
20057impl wkt::message::Message for PeripheralsConfig {
20058 fn typename() -> &'static str {
20059 "type.googleapis.com/google.cloud.dataproc.v1.PeripheralsConfig"
20060 }
20061}
20062
20063/// Runtime information about workload execution.
20064#[derive(Clone, Default, PartialEq)]
20065#[non_exhaustive]
20066pub struct RuntimeInfo {
20067 /// Output only. Map of remote access endpoints (such as web interfaces and
20068 /// APIs) to their URIs.
20069 pub endpoints: std::collections::HashMap<std::string::String, std::string::String>,
20070
20071 /// Output only. A URI pointing to the location of the stdout and stderr of the
20072 /// workload.
20073 pub output_uri: std::string::String,
20074
20075 /// Output only. A URI pointing to the location of the diagnostics tarball.
20076 pub diagnostic_output_uri: std::string::String,
20077
20078 /// Output only. Approximate workload resource usage, calculated when
20079 /// the workload completes (see [Dataproc Serverless pricing]
20080 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20081 ///
20082 /// **Note:** This metric calculation may change in the future, for
20083 /// example, to capture cumulative workload resource
20084 /// consumption during workload execution (see the
20085 /// [Dataproc Serverless release notes]
20086 /// (<https://cloud.google.com/dataproc-serverless/docs/release-notes>)
20087 /// for announcements, changes, fixes
20088 /// and other Dataproc developments).
20089 pub approximate_usage: std::option::Option<crate::model::UsageMetrics>,
20090
20091 /// Output only. Snapshot of current workload resource usage.
20092 pub current_usage: std::option::Option<crate::model::UsageSnapshot>,
20093
20094 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20095}
20096
20097impl RuntimeInfo {
20098 pub fn new() -> Self {
20099 std::default::Default::default()
20100 }
20101
20102 /// Sets the value of [endpoints][crate::model::RuntimeInfo::endpoints].
20103 ///
20104 /// # Example
20105 /// ```ignore,no_run
20106 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20107 /// let x = RuntimeInfo::new().set_endpoints([
20108 /// ("key0", "abc"),
20109 /// ("key1", "xyz"),
20110 /// ]);
20111 /// ```
20112 pub fn set_endpoints<T, K, V>(mut self, v: T) -> Self
20113 where
20114 T: std::iter::IntoIterator<Item = (K, V)>,
20115 K: std::convert::Into<std::string::String>,
20116 V: std::convert::Into<std::string::String>,
20117 {
20118 use std::iter::Iterator;
20119 self.endpoints = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20120 self
20121 }
20122
20123 /// Sets the value of [output_uri][crate::model::RuntimeInfo::output_uri].
20124 ///
20125 /// # Example
20126 /// ```ignore,no_run
20127 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20128 /// let x = RuntimeInfo::new().set_output_uri("example");
20129 /// ```
20130 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20131 self.output_uri = v.into();
20132 self
20133 }
20134
20135 /// Sets the value of [diagnostic_output_uri][crate::model::RuntimeInfo::diagnostic_output_uri].
20136 ///
20137 /// # Example
20138 /// ```ignore,no_run
20139 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20140 /// let x = RuntimeInfo::new().set_diagnostic_output_uri("example");
20141 /// ```
20142 pub fn set_diagnostic_output_uri<T: std::convert::Into<std::string::String>>(
20143 mut self,
20144 v: T,
20145 ) -> Self {
20146 self.diagnostic_output_uri = v.into();
20147 self
20148 }
20149
20150 /// Sets the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20151 ///
20152 /// # Example
20153 /// ```ignore,no_run
20154 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20155 /// use google_cloud_dataproc_v1::model::UsageMetrics;
20156 /// let x = RuntimeInfo::new().set_approximate_usage(UsageMetrics::default()/* use setters */);
20157 /// ```
20158 pub fn set_approximate_usage<T>(mut self, v: T) -> Self
20159 where
20160 T: std::convert::Into<crate::model::UsageMetrics>,
20161 {
20162 self.approximate_usage = std::option::Option::Some(v.into());
20163 self
20164 }
20165
20166 /// Sets or clears the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20167 ///
20168 /// # Example
20169 /// ```ignore,no_run
20170 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20171 /// use google_cloud_dataproc_v1::model::UsageMetrics;
20172 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(Some(UsageMetrics::default()/* use setters */));
20173 /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(None::<UsageMetrics>);
20174 /// ```
20175 pub fn set_or_clear_approximate_usage<T>(mut self, v: std::option::Option<T>) -> Self
20176 where
20177 T: std::convert::Into<crate::model::UsageMetrics>,
20178 {
20179 self.approximate_usage = v.map(|x| x.into());
20180 self
20181 }
20182
20183 /// Sets the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20184 ///
20185 /// # Example
20186 /// ```ignore,no_run
20187 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20188 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20189 /// let x = RuntimeInfo::new().set_current_usage(UsageSnapshot::default()/* use setters */);
20190 /// ```
20191 pub fn set_current_usage<T>(mut self, v: T) -> Self
20192 where
20193 T: std::convert::Into<crate::model::UsageSnapshot>,
20194 {
20195 self.current_usage = std::option::Option::Some(v.into());
20196 self
20197 }
20198
20199 /// Sets or clears the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20200 ///
20201 /// # Example
20202 /// ```ignore,no_run
20203 /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20204 /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20205 /// let x = RuntimeInfo::new().set_or_clear_current_usage(Some(UsageSnapshot::default()/* use setters */));
20206 /// let x = RuntimeInfo::new().set_or_clear_current_usage(None::<UsageSnapshot>);
20207 /// ```
20208 pub fn set_or_clear_current_usage<T>(mut self, v: std::option::Option<T>) -> Self
20209 where
20210 T: std::convert::Into<crate::model::UsageSnapshot>,
20211 {
20212 self.current_usage = v.map(|x| x.into());
20213 self
20214 }
20215}
20216
20217impl wkt::message::Message for RuntimeInfo {
20218 fn typename() -> &'static str {
20219 "type.googleapis.com/google.cloud.dataproc.v1.RuntimeInfo"
20220 }
20221}
20222
20223/// Usage metrics represent approximate total resources consumed by a workload.
20224#[derive(Clone, Default, PartialEq)]
20225#[non_exhaustive]
20226pub struct UsageMetrics {
20227 /// Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`)
20228 /// (see [Dataproc Serverless pricing]
20229 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20230 pub milli_dcu_seconds: i64,
20231
20232 /// Optional. Shuffle storage usage in (`GB` x `seconds`) (see
20233 /// [Dataproc Serverless pricing]
20234 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20235 pub shuffle_storage_gb_seconds: i64,
20236
20237 /// Optional. Accelerator usage in (`milliAccelerator` x `seconds`) (see
20238 /// [Dataproc Serverless pricing]
20239 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20240 pub milli_accelerator_seconds: i64,
20241
20242 /// Optional. Accelerator type being used, if any
20243 pub accelerator_type: std::string::String,
20244
20245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20246}
20247
20248impl UsageMetrics {
20249 pub fn new() -> Self {
20250 std::default::Default::default()
20251 }
20252
20253 /// Sets the value of [milli_dcu_seconds][crate::model::UsageMetrics::milli_dcu_seconds].
20254 ///
20255 /// # Example
20256 /// ```ignore,no_run
20257 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20258 /// let x = UsageMetrics::new().set_milli_dcu_seconds(42);
20259 /// ```
20260 pub fn set_milli_dcu_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20261 self.milli_dcu_seconds = v.into();
20262 self
20263 }
20264
20265 /// Sets the value of [shuffle_storage_gb_seconds][crate::model::UsageMetrics::shuffle_storage_gb_seconds].
20266 ///
20267 /// # Example
20268 /// ```ignore,no_run
20269 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20270 /// let x = UsageMetrics::new().set_shuffle_storage_gb_seconds(42);
20271 /// ```
20272 pub fn set_shuffle_storage_gb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20273 self.shuffle_storage_gb_seconds = v.into();
20274 self
20275 }
20276
20277 /// Sets the value of [milli_accelerator_seconds][crate::model::UsageMetrics::milli_accelerator_seconds].
20278 ///
20279 /// # Example
20280 /// ```ignore,no_run
20281 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20282 /// let x = UsageMetrics::new().set_milli_accelerator_seconds(42);
20283 /// ```
20284 pub fn set_milli_accelerator_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20285 self.milli_accelerator_seconds = v.into();
20286 self
20287 }
20288
20289 /// Sets the value of [accelerator_type][crate::model::UsageMetrics::accelerator_type].
20290 ///
20291 /// # Example
20292 /// ```ignore,no_run
20293 /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20294 /// let x = UsageMetrics::new().set_accelerator_type("example");
20295 /// ```
20296 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
20297 mut self,
20298 v: T,
20299 ) -> Self {
20300 self.accelerator_type = v.into();
20301 self
20302 }
20303}
20304
20305impl wkt::message::Message for UsageMetrics {
20306 fn typename() -> &'static str {
20307 "type.googleapis.com/google.cloud.dataproc.v1.UsageMetrics"
20308 }
20309}
20310
20311/// The usage snapshot represents the resources consumed by a workload at a
20312/// specified time.
20313#[derive(Clone, Default, PartialEq)]
20314#[non_exhaustive]
20315pub struct UsageSnapshot {
20316 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see
20317 /// [Dataproc Serverless pricing]
20318 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20319 pub milli_dcu: i64,
20320
20321 /// Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless
20322 /// pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
20323 pub shuffle_storage_gb: i64,
20324
20325 /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at
20326 /// premium tier (see [Dataproc Serverless pricing]
20327 /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20328 pub milli_dcu_premium: i64,
20329
20330 /// Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see
20331 /// [Dataproc Serverless pricing]
20332 /// (<https://cloud.google.com/dataproc-serverless/pricing>))
20333 pub shuffle_storage_gb_premium: i64,
20334
20335 /// Optional. Milli (one-thousandth) accelerator. (see [Dataproc
20336 /// Serverless pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
20337 pub milli_accelerator: i64,
20338
20339 /// Optional. Accelerator type being used, if any
20340 pub accelerator_type: std::string::String,
20341
20342 /// Optional. The timestamp of the usage snapshot.
20343 pub snapshot_time: std::option::Option<wkt::Timestamp>,
20344
20345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20346}
20347
20348impl UsageSnapshot {
20349 pub fn new() -> Self {
20350 std::default::Default::default()
20351 }
20352
20353 /// Sets the value of [milli_dcu][crate::model::UsageSnapshot::milli_dcu].
20354 ///
20355 /// # Example
20356 /// ```ignore,no_run
20357 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20358 /// let x = UsageSnapshot::new().set_milli_dcu(42);
20359 /// ```
20360 pub fn set_milli_dcu<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20361 self.milli_dcu = v.into();
20362 self
20363 }
20364
20365 /// Sets the value of [shuffle_storage_gb][crate::model::UsageSnapshot::shuffle_storage_gb].
20366 ///
20367 /// # Example
20368 /// ```ignore,no_run
20369 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20370 /// let x = UsageSnapshot::new().set_shuffle_storage_gb(42);
20371 /// ```
20372 pub fn set_shuffle_storage_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20373 self.shuffle_storage_gb = v.into();
20374 self
20375 }
20376
20377 /// Sets the value of [milli_dcu_premium][crate::model::UsageSnapshot::milli_dcu_premium].
20378 ///
20379 /// # Example
20380 /// ```ignore,no_run
20381 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20382 /// let x = UsageSnapshot::new().set_milli_dcu_premium(42);
20383 /// ```
20384 pub fn set_milli_dcu_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20385 self.milli_dcu_premium = v.into();
20386 self
20387 }
20388
20389 /// Sets the value of [shuffle_storage_gb_premium][crate::model::UsageSnapshot::shuffle_storage_gb_premium].
20390 ///
20391 /// # Example
20392 /// ```ignore,no_run
20393 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20394 /// let x = UsageSnapshot::new().set_shuffle_storage_gb_premium(42);
20395 /// ```
20396 pub fn set_shuffle_storage_gb_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20397 self.shuffle_storage_gb_premium = v.into();
20398 self
20399 }
20400
20401 /// Sets the value of [milli_accelerator][crate::model::UsageSnapshot::milli_accelerator].
20402 ///
20403 /// # Example
20404 /// ```ignore,no_run
20405 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20406 /// let x = UsageSnapshot::new().set_milli_accelerator(42);
20407 /// ```
20408 pub fn set_milli_accelerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20409 self.milli_accelerator = v.into();
20410 self
20411 }
20412
20413 /// Sets the value of [accelerator_type][crate::model::UsageSnapshot::accelerator_type].
20414 ///
20415 /// # Example
20416 /// ```ignore,no_run
20417 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20418 /// let x = UsageSnapshot::new().set_accelerator_type("example");
20419 /// ```
20420 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
20421 mut self,
20422 v: T,
20423 ) -> Self {
20424 self.accelerator_type = v.into();
20425 self
20426 }
20427
20428 /// Sets the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
20429 ///
20430 /// # Example
20431 /// ```ignore,no_run
20432 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20433 /// use wkt::Timestamp;
20434 /// let x = UsageSnapshot::new().set_snapshot_time(Timestamp::default()/* use setters */);
20435 /// ```
20436 pub fn set_snapshot_time<T>(mut self, v: T) -> Self
20437 where
20438 T: std::convert::Into<wkt::Timestamp>,
20439 {
20440 self.snapshot_time = std::option::Option::Some(v.into());
20441 self
20442 }
20443
20444 /// Sets or clears the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
20445 ///
20446 /// # Example
20447 /// ```ignore,no_run
20448 /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20449 /// use wkt::Timestamp;
20450 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
20451 /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(None::<Timestamp>);
20452 /// ```
20453 pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
20454 where
20455 T: std::convert::Into<wkt::Timestamp>,
20456 {
20457 self.snapshot_time = v.map(|x| x.into());
20458 self
20459 }
20460}
20461
20462impl wkt::message::Message for UsageSnapshot {
20463 fn typename() -> &'static str {
20464 "type.googleapis.com/google.cloud.dataproc.v1.UsageSnapshot"
20465 }
20466}
20467
20468/// The cluster's GKE config.
20469#[derive(Clone, Default, PartialEq)]
20470#[non_exhaustive]
20471pub struct GkeClusterConfig {
20472 /// Optional. A target GKE cluster to deploy to. It must be in the same project
20473 /// and region as the Dataproc cluster (the GKE cluster can be zonal or
20474 /// regional). Format:
20475 /// 'projects/{project}/locations/{location}/clusters/{cluster_id}'
20476 pub gke_cluster_target: std::string::String,
20477
20478 /// Optional. GKE node pools where workloads will be scheduled. At least one
20479 /// node pool must be assigned the `DEFAULT`
20480 /// [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role].
20481 /// If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT`
20482 /// `GkeNodePoolTarget`. Each role can be given to only one
20483 /// `GkeNodePoolTarget`. All node pools must have the same location settings.
20484 ///
20485 /// [google.cloud.dataproc.v1.GkeNodePoolTarget.Role]: crate::model::gke_node_pool_target::Role
20486 pub node_pool_target: std::vec::Vec<crate::model::GkeNodePoolTarget>,
20487
20488 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20489}
20490
20491impl GkeClusterConfig {
20492 pub fn new() -> Self {
20493 std::default::Default::default()
20494 }
20495
20496 /// Sets the value of [gke_cluster_target][crate::model::GkeClusterConfig::gke_cluster_target].
20497 ///
20498 /// # Example
20499 /// ```ignore,no_run
20500 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
20501 /// let x = GkeClusterConfig::new().set_gke_cluster_target("example");
20502 /// ```
20503 pub fn set_gke_cluster_target<T: std::convert::Into<std::string::String>>(
20504 mut self,
20505 v: T,
20506 ) -> Self {
20507 self.gke_cluster_target = v.into();
20508 self
20509 }
20510
20511 /// Sets the value of [node_pool_target][crate::model::GkeClusterConfig::node_pool_target].
20512 ///
20513 /// # Example
20514 /// ```ignore,no_run
20515 /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
20516 /// use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20517 /// let x = GkeClusterConfig::new()
20518 /// .set_node_pool_target([
20519 /// GkeNodePoolTarget::default()/* use setters */,
20520 /// GkeNodePoolTarget::default()/* use (different) setters */,
20521 /// ]);
20522 /// ```
20523 pub fn set_node_pool_target<T, V>(mut self, v: T) -> Self
20524 where
20525 T: std::iter::IntoIterator<Item = V>,
20526 V: std::convert::Into<crate::model::GkeNodePoolTarget>,
20527 {
20528 use std::iter::Iterator;
20529 self.node_pool_target = v.into_iter().map(|i| i.into()).collect();
20530 self
20531 }
20532}
20533
20534impl wkt::message::Message for GkeClusterConfig {
20535 fn typename() -> &'static str {
20536 "type.googleapis.com/google.cloud.dataproc.v1.GkeClusterConfig"
20537 }
20538}
20539
20540/// The configuration for running the Dataproc cluster on Kubernetes.
20541#[derive(Clone, Default, PartialEq)]
20542#[non_exhaustive]
20543pub struct KubernetesClusterConfig {
20544 /// Optional. A namespace within the Kubernetes cluster to deploy into. If this
20545 /// namespace does not exist, it is created. If it exists, Dataproc verifies
20546 /// that another Dataproc VirtualCluster is not installed into it. If not
20547 /// specified, the name of the Dataproc Cluster is used.
20548 pub kubernetes_namespace: std::string::String,
20549
20550 /// Optional. The software configuration for this Dataproc cluster running on
20551 /// Kubernetes.
20552 pub kubernetes_software_config: std::option::Option<crate::model::KubernetesSoftwareConfig>,
20553
20554 pub config: std::option::Option<crate::model::kubernetes_cluster_config::Config>,
20555
20556 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20557}
20558
20559impl KubernetesClusterConfig {
20560 pub fn new() -> Self {
20561 std::default::Default::default()
20562 }
20563
20564 /// Sets the value of [kubernetes_namespace][crate::model::KubernetesClusterConfig::kubernetes_namespace].
20565 ///
20566 /// # Example
20567 /// ```ignore,no_run
20568 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20569 /// let x = KubernetesClusterConfig::new().set_kubernetes_namespace("example");
20570 /// ```
20571 pub fn set_kubernetes_namespace<T: std::convert::Into<std::string::String>>(
20572 mut self,
20573 v: T,
20574 ) -> Self {
20575 self.kubernetes_namespace = v.into();
20576 self
20577 }
20578
20579 /// Sets the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
20580 ///
20581 /// # Example
20582 /// ```ignore,no_run
20583 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20584 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20585 /// let x = KubernetesClusterConfig::new().set_kubernetes_software_config(KubernetesSoftwareConfig::default()/* use setters */);
20586 /// ```
20587 pub fn set_kubernetes_software_config<T>(mut self, v: T) -> Self
20588 where
20589 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
20590 {
20591 self.kubernetes_software_config = std::option::Option::Some(v.into());
20592 self
20593 }
20594
20595 /// Sets or clears the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
20596 ///
20597 /// # Example
20598 /// ```ignore,no_run
20599 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20600 /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20601 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(Some(KubernetesSoftwareConfig::default()/* use setters */));
20602 /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(None::<KubernetesSoftwareConfig>);
20603 /// ```
20604 pub fn set_or_clear_kubernetes_software_config<T>(mut self, v: std::option::Option<T>) -> Self
20605 where
20606 T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
20607 {
20608 self.kubernetes_software_config = v.map(|x| x.into());
20609 self
20610 }
20611
20612 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config].
20613 ///
20614 /// Note that all the setters affecting `config` are mutually
20615 /// exclusive.
20616 ///
20617 /// # Example
20618 /// ```ignore,no_run
20619 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20620 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
20621 /// let x = KubernetesClusterConfig::new().set_config(Some(
20622 /// google_cloud_dataproc_v1::model::kubernetes_cluster_config::Config::GkeClusterConfig(GkeClusterConfig::default().into())));
20623 /// ```
20624 pub fn set_config<
20625 T: std::convert::Into<std::option::Option<crate::model::kubernetes_cluster_config::Config>>,
20626 >(
20627 mut self,
20628 v: T,
20629 ) -> Self {
20630 self.config = v.into();
20631 self
20632 }
20633
20634 /// The value of [config][crate::model::KubernetesClusterConfig::config]
20635 /// if it holds a `GkeClusterConfig`, `None` if the field is not set or
20636 /// holds a different branch.
20637 pub fn gke_cluster_config(
20638 &self,
20639 ) -> std::option::Option<&std::boxed::Box<crate::model::GkeClusterConfig>> {
20640 #[allow(unreachable_patterns)]
20641 self.config.as_ref().and_then(|v| match v {
20642 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v) => {
20643 std::option::Option::Some(v)
20644 }
20645 _ => std::option::Option::None,
20646 })
20647 }
20648
20649 /// Sets the value of [config][crate::model::KubernetesClusterConfig::config]
20650 /// to hold a `GkeClusterConfig`.
20651 ///
20652 /// Note that all the setters affecting `config` are
20653 /// mutually exclusive.
20654 ///
20655 /// # Example
20656 /// ```ignore,no_run
20657 /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20658 /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
20659 /// let x = KubernetesClusterConfig::new().set_gke_cluster_config(GkeClusterConfig::default()/* use setters */);
20660 /// assert!(x.gke_cluster_config().is_some());
20661 /// ```
20662 pub fn set_gke_cluster_config<
20663 T: std::convert::Into<std::boxed::Box<crate::model::GkeClusterConfig>>,
20664 >(
20665 mut self,
20666 v: T,
20667 ) -> Self {
20668 self.config = std::option::Option::Some(
20669 crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v.into()),
20670 );
20671 self
20672 }
20673}
20674
20675impl wkt::message::Message for KubernetesClusterConfig {
20676 fn typename() -> &'static str {
20677 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesClusterConfig"
20678 }
20679}
20680
20681/// Defines additional types related to [KubernetesClusterConfig].
20682pub mod kubernetes_cluster_config {
20683 #[allow(unused_imports)]
20684 use super::*;
20685
20686 #[derive(Clone, Debug, PartialEq)]
20687 #[non_exhaustive]
20688 pub enum Config {
20689 /// Required. The configuration for running the Dataproc cluster on GKE.
20690 GkeClusterConfig(std::boxed::Box<crate::model::GkeClusterConfig>),
20691 }
20692}
20693
20694/// The software configuration for this Dataproc cluster running on Kubernetes.
20695#[derive(Clone, Default, PartialEq)]
20696#[non_exhaustive]
20697pub struct KubernetesSoftwareConfig {
20698 /// The components that should be installed in this Dataproc cluster. The key
20699 /// must be a string from the KubernetesComponent enumeration. The value is
20700 /// the version of the software to be installed.
20701 /// At least one entry must be specified.
20702 pub component_version: std::collections::HashMap<std::string::String, std::string::String>,
20703
20704 /// The properties to set on daemon config files.
20705 ///
20706 /// Property keys are specified in `prefix:property` format, for example
20707 /// `spark:spark.kubernetes.container.image`. The following are supported
20708 /// prefixes and their mappings:
20709 ///
20710 /// * spark: `spark-defaults.conf`
20711 ///
20712 /// For more information, see [Cluster
20713 /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
20714 pub properties: std::collections::HashMap<std::string::String, std::string::String>,
20715
20716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20717}
20718
20719impl KubernetesSoftwareConfig {
20720 pub fn new() -> Self {
20721 std::default::Default::default()
20722 }
20723
20724 /// Sets the value of [component_version][crate::model::KubernetesSoftwareConfig::component_version].
20725 ///
20726 /// # Example
20727 /// ```ignore,no_run
20728 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20729 /// let x = KubernetesSoftwareConfig::new().set_component_version([
20730 /// ("key0", "abc"),
20731 /// ("key1", "xyz"),
20732 /// ]);
20733 /// ```
20734 pub fn set_component_version<T, K, V>(mut self, v: T) -> Self
20735 where
20736 T: std::iter::IntoIterator<Item = (K, V)>,
20737 K: std::convert::Into<std::string::String>,
20738 V: std::convert::Into<std::string::String>,
20739 {
20740 use std::iter::Iterator;
20741 self.component_version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20742 self
20743 }
20744
20745 /// Sets the value of [properties][crate::model::KubernetesSoftwareConfig::properties].
20746 ///
20747 /// # Example
20748 /// ```ignore,no_run
20749 /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20750 /// let x = KubernetesSoftwareConfig::new().set_properties([
20751 /// ("key0", "abc"),
20752 /// ("key1", "xyz"),
20753 /// ]);
20754 /// ```
20755 pub fn set_properties<T, K, V>(mut self, v: T) -> Self
20756 where
20757 T: std::iter::IntoIterator<Item = (K, V)>,
20758 K: std::convert::Into<std::string::String>,
20759 V: std::convert::Into<std::string::String>,
20760 {
20761 use std::iter::Iterator;
20762 self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20763 self
20764 }
20765}
20766
20767impl wkt::message::Message for KubernetesSoftwareConfig {
20768 fn typename() -> &'static str {
20769 "type.googleapis.com/google.cloud.dataproc.v1.KubernetesSoftwareConfig"
20770 }
20771}
20772
20773/// GKE node pools that Dataproc workloads run on.
20774#[derive(Clone, Default, PartialEq)]
20775#[non_exhaustive]
20776pub struct GkeNodePoolTarget {
20777 /// Required. The target GKE node pool.
20778 /// Format:
20779 /// 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}'
20780 pub node_pool: std::string::String,
20781
20782 /// Required. The roles associated with the GKE node pool.
20783 pub roles: std::vec::Vec<crate::model::gke_node_pool_target::Role>,
20784
20785 /// Input only. The configuration for the GKE node pool.
20786 ///
20787 /// If specified, Dataproc attempts to create a node pool with the
20788 /// specified shape. If one with the same name already exists, it is
20789 /// verified against all specified fields. If a field differs, the
20790 /// virtual cluster creation will fail.
20791 ///
20792 /// If omitted, any node pool with the specified name is used. If a
20793 /// node pool with the specified name does not exist, Dataproc create a
20794 /// node pool with default values.
20795 ///
20796 /// This is an input only field. It will not be returned by the API.
20797 pub node_pool_config: std::option::Option<crate::model::GkeNodePoolConfig>,
20798
20799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20800}
20801
20802impl GkeNodePoolTarget {
20803 pub fn new() -> Self {
20804 std::default::Default::default()
20805 }
20806
20807 /// Sets the value of [node_pool][crate::model::GkeNodePoolTarget::node_pool].
20808 ///
20809 /// # Example
20810 /// ```ignore,no_run
20811 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20812 /// let x = GkeNodePoolTarget::new().set_node_pool("example");
20813 /// ```
20814 pub fn set_node_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20815 self.node_pool = v.into();
20816 self
20817 }
20818
20819 /// Sets the value of [roles][crate::model::GkeNodePoolTarget::roles].
20820 ///
20821 /// # Example
20822 /// ```ignore,no_run
20823 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20824 /// use google_cloud_dataproc_v1::model::gke_node_pool_target::Role;
20825 /// let x = GkeNodePoolTarget::new().set_roles([
20826 /// Role::Default,
20827 /// Role::Controller,
20828 /// Role::SparkDriver,
20829 /// ]);
20830 /// ```
20831 pub fn set_roles<T, V>(mut self, v: T) -> Self
20832 where
20833 T: std::iter::IntoIterator<Item = V>,
20834 V: std::convert::Into<crate::model::gke_node_pool_target::Role>,
20835 {
20836 use std::iter::Iterator;
20837 self.roles = v.into_iter().map(|i| i.into()).collect();
20838 self
20839 }
20840
20841 /// Sets the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
20842 ///
20843 /// # Example
20844 /// ```ignore,no_run
20845 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20846 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
20847 /// let x = GkeNodePoolTarget::new().set_node_pool_config(GkeNodePoolConfig::default()/* use setters */);
20848 /// ```
20849 pub fn set_node_pool_config<T>(mut self, v: T) -> Self
20850 where
20851 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
20852 {
20853 self.node_pool_config = std::option::Option::Some(v.into());
20854 self
20855 }
20856
20857 /// Sets or clears the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
20858 ///
20859 /// # Example
20860 /// ```ignore,no_run
20861 /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20862 /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
20863 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(Some(GkeNodePoolConfig::default()/* use setters */));
20864 /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(None::<GkeNodePoolConfig>);
20865 /// ```
20866 pub fn set_or_clear_node_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
20867 where
20868 T: std::convert::Into<crate::model::GkeNodePoolConfig>,
20869 {
20870 self.node_pool_config = v.map(|x| x.into());
20871 self
20872 }
20873}
20874
20875impl wkt::message::Message for GkeNodePoolTarget {
20876 fn typename() -> &'static str {
20877 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolTarget"
20878 }
20879}
20880
20881/// Defines additional types related to [GkeNodePoolTarget].
20882pub mod gke_node_pool_target {
20883 #[allow(unused_imports)]
20884 use super::*;
20885
20886 /// `Role` specifies the tasks that will run on the node pool. Roles can be
20887 /// specific to workloads. Exactly one
20888 /// [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the
20889 /// virtual cluster must have the `DEFAULT` role, which is used to run all
20890 /// workloads that are not associated with a node pool.
20891 ///
20892 /// [google.cloud.dataproc.v1.GkeNodePoolTarget]: crate::model::GkeNodePoolTarget
20893 ///
20894 /// # Working with unknown values
20895 ///
20896 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20897 /// additional enum variants at any time. Adding new variants is not considered
20898 /// a breaking change. Applications should write their code in anticipation of:
20899 ///
20900 /// - New values appearing in future releases of the client library, **and**
20901 /// - New values received dynamically, without application changes.
20902 ///
20903 /// Please consult the [Working with enums] section in the user guide for some
20904 /// guidelines.
20905 ///
20906 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20907 #[derive(Clone, Debug, PartialEq)]
20908 #[non_exhaustive]
20909 pub enum Role {
20910 /// Role is unspecified.
20911 Unspecified,
20912 /// At least one node pool must have the `DEFAULT` role.
20913 /// Work assigned to a role that is not associated with a node pool
20914 /// is assigned to the node pool with the `DEFAULT` role. For example,
20915 /// work assigned to the `CONTROLLER` role will be assigned to the node pool
20916 /// with the `DEFAULT` role if no node pool has the `CONTROLLER` role.
20917 Default,
20918 /// Run work associated with the Dataproc control plane (for example,
20919 /// controllers and webhooks). Very low resource requirements.
20920 Controller,
20921 /// Run work associated with a Spark driver of a job.
20922 SparkDriver,
20923 /// Run work associated with a Spark executor of a job.
20924 SparkExecutor,
20925 /// If set, the enum was initialized with an unknown value.
20926 ///
20927 /// Applications can examine the value using [Role::value] or
20928 /// [Role::name].
20929 UnknownValue(role::UnknownValue),
20930 }
20931
20932 #[doc(hidden)]
20933 pub mod role {
20934 #[allow(unused_imports)]
20935 use super::*;
20936 #[derive(Clone, Debug, PartialEq)]
20937 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20938 }
20939
20940 impl Role {
20941 /// Gets the enum value.
20942 ///
20943 /// Returns `None` if the enum contains an unknown value deserialized from
20944 /// the string representation of enums.
20945 pub fn value(&self) -> std::option::Option<i32> {
20946 match self {
20947 Self::Unspecified => std::option::Option::Some(0),
20948 Self::Default => std::option::Option::Some(1),
20949 Self::Controller => std::option::Option::Some(2),
20950 Self::SparkDriver => std::option::Option::Some(3),
20951 Self::SparkExecutor => std::option::Option::Some(4),
20952 Self::UnknownValue(u) => u.0.value(),
20953 }
20954 }
20955
20956 /// Gets the enum value as a string.
20957 ///
20958 /// Returns `None` if the enum contains an unknown value deserialized from
20959 /// the integer representation of enums.
20960 pub fn name(&self) -> std::option::Option<&str> {
20961 match self {
20962 Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
20963 Self::Default => std::option::Option::Some("DEFAULT"),
20964 Self::Controller => std::option::Option::Some("CONTROLLER"),
20965 Self::SparkDriver => std::option::Option::Some("SPARK_DRIVER"),
20966 Self::SparkExecutor => std::option::Option::Some("SPARK_EXECUTOR"),
20967 Self::UnknownValue(u) => u.0.name(),
20968 }
20969 }
20970 }
20971
20972 impl std::default::Default for Role {
20973 fn default() -> Self {
20974 use std::convert::From;
20975 Self::from(0)
20976 }
20977 }
20978
20979 impl std::fmt::Display for Role {
20980 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20981 wkt::internal::display_enum(f, self.name(), self.value())
20982 }
20983 }
20984
20985 impl std::convert::From<i32> for Role {
20986 fn from(value: i32) -> Self {
20987 match value {
20988 0 => Self::Unspecified,
20989 1 => Self::Default,
20990 2 => Self::Controller,
20991 3 => Self::SparkDriver,
20992 4 => Self::SparkExecutor,
20993 _ => Self::UnknownValue(role::UnknownValue(
20994 wkt::internal::UnknownEnumValue::Integer(value),
20995 )),
20996 }
20997 }
20998 }
20999
21000 impl std::convert::From<&str> for Role {
21001 fn from(value: &str) -> Self {
21002 use std::string::ToString;
21003 match value {
21004 "ROLE_UNSPECIFIED" => Self::Unspecified,
21005 "DEFAULT" => Self::Default,
21006 "CONTROLLER" => Self::Controller,
21007 "SPARK_DRIVER" => Self::SparkDriver,
21008 "SPARK_EXECUTOR" => Self::SparkExecutor,
21009 _ => Self::UnknownValue(role::UnknownValue(
21010 wkt::internal::UnknownEnumValue::String(value.to_string()),
21011 )),
21012 }
21013 }
21014 }
21015
21016 impl serde::ser::Serialize for Role {
21017 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21018 where
21019 S: serde::Serializer,
21020 {
21021 match self {
21022 Self::Unspecified => serializer.serialize_i32(0),
21023 Self::Default => serializer.serialize_i32(1),
21024 Self::Controller => serializer.serialize_i32(2),
21025 Self::SparkDriver => serializer.serialize_i32(3),
21026 Self::SparkExecutor => serializer.serialize_i32(4),
21027 Self::UnknownValue(u) => u.0.serialize(serializer),
21028 }
21029 }
21030 }
21031
21032 impl<'de> serde::de::Deserialize<'de> for Role {
21033 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21034 where
21035 D: serde::Deserializer<'de>,
21036 {
21037 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
21038 ".google.cloud.dataproc.v1.GkeNodePoolTarget.Role",
21039 ))
21040 }
21041 }
21042}
21043
21044/// The configuration of a GKE node pool used by a [Dataproc-on-GKE
21045/// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster).
21046#[derive(Clone, Default, PartialEq)]
21047#[non_exhaustive]
21048pub struct GkeNodePoolConfig {
21049 /// Optional. The node pool configuration.
21050 pub config: std::option::Option<crate::model::gke_node_pool_config::GkeNodeConfig>,
21051
21052 /// Optional. The list of Compute Engine
21053 /// [zones](https://cloud.google.com/compute/docs/zones#available) where
21054 /// node pool nodes associated with a Dataproc on GKE virtual cluster
21055 /// will be located.
21056 ///
21057 /// **Note:** All node pools associated with a virtual cluster
21058 /// must be located in the same region as the virtual cluster, and they must
21059 /// be located in the same zone within that region.
21060 ///
21061 /// If a location is not specified during node pool creation, Dataproc on GKE
21062 /// will choose the zone.
21063 pub locations: std::vec::Vec<std::string::String>,
21064
21065 /// Optional. The autoscaler configuration for this node pool. The autoscaler
21066 /// is enabled only when a valid configuration is present.
21067 pub autoscaling:
21068 std::option::Option<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21069
21070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21071}
21072
21073impl GkeNodePoolConfig {
21074 pub fn new() -> Self {
21075 std::default::Default::default()
21076 }
21077
21078 /// Sets the value of [config][crate::model::GkeNodePoolConfig::config].
21079 ///
21080 /// # Example
21081 /// ```ignore,no_run
21082 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21083 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21084 /// let x = GkeNodePoolConfig::new().set_config(GkeNodeConfig::default()/* use setters */);
21085 /// ```
21086 pub fn set_config<T>(mut self, v: T) -> Self
21087 where
21088 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21089 {
21090 self.config = std::option::Option::Some(v.into());
21091 self
21092 }
21093
21094 /// Sets or clears the value of [config][crate::model::GkeNodePoolConfig::config].
21095 ///
21096 /// # Example
21097 /// ```ignore,no_run
21098 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21099 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21100 /// let x = GkeNodePoolConfig::new().set_or_clear_config(Some(GkeNodeConfig::default()/* use setters */));
21101 /// let x = GkeNodePoolConfig::new().set_or_clear_config(None::<GkeNodeConfig>);
21102 /// ```
21103 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
21104 where
21105 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21106 {
21107 self.config = v.map(|x| x.into());
21108 self
21109 }
21110
21111 /// Sets the value of [locations][crate::model::GkeNodePoolConfig::locations].
21112 ///
21113 /// # Example
21114 /// ```ignore,no_run
21115 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21116 /// let x = GkeNodePoolConfig::new().set_locations(["a", "b", "c"]);
21117 /// ```
21118 pub fn set_locations<T, V>(mut self, v: T) -> Self
21119 where
21120 T: std::iter::IntoIterator<Item = V>,
21121 V: std::convert::Into<std::string::String>,
21122 {
21123 use std::iter::Iterator;
21124 self.locations = v.into_iter().map(|i| i.into()).collect();
21125 self
21126 }
21127
21128 /// Sets the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21129 ///
21130 /// # Example
21131 /// ```ignore,no_run
21132 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21133 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21134 /// let x = GkeNodePoolConfig::new().set_autoscaling(GkeNodePoolAutoscalingConfig::default()/* use setters */);
21135 /// ```
21136 pub fn set_autoscaling<T>(mut self, v: T) -> Self
21137 where
21138 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21139 {
21140 self.autoscaling = std::option::Option::Some(v.into());
21141 self
21142 }
21143
21144 /// Sets or clears the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21145 ///
21146 /// # Example
21147 /// ```ignore,no_run
21148 /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21149 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21150 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(Some(GkeNodePoolAutoscalingConfig::default()/* use setters */));
21151 /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(None::<GkeNodePoolAutoscalingConfig>);
21152 /// ```
21153 pub fn set_or_clear_autoscaling<T>(mut self, v: std::option::Option<T>) -> Self
21154 where
21155 T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21156 {
21157 self.autoscaling = v.map(|x| x.into());
21158 self
21159 }
21160}
21161
21162impl wkt::message::Message for GkeNodePoolConfig {
21163 fn typename() -> &'static str {
21164 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig"
21165 }
21166}
21167
21168/// Defines additional types related to [GkeNodePoolConfig].
21169pub mod gke_node_pool_config {
21170 #[allow(unused_imports)]
21171 use super::*;
21172
21173 /// Parameters that describe cluster nodes.
21174 #[derive(Clone, Default, PartialEq)]
21175 #[non_exhaustive]
21176 pub struct GkeNodeConfig {
21177 /// Optional. The name of a Compute Engine [machine
21178 /// type](https://cloud.google.com/compute/docs/machine-types).
21179 pub machine_type: std::string::String,
21180
21181 /// Optional. The number of local SSD disks to attach to the node, which is
21182 /// limited by the maximum number of disks allowable per zone (see [Adding
21183 /// Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)).
21184 pub local_ssd_count: i32,
21185
21186 /// Optional. Whether the nodes are created as legacy [preemptible VM
21187 /// instances] (<https://cloud.google.com/compute/docs/instances/preemptible>).
21188 /// Also see
21189 /// [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]
21190 /// VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot
21191 /// preemptible nodes cannot be used in a node pool with the `CONTROLLER`
21192 /// [role]
21193 /// (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21194 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21195 /// DEFAULT node pool will assume the CONTROLLER role).
21196 ///
21197 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]: crate::model::gke_node_pool_config::GkeNodeConfig::spot
21198 pub preemptible: bool,
21199
21200 /// Optional. A list of [hardware
21201 /// accelerators](https://cloud.google.com/compute/docs/gpus) to attach to
21202 /// each node.
21203 pub accelerators:
21204 std::vec::Vec<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21205
21206 /// Optional. [Minimum CPU
21207 /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
21208 /// to be used by this instance. The instance may be scheduled on the
21209 /// specified or a newer CPU platform. Specify the friendly names of CPU
21210 /// platforms, such as "Intel Haswell"` or Intel Sandy Bridge".
21211 pub min_cpu_platform: std::string::String,
21212
21213 /// Optional. The [Customer Managed Encryption Key (CMEK)]
21214 /// (<https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek>)
21215 /// used to encrypt the boot disk attached to each node in the node pool.
21216 /// Specify the key using the following format:
21217 /// \<code\>projects/\<var\>KEY_PROJECT_ID\</var\>/locations/\<var\>LOCATION\</var\>/keyRings/\<var\>RING_NAME\</var\>/cryptoKeys/\<var\>KEY_NAME\</var\>\</code\>.
21218 pub boot_disk_kms_key: std::string::String,
21219
21220 /// Optional. Whether the nodes are created as [Spot VM instances]
21221 /// (<https://cloud.google.com/compute/docs/instances/spot>).
21222 /// Spot VMs are the latest update to legacy
21223 /// [preemptible
21224 /// VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible].
21225 /// Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible
21226 /// nodes cannot be used in a node pool with the `CONTROLLER`
21227 /// [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21228 /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21229 /// DEFAULT node pool will assume the CONTROLLER role).
21230 ///
21231 /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]: crate::model::gke_node_pool_config::GkeNodeConfig::preemptible
21232 pub spot: bool,
21233
21234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21235 }
21236
21237 impl GkeNodeConfig {
21238 pub fn new() -> Self {
21239 std::default::Default::default()
21240 }
21241
21242 /// Sets the value of [machine_type][crate::model::gke_node_pool_config::GkeNodeConfig::machine_type].
21243 ///
21244 /// # Example
21245 /// ```ignore,no_run
21246 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21247 /// let x = GkeNodeConfig::new().set_machine_type("example");
21248 /// ```
21249 pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
21250 mut self,
21251 v: T,
21252 ) -> Self {
21253 self.machine_type = v.into();
21254 self
21255 }
21256
21257 /// Sets the value of [local_ssd_count][crate::model::gke_node_pool_config::GkeNodeConfig::local_ssd_count].
21258 ///
21259 /// # Example
21260 /// ```ignore,no_run
21261 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21262 /// let x = GkeNodeConfig::new().set_local_ssd_count(42);
21263 /// ```
21264 pub fn set_local_ssd_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21265 self.local_ssd_count = v.into();
21266 self
21267 }
21268
21269 /// Sets the value of [preemptible][crate::model::gke_node_pool_config::GkeNodeConfig::preemptible].
21270 ///
21271 /// # Example
21272 /// ```ignore,no_run
21273 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21274 /// let x = GkeNodeConfig::new().set_preemptible(true);
21275 /// ```
21276 pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21277 self.preemptible = v.into();
21278 self
21279 }
21280
21281 /// Sets the value of [accelerators][crate::model::gke_node_pool_config::GkeNodeConfig::accelerators].
21282 ///
21283 /// # Example
21284 /// ```ignore,no_run
21285 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21286 /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21287 /// let x = GkeNodeConfig::new()
21288 /// .set_accelerators([
21289 /// GkeNodePoolAcceleratorConfig::default()/* use setters */,
21290 /// GkeNodePoolAcceleratorConfig::default()/* use (different) setters */,
21291 /// ]);
21292 /// ```
21293 pub fn set_accelerators<T, V>(mut self, v: T) -> Self
21294 where
21295 T: std::iter::IntoIterator<Item = V>,
21296 V: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21297 {
21298 use std::iter::Iterator;
21299 self.accelerators = v.into_iter().map(|i| i.into()).collect();
21300 self
21301 }
21302
21303 /// Sets the value of [min_cpu_platform][crate::model::gke_node_pool_config::GkeNodeConfig::min_cpu_platform].
21304 ///
21305 /// # Example
21306 /// ```ignore,no_run
21307 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21308 /// let x = GkeNodeConfig::new().set_min_cpu_platform("example");
21309 /// ```
21310 pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
21311 mut self,
21312 v: T,
21313 ) -> Self {
21314 self.min_cpu_platform = v.into();
21315 self
21316 }
21317
21318 /// Sets the value of [boot_disk_kms_key][crate::model::gke_node_pool_config::GkeNodeConfig::boot_disk_kms_key].
21319 ///
21320 /// # Example
21321 /// ```ignore,no_run
21322 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21323 /// let x = GkeNodeConfig::new().set_boot_disk_kms_key("example");
21324 /// ```
21325 pub fn set_boot_disk_kms_key<T: std::convert::Into<std::string::String>>(
21326 mut self,
21327 v: T,
21328 ) -> Self {
21329 self.boot_disk_kms_key = v.into();
21330 self
21331 }
21332
21333 /// Sets the value of [spot][crate::model::gke_node_pool_config::GkeNodeConfig::spot].
21334 ///
21335 /// # Example
21336 /// ```ignore,no_run
21337 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21338 /// let x = GkeNodeConfig::new().set_spot(true);
21339 /// ```
21340 pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21341 self.spot = v.into();
21342 self
21343 }
21344 }
21345
21346 impl wkt::message::Message for GkeNodeConfig {
21347 fn typename() -> &'static str {
21348 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig"
21349 }
21350 }
21351
21352 /// A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request
21353 /// for a node pool.
21354 #[derive(Clone, Default, PartialEq)]
21355 #[non_exhaustive]
21356 pub struct GkeNodePoolAcceleratorConfig {
21357 /// The number of accelerator cards exposed to an instance.
21358 pub accelerator_count: i64,
21359
21360 /// The accelerator type resource namename (see GPUs on Compute Engine).
21361 pub accelerator_type: std::string::String,
21362
21363 /// Size of partitions to create on the GPU. Valid values are described in
21364 /// the NVIDIA [mig user
21365 /// guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
21366 pub gpu_partition_size: std::string::String,
21367
21368 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21369 }
21370
21371 impl GkeNodePoolAcceleratorConfig {
21372 pub fn new() -> Self {
21373 std::default::Default::default()
21374 }
21375
21376 /// Sets the value of [accelerator_count][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_count].
21377 ///
21378 /// # Example
21379 /// ```ignore,no_run
21380 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21381 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_count(42);
21382 /// ```
21383 pub fn set_accelerator_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21384 self.accelerator_count = v.into();
21385 self
21386 }
21387
21388 /// Sets the value of [accelerator_type][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_type].
21389 ///
21390 /// # Example
21391 /// ```ignore,no_run
21392 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21393 /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_type("example");
21394 /// ```
21395 pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21396 mut self,
21397 v: T,
21398 ) -> Self {
21399 self.accelerator_type = v.into();
21400 self
21401 }
21402
21403 /// Sets the value of [gpu_partition_size][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::gpu_partition_size].
21404 ///
21405 /// # Example
21406 /// ```ignore,no_run
21407 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21408 /// let x = GkeNodePoolAcceleratorConfig::new().set_gpu_partition_size("example");
21409 /// ```
21410 pub fn set_gpu_partition_size<T: std::convert::Into<std::string::String>>(
21411 mut self,
21412 v: T,
21413 ) -> Self {
21414 self.gpu_partition_size = v.into();
21415 self
21416 }
21417 }
21418
21419 impl wkt::message::Message for GkeNodePoolAcceleratorConfig {
21420 fn typename() -> &'static str {
21421 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAcceleratorConfig"
21422 }
21423 }
21424
21425 /// GkeNodePoolAutoscaling contains information the cluster autoscaler needs to
21426 /// adjust the size of the node pool to the current cluster usage.
21427 #[derive(Clone, Default, PartialEq)]
21428 #[non_exhaustive]
21429 pub struct GkeNodePoolAutoscalingConfig {
21430 /// The minimum number of nodes in the node pool. Must be >= 0 and <=
21431 /// max_node_count.
21432 pub min_node_count: i32,
21433
21434 /// The maximum number of nodes in the node pool. Must be >= min_node_count,
21435 /// and must be > 0.
21436 /// **Note:** Quota must be sufficient to scale up the cluster.
21437 pub max_node_count: i32,
21438
21439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21440 }
21441
21442 impl GkeNodePoolAutoscalingConfig {
21443 pub fn new() -> Self {
21444 std::default::Default::default()
21445 }
21446
21447 /// Sets the value of [min_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::min_node_count].
21448 ///
21449 /// # Example
21450 /// ```ignore,no_run
21451 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21452 /// let x = GkeNodePoolAutoscalingConfig::new().set_min_node_count(42);
21453 /// ```
21454 pub fn set_min_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21455 self.min_node_count = v.into();
21456 self
21457 }
21458
21459 /// Sets the value of [max_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::max_node_count].
21460 ///
21461 /// # Example
21462 /// ```ignore,no_run
21463 /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21464 /// let x = GkeNodePoolAutoscalingConfig::new().set_max_node_count(42);
21465 /// ```
21466 pub fn set_max_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21467 self.max_node_count = v.into();
21468 self
21469 }
21470 }
21471
21472 impl wkt::message::Message for GkeNodePoolAutoscalingConfig {
21473 fn typename() -> &'static str {
21474 "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAutoscalingConfig"
21475 }
21476 }
21477}
21478
21479/// Authentication configuration for a workload is used to set the default
21480/// identity for the workload execution.
21481/// The config specifies the type of identity (service account or user) that
21482/// will be used by workloads to access resources on the project(s).
21483#[derive(Clone, Default, PartialEq)]
21484#[non_exhaustive]
21485pub struct AuthenticationConfig {
21486 /// Optional. Authentication type for the user workload running in containers.
21487 pub user_workload_authentication_type: crate::model::authentication_config::AuthenticationType,
21488
21489 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21490}
21491
21492impl AuthenticationConfig {
21493 pub fn new() -> Self {
21494 std::default::Default::default()
21495 }
21496
21497 /// Sets the value of [user_workload_authentication_type][crate::model::AuthenticationConfig::user_workload_authentication_type].
21498 ///
21499 /// # Example
21500 /// ```ignore,no_run
21501 /// # use google_cloud_dataproc_v1::model::AuthenticationConfig;
21502 /// use google_cloud_dataproc_v1::model::authentication_config::AuthenticationType;
21503 /// let x0 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::ServiceAccount);
21504 /// let x1 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::EndUserCredentials);
21505 /// ```
21506 pub fn set_user_workload_authentication_type<
21507 T: std::convert::Into<crate::model::authentication_config::AuthenticationType>,
21508 >(
21509 mut self,
21510 v: T,
21511 ) -> Self {
21512 self.user_workload_authentication_type = v.into();
21513 self
21514 }
21515}
21516
21517impl wkt::message::Message for AuthenticationConfig {
21518 fn typename() -> &'static str {
21519 "type.googleapis.com/google.cloud.dataproc.v1.AuthenticationConfig"
21520 }
21521}
21522
21523/// Defines additional types related to [AuthenticationConfig].
21524pub mod authentication_config {
21525 #[allow(unused_imports)]
21526 use super::*;
21527
21528 /// Authentication types for workload execution.
21529 ///
21530 /// # Working with unknown values
21531 ///
21532 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21533 /// additional enum variants at any time. Adding new variants is not considered
21534 /// a breaking change. Applications should write their code in anticipation of:
21535 ///
21536 /// - New values appearing in future releases of the client library, **and**
21537 /// - New values received dynamically, without application changes.
21538 ///
21539 /// Please consult the [Working with enums] section in the user guide for some
21540 /// guidelines.
21541 ///
21542 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21543 #[derive(Clone, Debug, PartialEq)]
21544 #[non_exhaustive]
21545 pub enum AuthenticationType {
21546 /// If AuthenticationType is unspecified then END_USER_CREDENTIALS is used
21547 /// for 3.0 and newer runtimes, and SERVICE_ACCOUNT is used for older
21548 /// runtimes.
21549 Unspecified,
21550 /// Use service account credentials for authenticating to other services.
21551 ServiceAccount,
21552 /// Use OAuth credentials associated with the workload creator/user for
21553 /// authenticating to other services.
21554 EndUserCredentials,
21555 /// If set, the enum was initialized with an unknown value.
21556 ///
21557 /// Applications can examine the value using [AuthenticationType::value] or
21558 /// [AuthenticationType::name].
21559 UnknownValue(authentication_type::UnknownValue),
21560 }
21561
21562 #[doc(hidden)]
21563 pub mod authentication_type {
21564 #[allow(unused_imports)]
21565 use super::*;
21566 #[derive(Clone, Debug, PartialEq)]
21567 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21568 }
21569
21570 impl AuthenticationType {
21571 /// Gets the enum value.
21572 ///
21573 /// Returns `None` if the enum contains an unknown value deserialized from
21574 /// the string representation of enums.
21575 pub fn value(&self) -> std::option::Option<i32> {
21576 match self {
21577 Self::Unspecified => std::option::Option::Some(0),
21578 Self::ServiceAccount => std::option::Option::Some(1),
21579 Self::EndUserCredentials => std::option::Option::Some(2),
21580 Self::UnknownValue(u) => u.0.value(),
21581 }
21582 }
21583
21584 /// Gets the enum value as a string.
21585 ///
21586 /// Returns `None` if the enum contains an unknown value deserialized from
21587 /// the integer representation of enums.
21588 pub fn name(&self) -> std::option::Option<&str> {
21589 match self {
21590 Self::Unspecified => std::option::Option::Some("AUTHENTICATION_TYPE_UNSPECIFIED"),
21591 Self::ServiceAccount => std::option::Option::Some("SERVICE_ACCOUNT"),
21592 Self::EndUserCredentials => std::option::Option::Some("END_USER_CREDENTIALS"),
21593 Self::UnknownValue(u) => u.0.name(),
21594 }
21595 }
21596 }
21597
21598 impl std::default::Default for AuthenticationType {
21599 fn default() -> Self {
21600 use std::convert::From;
21601 Self::from(0)
21602 }
21603 }
21604
21605 impl std::fmt::Display for AuthenticationType {
21606 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21607 wkt::internal::display_enum(f, self.name(), self.value())
21608 }
21609 }
21610
21611 impl std::convert::From<i32> for AuthenticationType {
21612 fn from(value: i32) -> Self {
21613 match value {
21614 0 => Self::Unspecified,
21615 1 => Self::ServiceAccount,
21616 2 => Self::EndUserCredentials,
21617 _ => Self::UnknownValue(authentication_type::UnknownValue(
21618 wkt::internal::UnknownEnumValue::Integer(value),
21619 )),
21620 }
21621 }
21622 }
21623
21624 impl std::convert::From<&str> for AuthenticationType {
21625 fn from(value: &str) -> Self {
21626 use std::string::ToString;
21627 match value {
21628 "AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
21629 "SERVICE_ACCOUNT" => Self::ServiceAccount,
21630 "END_USER_CREDENTIALS" => Self::EndUserCredentials,
21631 _ => Self::UnknownValue(authentication_type::UnknownValue(
21632 wkt::internal::UnknownEnumValue::String(value.to_string()),
21633 )),
21634 }
21635 }
21636 }
21637
21638 impl serde::ser::Serialize for AuthenticationType {
21639 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21640 where
21641 S: serde::Serializer,
21642 {
21643 match self {
21644 Self::Unspecified => serializer.serialize_i32(0),
21645 Self::ServiceAccount => serializer.serialize_i32(1),
21646 Self::EndUserCredentials => serializer.serialize_i32(2),
21647 Self::UnknownValue(u) => u.0.serialize(serializer),
21648 }
21649 }
21650 }
21651
21652 impl<'de> serde::de::Deserialize<'de> for AuthenticationType {
21653 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21654 where
21655 D: serde::Deserializer<'de>,
21656 {
21657 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthenticationType>::new(
21658 ".google.cloud.dataproc.v1.AuthenticationConfig.AuthenticationType",
21659 ))
21660 }
21661 }
21662}
21663
21664/// Autotuning configuration of the workload.
21665#[derive(Clone, Default, PartialEq)]
21666#[non_exhaustive]
21667pub struct AutotuningConfig {
21668 /// Optional. Scenarios for which tunings are applied.
21669 pub scenarios: std::vec::Vec<crate::model::autotuning_config::Scenario>,
21670
21671 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21672}
21673
21674impl AutotuningConfig {
21675 pub fn new() -> Self {
21676 std::default::Default::default()
21677 }
21678
21679 /// Sets the value of [scenarios][crate::model::AutotuningConfig::scenarios].
21680 ///
21681 /// # Example
21682 /// ```ignore,no_run
21683 /// # use google_cloud_dataproc_v1::model::AutotuningConfig;
21684 /// use google_cloud_dataproc_v1::model::autotuning_config::Scenario;
21685 /// let x = AutotuningConfig::new().set_scenarios([
21686 /// Scenario::Scaling,
21687 /// Scenario::BroadcastHashJoin,
21688 /// Scenario::Memory,
21689 /// ]);
21690 /// ```
21691 pub fn set_scenarios<T, V>(mut self, v: T) -> Self
21692 where
21693 T: std::iter::IntoIterator<Item = V>,
21694 V: std::convert::Into<crate::model::autotuning_config::Scenario>,
21695 {
21696 use std::iter::Iterator;
21697 self.scenarios = v.into_iter().map(|i| i.into()).collect();
21698 self
21699 }
21700}
21701
21702impl wkt::message::Message for AutotuningConfig {
21703 fn typename() -> &'static str {
21704 "type.googleapis.com/google.cloud.dataproc.v1.AutotuningConfig"
21705 }
21706}
21707
21708/// Defines additional types related to [AutotuningConfig].
21709pub mod autotuning_config {
21710 #[allow(unused_imports)]
21711 use super::*;
21712
21713 /// Scenario represents a specific goal that autotuning will attempt to achieve
21714 /// by modifying workloads.
21715 ///
21716 /// # Working with unknown values
21717 ///
21718 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21719 /// additional enum variants at any time. Adding new variants is not considered
21720 /// a breaking change. Applications should write their code in anticipation of:
21721 ///
21722 /// - New values appearing in future releases of the client library, **and**
21723 /// - New values received dynamically, without application changes.
21724 ///
21725 /// Please consult the [Working with enums] section in the user guide for some
21726 /// guidelines.
21727 ///
21728 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21729 #[derive(Clone, Debug, PartialEq)]
21730 #[non_exhaustive]
21731 pub enum Scenario {
21732 /// Default value.
21733 Unspecified,
21734 /// Scaling recommendations such as initialExecutors.
21735 Scaling,
21736 /// Adding hints for potential relation broadcasts.
21737 BroadcastHashJoin,
21738 /// Memory management for workloads.
21739 Memory,
21740 /// No autotuning.
21741 None,
21742 /// Automatic selection of scenarios.
21743 Auto,
21744 /// If set, the enum was initialized with an unknown value.
21745 ///
21746 /// Applications can examine the value using [Scenario::value] or
21747 /// [Scenario::name].
21748 UnknownValue(scenario::UnknownValue),
21749 }
21750
21751 #[doc(hidden)]
21752 pub mod scenario {
21753 #[allow(unused_imports)]
21754 use super::*;
21755 #[derive(Clone, Debug, PartialEq)]
21756 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21757 }
21758
21759 impl Scenario {
21760 /// Gets the enum value.
21761 ///
21762 /// Returns `None` if the enum contains an unknown value deserialized from
21763 /// the string representation of enums.
21764 pub fn value(&self) -> std::option::Option<i32> {
21765 match self {
21766 Self::Unspecified => std::option::Option::Some(0),
21767 Self::Scaling => std::option::Option::Some(2),
21768 Self::BroadcastHashJoin => std::option::Option::Some(3),
21769 Self::Memory => std::option::Option::Some(4),
21770 Self::None => std::option::Option::Some(5),
21771 Self::Auto => std::option::Option::Some(6),
21772 Self::UnknownValue(u) => u.0.value(),
21773 }
21774 }
21775
21776 /// Gets the enum value as a string.
21777 ///
21778 /// Returns `None` if the enum contains an unknown value deserialized from
21779 /// the integer representation of enums.
21780 pub fn name(&self) -> std::option::Option<&str> {
21781 match self {
21782 Self::Unspecified => std::option::Option::Some("SCENARIO_UNSPECIFIED"),
21783 Self::Scaling => std::option::Option::Some("SCALING"),
21784 Self::BroadcastHashJoin => std::option::Option::Some("BROADCAST_HASH_JOIN"),
21785 Self::Memory => std::option::Option::Some("MEMORY"),
21786 Self::None => std::option::Option::Some("NONE"),
21787 Self::Auto => std::option::Option::Some("AUTO"),
21788 Self::UnknownValue(u) => u.0.name(),
21789 }
21790 }
21791 }
21792
21793 impl std::default::Default for Scenario {
21794 fn default() -> Self {
21795 use std::convert::From;
21796 Self::from(0)
21797 }
21798 }
21799
21800 impl std::fmt::Display for Scenario {
21801 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21802 wkt::internal::display_enum(f, self.name(), self.value())
21803 }
21804 }
21805
21806 impl std::convert::From<i32> for Scenario {
21807 fn from(value: i32) -> Self {
21808 match value {
21809 0 => Self::Unspecified,
21810 2 => Self::Scaling,
21811 3 => Self::BroadcastHashJoin,
21812 4 => Self::Memory,
21813 5 => Self::None,
21814 6 => Self::Auto,
21815 _ => Self::UnknownValue(scenario::UnknownValue(
21816 wkt::internal::UnknownEnumValue::Integer(value),
21817 )),
21818 }
21819 }
21820 }
21821
21822 impl std::convert::From<&str> for Scenario {
21823 fn from(value: &str) -> Self {
21824 use std::string::ToString;
21825 match value {
21826 "SCENARIO_UNSPECIFIED" => Self::Unspecified,
21827 "SCALING" => Self::Scaling,
21828 "BROADCAST_HASH_JOIN" => Self::BroadcastHashJoin,
21829 "MEMORY" => Self::Memory,
21830 "NONE" => Self::None,
21831 "AUTO" => Self::Auto,
21832 _ => Self::UnknownValue(scenario::UnknownValue(
21833 wkt::internal::UnknownEnumValue::String(value.to_string()),
21834 )),
21835 }
21836 }
21837 }
21838
21839 impl serde::ser::Serialize for Scenario {
21840 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21841 where
21842 S: serde::Serializer,
21843 {
21844 match self {
21845 Self::Unspecified => serializer.serialize_i32(0),
21846 Self::Scaling => serializer.serialize_i32(2),
21847 Self::BroadcastHashJoin => serializer.serialize_i32(3),
21848 Self::Memory => serializer.serialize_i32(4),
21849 Self::None => serializer.serialize_i32(5),
21850 Self::Auto => serializer.serialize_i32(6),
21851 Self::UnknownValue(u) => u.0.serialize(serializer),
21852 }
21853 }
21854 }
21855
21856 impl<'de> serde::de::Deserialize<'de> for Scenario {
21857 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21858 where
21859 D: serde::Deserializer<'de>,
21860 {
21861 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scenario>::new(
21862 ".google.cloud.dataproc.v1.AutotuningConfig.Scenario",
21863 ))
21864 }
21865 }
21866}
21867
21868/// Configuration for dependency repositories
21869#[derive(Clone, Default, PartialEq)]
21870#[non_exhaustive]
21871pub struct RepositoryConfig {
21872 /// Optional. Configuration for PyPi repository.
21873 pub pypi_repository_config: std::option::Option<crate::model::PyPiRepositoryConfig>,
21874
21875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21876}
21877
21878impl RepositoryConfig {
21879 pub fn new() -> Self {
21880 std::default::Default::default()
21881 }
21882
21883 /// Sets the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
21884 ///
21885 /// # Example
21886 /// ```ignore,no_run
21887 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
21888 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
21889 /// let x = RepositoryConfig::new().set_pypi_repository_config(PyPiRepositoryConfig::default()/* use setters */);
21890 /// ```
21891 pub fn set_pypi_repository_config<T>(mut self, v: T) -> Self
21892 where
21893 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
21894 {
21895 self.pypi_repository_config = std::option::Option::Some(v.into());
21896 self
21897 }
21898
21899 /// Sets or clears the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
21900 ///
21901 /// # Example
21902 /// ```ignore,no_run
21903 /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
21904 /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
21905 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(Some(PyPiRepositoryConfig::default()/* use setters */));
21906 /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(None::<PyPiRepositoryConfig>);
21907 /// ```
21908 pub fn set_or_clear_pypi_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
21909 where
21910 T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
21911 {
21912 self.pypi_repository_config = v.map(|x| x.into());
21913 self
21914 }
21915}
21916
21917impl wkt::message::Message for RepositoryConfig {
21918 fn typename() -> &'static str {
21919 "type.googleapis.com/google.cloud.dataproc.v1.RepositoryConfig"
21920 }
21921}
21922
21923/// Configuration for PyPi repository
21924#[derive(Clone, Default, PartialEq)]
21925#[non_exhaustive]
21926pub struct PyPiRepositoryConfig {
21927 /// Optional. PyPi repository address
21928 pub pypi_repository: std::string::String,
21929
21930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21931}
21932
21933impl PyPiRepositoryConfig {
21934 pub fn new() -> Self {
21935 std::default::Default::default()
21936 }
21937
21938 /// Sets the value of [pypi_repository][crate::model::PyPiRepositoryConfig::pypi_repository].
21939 ///
21940 /// # Example
21941 /// ```ignore,no_run
21942 /// # use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
21943 /// let x = PyPiRepositoryConfig::new().set_pypi_repository("example");
21944 /// ```
21945 pub fn set_pypi_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21946 self.pypi_repository = v.into();
21947 self
21948 }
21949}
21950
21951impl wkt::message::Message for PyPiRepositoryConfig {
21952 fn typename() -> &'static str {
21953 "type.googleapis.com/google.cloud.dataproc.v1.PyPiRepositoryConfig"
21954 }
21955}
21956
21957/// A Dataproc workflow template resource.
21958#[derive(Clone, Default, PartialEq)]
21959#[non_exhaustive]
21960pub struct WorkflowTemplate {
21961 pub id: std::string::String,
21962
21963 /// Output only. The resource name of the workflow template, as described
21964 /// in <https://cloud.google.com/apis/design/resource_names>.
21965 ///
21966 /// * For `projects.regions.workflowTemplates`, the resource name of the
21967 /// template has the following format:
21968 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
21969 ///
21970 /// * For `projects.locations.workflowTemplates`, the resource name of the
21971 /// template has the following format:
21972 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
21973 ///
21974 pub name: std::string::String,
21975
21976 /// Optional. Used to perform a consistent read-modify-write.
21977 ///
21978 /// This field should be left blank for a `CreateWorkflowTemplate` request. It
21979 /// is required for an `UpdateWorkflowTemplate` request, and must match the
21980 /// current server version. A typical update template flow would fetch the
21981 /// current template with a `GetWorkflowTemplate` request, which will return
21982 /// the current template with the `version` field filled in with the
21983 /// current server version. The user updates other fields in the template,
21984 /// then returns it as part of the `UpdateWorkflowTemplate` request.
21985 pub version: i32,
21986
21987 /// Output only. The time template was created.
21988 pub create_time: std::option::Option<wkt::Timestamp>,
21989
21990 /// Output only. The time template was last updated.
21991 pub update_time: std::option::Option<wkt::Timestamp>,
21992
21993 /// Optional. The labels to associate with this template. These labels
21994 /// will be propagated to all jobs and clusters created by the workflow
21995 /// instance.
21996 ///
21997 /// Label **keys** must contain 1 to 63 characters, and must conform to
21998 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
21999 ///
22000 /// Label **values** may be empty, but, if present, must contain 1 to 63
22001 /// characters, and must conform to
22002 /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22003 ///
22004 /// No more than 32 labels can be associated with a template.
22005 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22006
22007 /// Required. WorkflowTemplate scheduling information.
22008 pub placement: std::option::Option<crate::model::WorkflowTemplatePlacement>,
22009
22010 /// Required. The Directed Acyclic Graph of Jobs to submit.
22011 pub jobs: std::vec::Vec<crate::model::OrderedJob>,
22012
22013 /// Optional. Template parameters whose values are substituted into the
22014 /// template. Values for parameters must be provided when the template is
22015 /// instantiated.
22016 pub parameters: std::vec::Vec<crate::model::TemplateParameter>,
22017
22018 /// Optional. Timeout duration for the DAG of jobs, expressed in seconds (see
22019 /// [JSON representation of
22020 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
22021 /// The timeout duration must be from 10 minutes ("600s") to 24 hours
22022 /// ("86400s"). The timer begins when the first job is submitted. If the
22023 /// workflow is running at the end of the timeout period, any remaining jobs
22024 /// are cancelled, the workflow is ended, and if the workflow was running on a
22025 /// [managed
22026 /// cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster),
22027 /// the cluster is deleted.
22028 pub dag_timeout: std::option::Option<wkt::Duration>,
22029
22030 /// Optional. Encryption settings for encrypting workflow template job
22031 /// arguments.
22032 pub encryption_config: std::option::Option<crate::model::workflow_template::EncryptionConfig>,
22033
22034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22035}
22036
22037impl WorkflowTemplate {
22038 pub fn new() -> Self {
22039 std::default::Default::default()
22040 }
22041
22042 /// Sets the value of [id][crate::model::WorkflowTemplate::id].
22043 ///
22044 /// # Example
22045 /// ```ignore,no_run
22046 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22047 /// let x = WorkflowTemplate::new().set_id("example");
22048 /// ```
22049 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22050 self.id = v.into();
22051 self
22052 }
22053
22054 /// Sets the value of [name][crate::model::WorkflowTemplate::name].
22055 ///
22056 /// # Example
22057 /// ```ignore,no_run
22058 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22059 /// let x = WorkflowTemplate::new().set_name("example");
22060 /// ```
22061 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22062 self.name = v.into();
22063 self
22064 }
22065
22066 /// Sets the value of [version][crate::model::WorkflowTemplate::version].
22067 ///
22068 /// # Example
22069 /// ```ignore,no_run
22070 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22071 /// let x = WorkflowTemplate::new().set_version(42);
22072 /// ```
22073 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22074 self.version = v.into();
22075 self
22076 }
22077
22078 /// Sets the value of [create_time][crate::model::WorkflowTemplate::create_time].
22079 ///
22080 /// # Example
22081 /// ```ignore,no_run
22082 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22083 /// use wkt::Timestamp;
22084 /// let x = WorkflowTemplate::new().set_create_time(Timestamp::default()/* use setters */);
22085 /// ```
22086 pub fn set_create_time<T>(mut self, v: T) -> Self
22087 where
22088 T: std::convert::Into<wkt::Timestamp>,
22089 {
22090 self.create_time = std::option::Option::Some(v.into());
22091 self
22092 }
22093
22094 /// Sets or clears the value of [create_time][crate::model::WorkflowTemplate::create_time].
22095 ///
22096 /// # Example
22097 /// ```ignore,no_run
22098 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22099 /// use wkt::Timestamp;
22100 /// let x = WorkflowTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
22101 /// let x = WorkflowTemplate::new().set_or_clear_create_time(None::<Timestamp>);
22102 /// ```
22103 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
22104 where
22105 T: std::convert::Into<wkt::Timestamp>,
22106 {
22107 self.create_time = v.map(|x| x.into());
22108 self
22109 }
22110
22111 /// Sets the value of [update_time][crate::model::WorkflowTemplate::update_time].
22112 ///
22113 /// # Example
22114 /// ```ignore,no_run
22115 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22116 /// use wkt::Timestamp;
22117 /// let x = WorkflowTemplate::new().set_update_time(Timestamp::default()/* use setters */);
22118 /// ```
22119 pub fn set_update_time<T>(mut self, v: T) -> Self
22120 where
22121 T: std::convert::Into<wkt::Timestamp>,
22122 {
22123 self.update_time = std::option::Option::Some(v.into());
22124 self
22125 }
22126
22127 /// Sets or clears the value of [update_time][crate::model::WorkflowTemplate::update_time].
22128 ///
22129 /// # Example
22130 /// ```ignore,no_run
22131 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22132 /// use wkt::Timestamp;
22133 /// let x = WorkflowTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
22134 /// let x = WorkflowTemplate::new().set_or_clear_update_time(None::<Timestamp>);
22135 /// ```
22136 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
22137 where
22138 T: std::convert::Into<wkt::Timestamp>,
22139 {
22140 self.update_time = v.map(|x| x.into());
22141 self
22142 }
22143
22144 /// Sets the value of [labels][crate::model::WorkflowTemplate::labels].
22145 ///
22146 /// # Example
22147 /// ```ignore,no_run
22148 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22149 /// let x = WorkflowTemplate::new().set_labels([
22150 /// ("key0", "abc"),
22151 /// ("key1", "xyz"),
22152 /// ]);
22153 /// ```
22154 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22155 where
22156 T: std::iter::IntoIterator<Item = (K, V)>,
22157 K: std::convert::Into<std::string::String>,
22158 V: std::convert::Into<std::string::String>,
22159 {
22160 use std::iter::Iterator;
22161 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22162 self
22163 }
22164
22165 /// Sets the value of [placement][crate::model::WorkflowTemplate::placement].
22166 ///
22167 /// # Example
22168 /// ```ignore,no_run
22169 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22170 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22171 /// let x = WorkflowTemplate::new().set_placement(WorkflowTemplatePlacement::default()/* use setters */);
22172 /// ```
22173 pub fn set_placement<T>(mut self, v: T) -> Self
22174 where
22175 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22176 {
22177 self.placement = std::option::Option::Some(v.into());
22178 self
22179 }
22180
22181 /// Sets or clears the value of [placement][crate::model::WorkflowTemplate::placement].
22182 ///
22183 /// # Example
22184 /// ```ignore,no_run
22185 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22186 /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22187 /// let x = WorkflowTemplate::new().set_or_clear_placement(Some(WorkflowTemplatePlacement::default()/* use setters */));
22188 /// let x = WorkflowTemplate::new().set_or_clear_placement(None::<WorkflowTemplatePlacement>);
22189 /// ```
22190 pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
22191 where
22192 T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22193 {
22194 self.placement = v.map(|x| x.into());
22195 self
22196 }
22197
22198 /// Sets the value of [jobs][crate::model::WorkflowTemplate::jobs].
22199 ///
22200 /// # Example
22201 /// ```ignore,no_run
22202 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22203 /// use google_cloud_dataproc_v1::model::OrderedJob;
22204 /// let x = WorkflowTemplate::new()
22205 /// .set_jobs([
22206 /// OrderedJob::default()/* use setters */,
22207 /// OrderedJob::default()/* use (different) setters */,
22208 /// ]);
22209 /// ```
22210 pub fn set_jobs<T, V>(mut self, v: T) -> Self
22211 where
22212 T: std::iter::IntoIterator<Item = V>,
22213 V: std::convert::Into<crate::model::OrderedJob>,
22214 {
22215 use std::iter::Iterator;
22216 self.jobs = v.into_iter().map(|i| i.into()).collect();
22217 self
22218 }
22219
22220 /// Sets the value of [parameters][crate::model::WorkflowTemplate::parameters].
22221 ///
22222 /// # Example
22223 /// ```ignore,no_run
22224 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22225 /// use google_cloud_dataproc_v1::model::TemplateParameter;
22226 /// let x = WorkflowTemplate::new()
22227 /// .set_parameters([
22228 /// TemplateParameter::default()/* use setters */,
22229 /// TemplateParameter::default()/* use (different) setters */,
22230 /// ]);
22231 /// ```
22232 pub fn set_parameters<T, V>(mut self, v: T) -> Self
22233 where
22234 T: std::iter::IntoIterator<Item = V>,
22235 V: std::convert::Into<crate::model::TemplateParameter>,
22236 {
22237 use std::iter::Iterator;
22238 self.parameters = v.into_iter().map(|i| i.into()).collect();
22239 self
22240 }
22241
22242 /// Sets the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
22243 ///
22244 /// # Example
22245 /// ```ignore,no_run
22246 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22247 /// use wkt::Duration;
22248 /// let x = WorkflowTemplate::new().set_dag_timeout(Duration::default()/* use setters */);
22249 /// ```
22250 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
22251 where
22252 T: std::convert::Into<wkt::Duration>,
22253 {
22254 self.dag_timeout = std::option::Option::Some(v.into());
22255 self
22256 }
22257
22258 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
22259 ///
22260 /// # Example
22261 /// ```ignore,no_run
22262 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22263 /// use wkt::Duration;
22264 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
22265 /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(None::<Duration>);
22266 /// ```
22267 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
22268 where
22269 T: std::convert::Into<wkt::Duration>,
22270 {
22271 self.dag_timeout = v.map(|x| x.into());
22272 self
22273 }
22274
22275 /// Sets the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
22276 ///
22277 /// # Example
22278 /// ```ignore,no_run
22279 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22280 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22281 /// let x = WorkflowTemplate::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
22282 /// ```
22283 pub fn set_encryption_config<T>(mut self, v: T) -> Self
22284 where
22285 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
22286 {
22287 self.encryption_config = std::option::Option::Some(v.into());
22288 self
22289 }
22290
22291 /// Sets or clears the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
22292 ///
22293 /// # Example
22294 /// ```ignore,no_run
22295 /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22296 /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22297 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
22298 /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
22299 /// ```
22300 pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
22301 where
22302 T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
22303 {
22304 self.encryption_config = v.map(|x| x.into());
22305 self
22306 }
22307}
22308
22309impl wkt::message::Message for WorkflowTemplate {
22310 fn typename() -> &'static str {
22311 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate"
22312 }
22313}
22314
22315/// Defines additional types related to [WorkflowTemplate].
22316pub mod workflow_template {
22317 #[allow(unused_imports)]
22318 use super::*;
22319
22320 /// Encryption settings for encrypting workflow template job arguments.
22321 #[derive(Clone, Default, PartialEq)]
22322 #[non_exhaustive]
22323 pub struct EncryptionConfig {
22324 /// Optional. The Cloud KMS key name to use for encrypting
22325 /// workflow template job arguments.
22326 ///
22327 /// When this this key is provided, the following workflow template
22328 /// [job arguments]
22329 /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows#adding_jobs_to_a_template>),
22330 /// if present, are
22331 /// [CMEK
22332 /// encrypted](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_workflow_template_data):
22333 ///
22334 /// * [FlinkJob
22335 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
22336 /// * [HadoopJob
22337 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
22338 /// * [SparkJob
22339 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
22340 /// * [SparkRJob
22341 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
22342 /// * [PySparkJob
22343 /// args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
22344 /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
22345 /// scriptVariables and queryList.queries
22346 /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
22347 /// scriptVariables and queryList.queries
22348 /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
22349 /// scriptVariables and queryList.queries
22350 /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
22351 /// scriptVariables and queryList.queries
22352 pub kms_key: std::string::String,
22353
22354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22355 }
22356
22357 impl EncryptionConfig {
22358 pub fn new() -> Self {
22359 std::default::Default::default()
22360 }
22361
22362 /// Sets the value of [kms_key][crate::model::workflow_template::EncryptionConfig::kms_key].
22363 ///
22364 /// # Example
22365 /// ```ignore,no_run
22366 /// # use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22367 /// let x = EncryptionConfig::new().set_kms_key("example");
22368 /// ```
22369 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22370 self.kms_key = v.into();
22371 self
22372 }
22373 }
22374
22375 impl wkt::message::Message for EncryptionConfig {
22376 fn typename() -> &'static str {
22377 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate.EncryptionConfig"
22378 }
22379 }
22380}
22381
22382/// Specifies workflow execution target.
22383///
22384/// Either `managed_cluster` or `cluster_selector` is required.
22385#[derive(Clone, Default, PartialEq)]
22386#[non_exhaustive]
22387pub struct WorkflowTemplatePlacement {
22388 /// Required. Specifies where workflow executes; either on a managed
22389 /// cluster or an existing cluster chosen by labels.
22390 pub placement: std::option::Option<crate::model::workflow_template_placement::Placement>,
22391
22392 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22393}
22394
22395impl WorkflowTemplatePlacement {
22396 pub fn new() -> Self {
22397 std::default::Default::default()
22398 }
22399
22400 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement].
22401 ///
22402 /// Note that all the setters affecting `placement` are mutually
22403 /// exclusive.
22404 ///
22405 /// # Example
22406 /// ```ignore,no_run
22407 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22408 /// use google_cloud_dataproc_v1::model::ManagedCluster;
22409 /// let x = WorkflowTemplatePlacement::new().set_placement(Some(
22410 /// google_cloud_dataproc_v1::model::workflow_template_placement::Placement::ManagedCluster(ManagedCluster::default().into())));
22411 /// ```
22412 pub fn set_placement<
22413 T: std::convert::Into<
22414 std::option::Option<crate::model::workflow_template_placement::Placement>,
22415 >,
22416 >(
22417 mut self,
22418 v: T,
22419 ) -> Self {
22420 self.placement = v.into();
22421 self
22422 }
22423
22424 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22425 /// if it holds a `ManagedCluster`, `None` if the field is not set or
22426 /// holds a different branch.
22427 pub fn managed_cluster(
22428 &self,
22429 ) -> std::option::Option<&std::boxed::Box<crate::model::ManagedCluster>> {
22430 #[allow(unreachable_patterns)]
22431 self.placement.as_ref().and_then(|v| match v {
22432 crate::model::workflow_template_placement::Placement::ManagedCluster(v) => {
22433 std::option::Option::Some(v)
22434 }
22435 _ => std::option::Option::None,
22436 })
22437 }
22438
22439 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22440 /// to hold a `ManagedCluster`.
22441 ///
22442 /// Note that all the setters affecting `placement` are
22443 /// mutually exclusive.
22444 ///
22445 /// # Example
22446 /// ```ignore,no_run
22447 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22448 /// use google_cloud_dataproc_v1::model::ManagedCluster;
22449 /// let x = WorkflowTemplatePlacement::new().set_managed_cluster(ManagedCluster::default()/* use setters */);
22450 /// assert!(x.managed_cluster().is_some());
22451 /// assert!(x.cluster_selector().is_none());
22452 /// ```
22453 pub fn set_managed_cluster<
22454 T: std::convert::Into<std::boxed::Box<crate::model::ManagedCluster>>,
22455 >(
22456 mut self,
22457 v: T,
22458 ) -> Self {
22459 self.placement = std::option::Option::Some(
22460 crate::model::workflow_template_placement::Placement::ManagedCluster(v.into()),
22461 );
22462 self
22463 }
22464
22465 /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22466 /// if it holds a `ClusterSelector`, `None` if the field is not set or
22467 /// holds a different branch.
22468 pub fn cluster_selector(
22469 &self,
22470 ) -> std::option::Option<&std::boxed::Box<crate::model::ClusterSelector>> {
22471 #[allow(unreachable_patterns)]
22472 self.placement.as_ref().and_then(|v| match v {
22473 crate::model::workflow_template_placement::Placement::ClusterSelector(v) => {
22474 std::option::Option::Some(v)
22475 }
22476 _ => std::option::Option::None,
22477 })
22478 }
22479
22480 /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22481 /// to hold a `ClusterSelector`.
22482 ///
22483 /// Note that all the setters affecting `placement` are
22484 /// mutually exclusive.
22485 ///
22486 /// # Example
22487 /// ```ignore,no_run
22488 /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22489 /// use google_cloud_dataproc_v1::model::ClusterSelector;
22490 /// let x = WorkflowTemplatePlacement::new().set_cluster_selector(ClusterSelector::default()/* use setters */);
22491 /// assert!(x.cluster_selector().is_some());
22492 /// assert!(x.managed_cluster().is_none());
22493 /// ```
22494 pub fn set_cluster_selector<
22495 T: std::convert::Into<std::boxed::Box<crate::model::ClusterSelector>>,
22496 >(
22497 mut self,
22498 v: T,
22499 ) -> Self {
22500 self.placement = std::option::Option::Some(
22501 crate::model::workflow_template_placement::Placement::ClusterSelector(v.into()),
22502 );
22503 self
22504 }
22505}
22506
22507impl wkt::message::Message for WorkflowTemplatePlacement {
22508 fn typename() -> &'static str {
22509 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplatePlacement"
22510 }
22511}
22512
22513/// Defines additional types related to [WorkflowTemplatePlacement].
22514pub mod workflow_template_placement {
22515 #[allow(unused_imports)]
22516 use super::*;
22517
22518 /// Required. Specifies where workflow executes; either on a managed
22519 /// cluster or an existing cluster chosen by labels.
22520 #[derive(Clone, Debug, PartialEq)]
22521 #[non_exhaustive]
22522 pub enum Placement {
22523 /// A cluster that is managed by the workflow.
22524 ManagedCluster(std::boxed::Box<crate::model::ManagedCluster>),
22525 /// Optional. A selector that chooses target cluster for jobs based
22526 /// on metadata.
22527 ///
22528 /// The selector is evaluated at the time each job is submitted.
22529 ClusterSelector(std::boxed::Box<crate::model::ClusterSelector>),
22530 }
22531}
22532
22533/// Cluster that is managed by the workflow.
22534#[derive(Clone, Default, PartialEq)]
22535#[non_exhaustive]
22536pub struct ManagedCluster {
22537 /// Required. The cluster name prefix. A unique cluster name will be formed by
22538 /// appending a random suffix.
22539 ///
22540 /// The name must contain only lower-case letters (a-z), numbers (0-9),
22541 /// and hyphens (-). Must begin with a letter. Cannot begin or end with
22542 /// hyphen. Must consist of between 2 and 35 characters.
22543 pub cluster_name: std::string::String,
22544
22545 /// Required. The cluster configuration.
22546 pub config: std::option::Option<crate::model::ClusterConfig>,
22547
22548 /// Optional. The labels to associate with this cluster.
22549 ///
22550 /// Label keys must be between 1 and 63 characters long, and must conform to
22551 /// the following PCRE regular expression:
22552 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
22553 ///
22554 /// Label values must be between 1 and 63 characters long, and must conform to
22555 /// the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
22556 ///
22557 /// No more than 32 labels can be associated with a given cluster.
22558 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22559
22560 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22561}
22562
22563impl ManagedCluster {
22564 pub fn new() -> Self {
22565 std::default::Default::default()
22566 }
22567
22568 /// Sets the value of [cluster_name][crate::model::ManagedCluster::cluster_name].
22569 ///
22570 /// # Example
22571 /// ```ignore,no_run
22572 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22573 /// let x = ManagedCluster::new().set_cluster_name("example");
22574 /// ```
22575 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22576 self.cluster_name = v.into();
22577 self
22578 }
22579
22580 /// Sets the value of [config][crate::model::ManagedCluster::config].
22581 ///
22582 /// # Example
22583 /// ```ignore,no_run
22584 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22585 /// use google_cloud_dataproc_v1::model::ClusterConfig;
22586 /// let x = ManagedCluster::new().set_config(ClusterConfig::default()/* use setters */);
22587 /// ```
22588 pub fn set_config<T>(mut self, v: T) -> Self
22589 where
22590 T: std::convert::Into<crate::model::ClusterConfig>,
22591 {
22592 self.config = std::option::Option::Some(v.into());
22593 self
22594 }
22595
22596 /// Sets or clears the value of [config][crate::model::ManagedCluster::config].
22597 ///
22598 /// # Example
22599 /// ```ignore,no_run
22600 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22601 /// use google_cloud_dataproc_v1::model::ClusterConfig;
22602 /// let x = ManagedCluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
22603 /// let x = ManagedCluster::new().set_or_clear_config(None::<ClusterConfig>);
22604 /// ```
22605 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
22606 where
22607 T: std::convert::Into<crate::model::ClusterConfig>,
22608 {
22609 self.config = v.map(|x| x.into());
22610 self
22611 }
22612
22613 /// Sets the value of [labels][crate::model::ManagedCluster::labels].
22614 ///
22615 /// # Example
22616 /// ```ignore,no_run
22617 /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22618 /// let x = ManagedCluster::new().set_labels([
22619 /// ("key0", "abc"),
22620 /// ("key1", "xyz"),
22621 /// ]);
22622 /// ```
22623 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22624 where
22625 T: std::iter::IntoIterator<Item = (K, V)>,
22626 K: std::convert::Into<std::string::String>,
22627 V: std::convert::Into<std::string::String>,
22628 {
22629 use std::iter::Iterator;
22630 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22631 self
22632 }
22633}
22634
22635impl wkt::message::Message for ManagedCluster {
22636 fn typename() -> &'static str {
22637 "type.googleapis.com/google.cloud.dataproc.v1.ManagedCluster"
22638 }
22639}
22640
22641/// A selector that chooses target cluster for jobs based on metadata.
22642#[derive(Clone, Default, PartialEq)]
22643#[non_exhaustive]
22644pub struct ClusterSelector {
22645 /// Optional. The zone where workflow process executes. This parameter does not
22646 /// affect the selection of the cluster.
22647 ///
22648 /// If unspecified, the zone of the first cluster matching the selector
22649 /// is used.
22650 pub zone: std::string::String,
22651
22652 /// Required. The cluster labels. Cluster must have all labels
22653 /// to match.
22654 pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
22655
22656 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22657}
22658
22659impl ClusterSelector {
22660 pub fn new() -> Self {
22661 std::default::Default::default()
22662 }
22663
22664 /// Sets the value of [zone][crate::model::ClusterSelector::zone].
22665 ///
22666 /// # Example
22667 /// ```ignore,no_run
22668 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
22669 /// let x = ClusterSelector::new().set_zone("example");
22670 /// ```
22671 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22672 self.zone = v.into();
22673 self
22674 }
22675
22676 /// Sets the value of [cluster_labels][crate::model::ClusterSelector::cluster_labels].
22677 ///
22678 /// # Example
22679 /// ```ignore,no_run
22680 /// # use google_cloud_dataproc_v1::model::ClusterSelector;
22681 /// let x = ClusterSelector::new().set_cluster_labels([
22682 /// ("key0", "abc"),
22683 /// ("key1", "xyz"),
22684 /// ]);
22685 /// ```
22686 pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
22687 where
22688 T: std::iter::IntoIterator<Item = (K, V)>,
22689 K: std::convert::Into<std::string::String>,
22690 V: std::convert::Into<std::string::String>,
22691 {
22692 use std::iter::Iterator;
22693 self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22694 self
22695 }
22696}
22697
22698impl wkt::message::Message for ClusterSelector {
22699 fn typename() -> &'static str {
22700 "type.googleapis.com/google.cloud.dataproc.v1.ClusterSelector"
22701 }
22702}
22703
22704/// A job executed by the workflow.
22705#[derive(Clone, Default, PartialEq)]
22706#[non_exhaustive]
22707pub struct OrderedJob {
22708 /// Required. The step id. The id must be unique among all jobs
22709 /// within the template.
22710 ///
22711 /// The step id is used as prefix for job id, as job
22712 /// `goog-dataproc-workflow-step-id` label, and in
22713 /// [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]
22714 /// field from other steps.
22715 ///
22716 /// The id must contain only letters (a-z, A-Z), numbers (0-9),
22717 /// underscores (_), and hyphens (-). Cannot begin or end with underscore
22718 /// or hyphen. Must consist of between 3 and 50 characters.
22719 ///
22720 /// [google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]: crate::model::OrderedJob::prerequisite_step_ids
22721 pub step_id: std::string::String,
22722
22723 /// Optional. The labels to associate with this job.
22724 ///
22725 /// Label keys must be between 1 and 63 characters long, and must conform to
22726 /// the following regular expression:
22727 /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
22728 ///
22729 /// Label values must be between 1 and 63 characters long, and must conform to
22730 /// the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
22731 ///
22732 /// No more than 32 labels can be associated with a given job.
22733 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22734
22735 /// Optional. Job scheduling configuration.
22736 pub scheduling: std::option::Option<crate::model::JobScheduling>,
22737
22738 /// Optional. The optional list of prerequisite job step_ids.
22739 /// If not specified, the job will start at the beginning of workflow.
22740 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
22741
22742 /// Required. The job definition.
22743 pub job_type: std::option::Option<crate::model::ordered_job::JobType>,
22744
22745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22746}
22747
22748impl OrderedJob {
22749 pub fn new() -> Self {
22750 std::default::Default::default()
22751 }
22752
22753 /// Sets the value of [step_id][crate::model::OrderedJob::step_id].
22754 ///
22755 /// # Example
22756 /// ```ignore,no_run
22757 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22758 /// let x = OrderedJob::new().set_step_id("example");
22759 /// ```
22760 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22761 self.step_id = v.into();
22762 self
22763 }
22764
22765 /// Sets the value of [labels][crate::model::OrderedJob::labels].
22766 ///
22767 /// # Example
22768 /// ```ignore,no_run
22769 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22770 /// let x = OrderedJob::new().set_labels([
22771 /// ("key0", "abc"),
22772 /// ("key1", "xyz"),
22773 /// ]);
22774 /// ```
22775 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22776 where
22777 T: std::iter::IntoIterator<Item = (K, V)>,
22778 K: std::convert::Into<std::string::String>,
22779 V: std::convert::Into<std::string::String>,
22780 {
22781 use std::iter::Iterator;
22782 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22783 self
22784 }
22785
22786 /// Sets the value of [scheduling][crate::model::OrderedJob::scheduling].
22787 ///
22788 /// # Example
22789 /// ```ignore,no_run
22790 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22791 /// use google_cloud_dataproc_v1::model::JobScheduling;
22792 /// let x = OrderedJob::new().set_scheduling(JobScheduling::default()/* use setters */);
22793 /// ```
22794 pub fn set_scheduling<T>(mut self, v: T) -> Self
22795 where
22796 T: std::convert::Into<crate::model::JobScheduling>,
22797 {
22798 self.scheduling = std::option::Option::Some(v.into());
22799 self
22800 }
22801
22802 /// Sets or clears the value of [scheduling][crate::model::OrderedJob::scheduling].
22803 ///
22804 /// # Example
22805 /// ```ignore,no_run
22806 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22807 /// use google_cloud_dataproc_v1::model::JobScheduling;
22808 /// let x = OrderedJob::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
22809 /// let x = OrderedJob::new().set_or_clear_scheduling(None::<JobScheduling>);
22810 /// ```
22811 pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
22812 where
22813 T: std::convert::Into<crate::model::JobScheduling>,
22814 {
22815 self.scheduling = v.map(|x| x.into());
22816 self
22817 }
22818
22819 /// Sets the value of [prerequisite_step_ids][crate::model::OrderedJob::prerequisite_step_ids].
22820 ///
22821 /// # Example
22822 /// ```ignore,no_run
22823 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22824 /// let x = OrderedJob::new().set_prerequisite_step_ids(["a", "b", "c"]);
22825 /// ```
22826 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
22827 where
22828 T: std::iter::IntoIterator<Item = V>,
22829 V: std::convert::Into<std::string::String>,
22830 {
22831 use std::iter::Iterator;
22832 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
22833 self
22834 }
22835
22836 /// Sets the value of [job_type][crate::model::OrderedJob::job_type].
22837 ///
22838 /// Note that all the setters affecting `job_type` are mutually
22839 /// exclusive.
22840 ///
22841 /// # Example
22842 /// ```ignore,no_run
22843 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22844 /// use google_cloud_dataproc_v1::model::HadoopJob;
22845 /// let x = OrderedJob::new().set_job_type(Some(
22846 /// google_cloud_dataproc_v1::model::ordered_job::JobType::HadoopJob(HadoopJob::default().into())));
22847 /// ```
22848 pub fn set_job_type<
22849 T: std::convert::Into<std::option::Option<crate::model::ordered_job::JobType>>,
22850 >(
22851 mut self,
22852 v: T,
22853 ) -> Self {
22854 self.job_type = v.into();
22855 self
22856 }
22857
22858 /// The value of [job_type][crate::model::OrderedJob::job_type]
22859 /// if it holds a `HadoopJob`, `None` if the field is not set or
22860 /// holds a different branch.
22861 pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
22862 #[allow(unreachable_patterns)]
22863 self.job_type.as_ref().and_then(|v| match v {
22864 crate::model::ordered_job::JobType::HadoopJob(v) => std::option::Option::Some(v),
22865 _ => std::option::Option::None,
22866 })
22867 }
22868
22869 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
22870 /// to hold a `HadoopJob`.
22871 ///
22872 /// Note that all the setters affecting `job_type` are
22873 /// mutually exclusive.
22874 ///
22875 /// # Example
22876 /// ```ignore,no_run
22877 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22878 /// use google_cloud_dataproc_v1::model::HadoopJob;
22879 /// let x = OrderedJob::new().set_hadoop_job(HadoopJob::default()/* use setters */);
22880 /// assert!(x.hadoop_job().is_some());
22881 /// assert!(x.spark_job().is_none());
22882 /// assert!(x.pyspark_job().is_none());
22883 /// assert!(x.hive_job().is_none());
22884 /// assert!(x.pig_job().is_none());
22885 /// assert!(x.spark_r_job().is_none());
22886 /// assert!(x.spark_sql_job().is_none());
22887 /// assert!(x.presto_job().is_none());
22888 /// assert!(x.trino_job().is_none());
22889 /// assert!(x.flink_job().is_none());
22890 /// ```
22891 pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
22892 mut self,
22893 v: T,
22894 ) -> Self {
22895 self.job_type =
22896 std::option::Option::Some(crate::model::ordered_job::JobType::HadoopJob(v.into()));
22897 self
22898 }
22899
22900 /// The value of [job_type][crate::model::OrderedJob::job_type]
22901 /// if it holds a `SparkJob`, `None` if the field is not set or
22902 /// holds a different branch.
22903 pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
22904 #[allow(unreachable_patterns)]
22905 self.job_type.as_ref().and_then(|v| match v {
22906 crate::model::ordered_job::JobType::SparkJob(v) => std::option::Option::Some(v),
22907 _ => std::option::Option::None,
22908 })
22909 }
22910
22911 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
22912 /// to hold a `SparkJob`.
22913 ///
22914 /// Note that all the setters affecting `job_type` are
22915 /// mutually exclusive.
22916 ///
22917 /// # Example
22918 /// ```ignore,no_run
22919 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22920 /// use google_cloud_dataproc_v1::model::SparkJob;
22921 /// let x = OrderedJob::new().set_spark_job(SparkJob::default()/* use setters */);
22922 /// assert!(x.spark_job().is_some());
22923 /// assert!(x.hadoop_job().is_none());
22924 /// assert!(x.pyspark_job().is_none());
22925 /// assert!(x.hive_job().is_none());
22926 /// assert!(x.pig_job().is_none());
22927 /// assert!(x.spark_r_job().is_none());
22928 /// assert!(x.spark_sql_job().is_none());
22929 /// assert!(x.presto_job().is_none());
22930 /// assert!(x.trino_job().is_none());
22931 /// assert!(x.flink_job().is_none());
22932 /// ```
22933 pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
22934 mut self,
22935 v: T,
22936 ) -> Self {
22937 self.job_type =
22938 std::option::Option::Some(crate::model::ordered_job::JobType::SparkJob(v.into()));
22939 self
22940 }
22941
22942 /// The value of [job_type][crate::model::OrderedJob::job_type]
22943 /// if it holds a `PysparkJob`, `None` if the field is not set or
22944 /// holds a different branch.
22945 pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
22946 #[allow(unreachable_patterns)]
22947 self.job_type.as_ref().and_then(|v| match v {
22948 crate::model::ordered_job::JobType::PysparkJob(v) => std::option::Option::Some(v),
22949 _ => std::option::Option::None,
22950 })
22951 }
22952
22953 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
22954 /// to hold a `PysparkJob`.
22955 ///
22956 /// Note that all the setters affecting `job_type` are
22957 /// mutually exclusive.
22958 ///
22959 /// # Example
22960 /// ```ignore,no_run
22961 /// # use google_cloud_dataproc_v1::model::OrderedJob;
22962 /// use google_cloud_dataproc_v1::model::PySparkJob;
22963 /// let x = OrderedJob::new().set_pyspark_job(PySparkJob::default()/* use setters */);
22964 /// assert!(x.pyspark_job().is_some());
22965 /// assert!(x.hadoop_job().is_none());
22966 /// assert!(x.spark_job().is_none());
22967 /// assert!(x.hive_job().is_none());
22968 /// assert!(x.pig_job().is_none());
22969 /// assert!(x.spark_r_job().is_none());
22970 /// assert!(x.spark_sql_job().is_none());
22971 /// assert!(x.presto_job().is_none());
22972 /// assert!(x.trino_job().is_none());
22973 /// assert!(x.flink_job().is_none());
22974 /// ```
22975 pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
22976 mut self,
22977 v: T,
22978 ) -> Self {
22979 self.job_type =
22980 std::option::Option::Some(crate::model::ordered_job::JobType::PysparkJob(v.into()));
22981 self
22982 }
22983
22984 /// The value of [job_type][crate::model::OrderedJob::job_type]
22985 /// if it holds a `HiveJob`, `None` if the field is not set or
22986 /// holds a different branch.
22987 pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
22988 #[allow(unreachable_patterns)]
22989 self.job_type.as_ref().and_then(|v| match v {
22990 crate::model::ordered_job::JobType::HiveJob(v) => std::option::Option::Some(v),
22991 _ => std::option::Option::None,
22992 })
22993 }
22994
22995 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
22996 /// to hold a `HiveJob`.
22997 ///
22998 /// Note that all the setters affecting `job_type` are
22999 /// mutually exclusive.
23000 ///
23001 /// # Example
23002 /// ```ignore,no_run
23003 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23004 /// use google_cloud_dataproc_v1::model::HiveJob;
23005 /// let x = OrderedJob::new().set_hive_job(HiveJob::default()/* use setters */);
23006 /// assert!(x.hive_job().is_some());
23007 /// assert!(x.hadoop_job().is_none());
23008 /// assert!(x.spark_job().is_none());
23009 /// assert!(x.pyspark_job().is_none());
23010 /// assert!(x.pig_job().is_none());
23011 /// assert!(x.spark_r_job().is_none());
23012 /// assert!(x.spark_sql_job().is_none());
23013 /// assert!(x.presto_job().is_none());
23014 /// assert!(x.trino_job().is_none());
23015 /// assert!(x.flink_job().is_none());
23016 /// ```
23017 pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
23018 mut self,
23019 v: T,
23020 ) -> Self {
23021 self.job_type =
23022 std::option::Option::Some(crate::model::ordered_job::JobType::HiveJob(v.into()));
23023 self
23024 }
23025
23026 /// The value of [job_type][crate::model::OrderedJob::job_type]
23027 /// if it holds a `PigJob`, `None` if the field is not set or
23028 /// holds a different branch.
23029 pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
23030 #[allow(unreachable_patterns)]
23031 self.job_type.as_ref().and_then(|v| match v {
23032 crate::model::ordered_job::JobType::PigJob(v) => std::option::Option::Some(v),
23033 _ => std::option::Option::None,
23034 })
23035 }
23036
23037 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23038 /// to hold a `PigJob`.
23039 ///
23040 /// Note that all the setters affecting `job_type` are
23041 /// mutually exclusive.
23042 ///
23043 /// # Example
23044 /// ```ignore,no_run
23045 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23046 /// use google_cloud_dataproc_v1::model::PigJob;
23047 /// let x = OrderedJob::new().set_pig_job(PigJob::default()/* use setters */);
23048 /// assert!(x.pig_job().is_some());
23049 /// assert!(x.hadoop_job().is_none());
23050 /// assert!(x.spark_job().is_none());
23051 /// assert!(x.pyspark_job().is_none());
23052 /// assert!(x.hive_job().is_none());
23053 /// assert!(x.spark_r_job().is_none());
23054 /// assert!(x.spark_sql_job().is_none());
23055 /// assert!(x.presto_job().is_none());
23056 /// assert!(x.trino_job().is_none());
23057 /// assert!(x.flink_job().is_none());
23058 /// ```
23059 pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
23060 mut self,
23061 v: T,
23062 ) -> Self {
23063 self.job_type =
23064 std::option::Option::Some(crate::model::ordered_job::JobType::PigJob(v.into()));
23065 self
23066 }
23067
23068 /// The value of [job_type][crate::model::OrderedJob::job_type]
23069 /// if it holds a `SparkRJob`, `None` if the field is not set or
23070 /// holds a different branch.
23071 pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
23072 #[allow(unreachable_patterns)]
23073 self.job_type.as_ref().and_then(|v| match v {
23074 crate::model::ordered_job::JobType::SparkRJob(v) => std::option::Option::Some(v),
23075 _ => std::option::Option::None,
23076 })
23077 }
23078
23079 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23080 /// to hold a `SparkRJob`.
23081 ///
23082 /// Note that all the setters affecting `job_type` are
23083 /// mutually exclusive.
23084 ///
23085 /// # Example
23086 /// ```ignore,no_run
23087 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23088 /// use google_cloud_dataproc_v1::model::SparkRJob;
23089 /// let x = OrderedJob::new().set_spark_r_job(SparkRJob::default()/* use setters */);
23090 /// assert!(x.spark_r_job().is_some());
23091 /// assert!(x.hadoop_job().is_none());
23092 /// assert!(x.spark_job().is_none());
23093 /// assert!(x.pyspark_job().is_none());
23094 /// assert!(x.hive_job().is_none());
23095 /// assert!(x.pig_job().is_none());
23096 /// assert!(x.spark_sql_job().is_none());
23097 /// assert!(x.presto_job().is_none());
23098 /// assert!(x.trino_job().is_none());
23099 /// assert!(x.flink_job().is_none());
23100 /// ```
23101 pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
23102 mut self,
23103 v: T,
23104 ) -> Self {
23105 self.job_type =
23106 std::option::Option::Some(crate::model::ordered_job::JobType::SparkRJob(v.into()));
23107 self
23108 }
23109
23110 /// The value of [job_type][crate::model::OrderedJob::job_type]
23111 /// if it holds a `SparkSqlJob`, `None` if the field is not set or
23112 /// holds a different branch.
23113 pub fn spark_sql_job(
23114 &self,
23115 ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
23116 #[allow(unreachable_patterns)]
23117 self.job_type.as_ref().and_then(|v| match v {
23118 crate::model::ordered_job::JobType::SparkSqlJob(v) => std::option::Option::Some(v),
23119 _ => std::option::Option::None,
23120 })
23121 }
23122
23123 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23124 /// to hold a `SparkSqlJob`.
23125 ///
23126 /// Note that all the setters affecting `job_type` are
23127 /// mutually exclusive.
23128 ///
23129 /// # Example
23130 /// ```ignore,no_run
23131 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23132 /// use google_cloud_dataproc_v1::model::SparkSqlJob;
23133 /// let x = OrderedJob::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
23134 /// assert!(x.spark_sql_job().is_some());
23135 /// assert!(x.hadoop_job().is_none());
23136 /// assert!(x.spark_job().is_none());
23137 /// assert!(x.pyspark_job().is_none());
23138 /// assert!(x.hive_job().is_none());
23139 /// assert!(x.pig_job().is_none());
23140 /// assert!(x.spark_r_job().is_none());
23141 /// assert!(x.presto_job().is_none());
23142 /// assert!(x.trino_job().is_none());
23143 /// assert!(x.flink_job().is_none());
23144 /// ```
23145 pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
23146 mut self,
23147 v: T,
23148 ) -> Self {
23149 self.job_type =
23150 std::option::Option::Some(crate::model::ordered_job::JobType::SparkSqlJob(v.into()));
23151 self
23152 }
23153
23154 /// The value of [job_type][crate::model::OrderedJob::job_type]
23155 /// if it holds a `PrestoJob`, `None` if the field is not set or
23156 /// holds a different branch.
23157 pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
23158 #[allow(unreachable_patterns)]
23159 self.job_type.as_ref().and_then(|v| match v {
23160 crate::model::ordered_job::JobType::PrestoJob(v) => std::option::Option::Some(v),
23161 _ => std::option::Option::None,
23162 })
23163 }
23164
23165 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23166 /// to hold a `PrestoJob`.
23167 ///
23168 /// Note that all the setters affecting `job_type` are
23169 /// mutually exclusive.
23170 ///
23171 /// # Example
23172 /// ```ignore,no_run
23173 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23174 /// use google_cloud_dataproc_v1::model::PrestoJob;
23175 /// let x = OrderedJob::new().set_presto_job(PrestoJob::default()/* use setters */);
23176 /// assert!(x.presto_job().is_some());
23177 /// assert!(x.hadoop_job().is_none());
23178 /// assert!(x.spark_job().is_none());
23179 /// assert!(x.pyspark_job().is_none());
23180 /// assert!(x.hive_job().is_none());
23181 /// assert!(x.pig_job().is_none());
23182 /// assert!(x.spark_r_job().is_none());
23183 /// assert!(x.spark_sql_job().is_none());
23184 /// assert!(x.trino_job().is_none());
23185 /// assert!(x.flink_job().is_none());
23186 /// ```
23187 pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
23188 mut self,
23189 v: T,
23190 ) -> Self {
23191 self.job_type =
23192 std::option::Option::Some(crate::model::ordered_job::JobType::PrestoJob(v.into()));
23193 self
23194 }
23195
23196 /// The value of [job_type][crate::model::OrderedJob::job_type]
23197 /// if it holds a `TrinoJob`, `None` if the field is not set or
23198 /// holds a different branch.
23199 pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
23200 #[allow(unreachable_patterns)]
23201 self.job_type.as_ref().and_then(|v| match v {
23202 crate::model::ordered_job::JobType::TrinoJob(v) => std::option::Option::Some(v),
23203 _ => std::option::Option::None,
23204 })
23205 }
23206
23207 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23208 /// to hold a `TrinoJob`.
23209 ///
23210 /// Note that all the setters affecting `job_type` are
23211 /// mutually exclusive.
23212 ///
23213 /// # Example
23214 /// ```ignore,no_run
23215 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23216 /// use google_cloud_dataproc_v1::model::TrinoJob;
23217 /// let x = OrderedJob::new().set_trino_job(TrinoJob::default()/* use setters */);
23218 /// assert!(x.trino_job().is_some());
23219 /// assert!(x.hadoop_job().is_none());
23220 /// assert!(x.spark_job().is_none());
23221 /// assert!(x.pyspark_job().is_none());
23222 /// assert!(x.hive_job().is_none());
23223 /// assert!(x.pig_job().is_none());
23224 /// assert!(x.spark_r_job().is_none());
23225 /// assert!(x.spark_sql_job().is_none());
23226 /// assert!(x.presto_job().is_none());
23227 /// assert!(x.flink_job().is_none());
23228 /// ```
23229 pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
23230 mut self,
23231 v: T,
23232 ) -> Self {
23233 self.job_type =
23234 std::option::Option::Some(crate::model::ordered_job::JobType::TrinoJob(v.into()));
23235 self
23236 }
23237
23238 /// The value of [job_type][crate::model::OrderedJob::job_type]
23239 /// if it holds a `FlinkJob`, `None` if the field is not set or
23240 /// holds a different branch.
23241 pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
23242 #[allow(unreachable_patterns)]
23243 self.job_type.as_ref().and_then(|v| match v {
23244 crate::model::ordered_job::JobType::FlinkJob(v) => std::option::Option::Some(v),
23245 _ => std::option::Option::None,
23246 })
23247 }
23248
23249 /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23250 /// to hold a `FlinkJob`.
23251 ///
23252 /// Note that all the setters affecting `job_type` are
23253 /// mutually exclusive.
23254 ///
23255 /// # Example
23256 /// ```ignore,no_run
23257 /// # use google_cloud_dataproc_v1::model::OrderedJob;
23258 /// use google_cloud_dataproc_v1::model::FlinkJob;
23259 /// let x = OrderedJob::new().set_flink_job(FlinkJob::default()/* use setters */);
23260 /// assert!(x.flink_job().is_some());
23261 /// assert!(x.hadoop_job().is_none());
23262 /// assert!(x.spark_job().is_none());
23263 /// assert!(x.pyspark_job().is_none());
23264 /// assert!(x.hive_job().is_none());
23265 /// assert!(x.pig_job().is_none());
23266 /// assert!(x.spark_r_job().is_none());
23267 /// assert!(x.spark_sql_job().is_none());
23268 /// assert!(x.presto_job().is_none());
23269 /// assert!(x.trino_job().is_none());
23270 /// ```
23271 pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
23272 mut self,
23273 v: T,
23274 ) -> Self {
23275 self.job_type =
23276 std::option::Option::Some(crate::model::ordered_job::JobType::FlinkJob(v.into()));
23277 self
23278 }
23279}
23280
23281impl wkt::message::Message for OrderedJob {
23282 fn typename() -> &'static str {
23283 "type.googleapis.com/google.cloud.dataproc.v1.OrderedJob"
23284 }
23285}
23286
23287/// Defines additional types related to [OrderedJob].
23288pub mod ordered_job {
23289 #[allow(unused_imports)]
23290 use super::*;
23291
23292 /// Required. The job definition.
23293 #[derive(Clone, Debug, PartialEq)]
23294 #[non_exhaustive]
23295 pub enum JobType {
23296 /// Optional. Job is a Hadoop job.
23297 HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
23298 /// Optional. Job is a Spark job.
23299 SparkJob(std::boxed::Box<crate::model::SparkJob>),
23300 /// Optional. Job is a PySpark job.
23301 PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
23302 /// Optional. Job is a Hive job.
23303 HiveJob(std::boxed::Box<crate::model::HiveJob>),
23304 /// Optional. Job is a Pig job.
23305 PigJob(std::boxed::Box<crate::model::PigJob>),
23306 /// Optional. Job is a SparkR job.
23307 SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
23308 /// Optional. Job is a SparkSql job.
23309 SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
23310 /// Optional. Job is a Presto job.
23311 PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
23312 /// Optional. Job is a Trino job.
23313 TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
23314 /// Optional. Job is a Flink job.
23315 FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
23316 }
23317}
23318
23319/// A configurable parameter that replaces one or more fields in the template.
23320/// Parameterizable fields:
23321///
23322/// - Labels
23323/// - File uris
23324/// - Job properties
23325/// - Job arguments
23326/// - Script variables
23327/// - Main class (in HadoopJob and SparkJob)
23328/// - Zone (in ClusterSelector)
23329#[derive(Clone, Default, PartialEq)]
23330#[non_exhaustive]
23331pub struct TemplateParameter {
23332 /// Required. Parameter name.
23333 /// The parameter name is used as the key, and paired with the
23334 /// parameter value, which are passed to the template when the template
23335 /// is instantiated.
23336 /// The name must contain only capital letters (A-Z), numbers (0-9), and
23337 /// underscores (_), and must not start with a number. The maximum length is
23338 /// 40 characters.
23339 pub name: std::string::String,
23340
23341 /// Required. Paths to all fields that the parameter replaces.
23342 /// A field is allowed to appear in at most one parameter's list of field
23343 /// paths.
23344 ///
23345 /// A field path is similar in syntax to a
23346 /// [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a
23347 /// field path that references the zone field of a workflow template's cluster
23348 /// selector would be specified as `placement.clusterSelector.zone`.
23349 ///
23350 /// Also, field paths can reference fields using the following syntax:
23351 ///
23352 /// * Values in maps can be referenced by key:
23353 ///
23354 /// * labels['key']
23355 /// * placement.clusterSelector.clusterLabels['key']
23356 /// * placement.managedCluster.labels['key']
23357 /// * placement.clusterSelector.clusterLabels['key']
23358 /// * jobs['step-id'].labels['key']
23359 /// * Jobs in the jobs list can be referenced by step-id:
23360 ///
23361 /// * jobs['step-id'].hadoopJob.mainJarFileUri
23362 /// * jobs['step-id'].hiveJob.queryFileUri
23363 /// * jobs['step-id'].pySparkJob.mainPythonFileUri
23364 /// * jobs['step-id'].hadoopJob.jarFileUris[0]
23365 /// * jobs['step-id'].hadoopJob.archiveUris[0]
23366 /// * jobs['step-id'].hadoopJob.fileUris[0]
23367 /// * jobs['step-id'].pySparkJob.pythonFileUris[0]
23368 /// * Items in repeated fields can be referenced by a zero-based index:
23369 ///
23370 /// * jobs['step-id'].sparkJob.args[0]
23371 /// * Other examples:
23372 ///
23373 /// * jobs['step-id'].hadoopJob.properties['key']
23374 /// * jobs['step-id'].hadoopJob.args[0]
23375 /// * jobs['step-id'].hiveJob.scriptVariables['key']
23376 /// * jobs['step-id'].hadoopJob.mainJarFileUri
23377 /// * placement.clusterSelector.zone
23378 ///
23379 /// It may not be possible to parameterize maps and repeated fields in their
23380 /// entirety since only individual map values and individual items in repeated
23381 /// fields can be referenced. For example, the following field paths are
23382 /// invalid:
23383 ///
23384 /// - placement.clusterSelector.clusterLabels
23385 /// - jobs['step-id'].sparkJob.args
23386 ///
23387 /// [google.protobuf.FieldMask]: wkt::FieldMask
23388 pub fields: std::vec::Vec<std::string::String>,
23389
23390 /// Optional. Brief description of the parameter.
23391 /// Must not exceed 1024 characters.
23392 pub description: std::string::String,
23393
23394 /// Optional. Validation rules to be applied to this parameter's value.
23395 pub validation: std::option::Option<crate::model::ParameterValidation>,
23396
23397 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23398}
23399
23400impl TemplateParameter {
23401 pub fn new() -> Self {
23402 std::default::Default::default()
23403 }
23404
23405 /// Sets the value of [name][crate::model::TemplateParameter::name].
23406 ///
23407 /// # Example
23408 /// ```ignore,no_run
23409 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23410 /// let x = TemplateParameter::new().set_name("example");
23411 /// ```
23412 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23413 self.name = v.into();
23414 self
23415 }
23416
23417 /// Sets the value of [fields][crate::model::TemplateParameter::fields].
23418 ///
23419 /// # Example
23420 /// ```ignore,no_run
23421 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23422 /// let x = TemplateParameter::new().set_fields(["a", "b", "c"]);
23423 /// ```
23424 pub fn set_fields<T, V>(mut self, v: T) -> Self
23425 where
23426 T: std::iter::IntoIterator<Item = V>,
23427 V: std::convert::Into<std::string::String>,
23428 {
23429 use std::iter::Iterator;
23430 self.fields = v.into_iter().map(|i| i.into()).collect();
23431 self
23432 }
23433
23434 /// Sets the value of [description][crate::model::TemplateParameter::description].
23435 ///
23436 /// # Example
23437 /// ```ignore,no_run
23438 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23439 /// let x = TemplateParameter::new().set_description("example");
23440 /// ```
23441 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23442 self.description = v.into();
23443 self
23444 }
23445
23446 /// Sets the value of [validation][crate::model::TemplateParameter::validation].
23447 ///
23448 /// # Example
23449 /// ```ignore,no_run
23450 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23451 /// use google_cloud_dataproc_v1::model::ParameterValidation;
23452 /// let x = TemplateParameter::new().set_validation(ParameterValidation::default()/* use setters */);
23453 /// ```
23454 pub fn set_validation<T>(mut self, v: T) -> Self
23455 where
23456 T: std::convert::Into<crate::model::ParameterValidation>,
23457 {
23458 self.validation = std::option::Option::Some(v.into());
23459 self
23460 }
23461
23462 /// Sets or clears the value of [validation][crate::model::TemplateParameter::validation].
23463 ///
23464 /// # Example
23465 /// ```ignore,no_run
23466 /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23467 /// use google_cloud_dataproc_v1::model::ParameterValidation;
23468 /// let x = TemplateParameter::new().set_or_clear_validation(Some(ParameterValidation::default()/* use setters */));
23469 /// let x = TemplateParameter::new().set_or_clear_validation(None::<ParameterValidation>);
23470 /// ```
23471 pub fn set_or_clear_validation<T>(mut self, v: std::option::Option<T>) -> Self
23472 where
23473 T: std::convert::Into<crate::model::ParameterValidation>,
23474 {
23475 self.validation = v.map(|x| x.into());
23476 self
23477 }
23478}
23479
23480impl wkt::message::Message for TemplateParameter {
23481 fn typename() -> &'static str {
23482 "type.googleapis.com/google.cloud.dataproc.v1.TemplateParameter"
23483 }
23484}
23485
23486/// Configuration for parameter validation.
23487#[derive(Clone, Default, PartialEq)]
23488#[non_exhaustive]
23489pub struct ParameterValidation {
23490 /// Required. The type of validation to be performed.
23491 pub validation_type: std::option::Option<crate::model::parameter_validation::ValidationType>,
23492
23493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23494}
23495
23496impl ParameterValidation {
23497 pub fn new() -> Self {
23498 std::default::Default::default()
23499 }
23500
23501 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type].
23502 ///
23503 /// Note that all the setters affecting `validation_type` are mutually
23504 /// exclusive.
23505 ///
23506 /// # Example
23507 /// ```ignore,no_run
23508 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23509 /// use google_cloud_dataproc_v1::model::RegexValidation;
23510 /// let x = ParameterValidation::new().set_validation_type(Some(
23511 /// google_cloud_dataproc_v1::model::parameter_validation::ValidationType::Regex(RegexValidation::default().into())));
23512 /// ```
23513 pub fn set_validation_type<
23514 T: std::convert::Into<std::option::Option<crate::model::parameter_validation::ValidationType>>,
23515 >(
23516 mut self,
23517 v: T,
23518 ) -> Self {
23519 self.validation_type = v.into();
23520 self
23521 }
23522
23523 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
23524 /// if it holds a `Regex`, `None` if the field is not set or
23525 /// holds a different branch.
23526 pub fn regex(&self) -> std::option::Option<&std::boxed::Box<crate::model::RegexValidation>> {
23527 #[allow(unreachable_patterns)]
23528 self.validation_type.as_ref().and_then(|v| match v {
23529 crate::model::parameter_validation::ValidationType::Regex(v) => {
23530 std::option::Option::Some(v)
23531 }
23532 _ => std::option::Option::None,
23533 })
23534 }
23535
23536 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
23537 /// to hold a `Regex`.
23538 ///
23539 /// Note that all the setters affecting `validation_type` are
23540 /// mutually exclusive.
23541 ///
23542 /// # Example
23543 /// ```ignore,no_run
23544 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23545 /// use google_cloud_dataproc_v1::model::RegexValidation;
23546 /// let x = ParameterValidation::new().set_regex(RegexValidation::default()/* use setters */);
23547 /// assert!(x.regex().is_some());
23548 /// assert!(x.values().is_none());
23549 /// ```
23550 pub fn set_regex<T: std::convert::Into<std::boxed::Box<crate::model::RegexValidation>>>(
23551 mut self,
23552 v: T,
23553 ) -> Self {
23554 self.validation_type = std::option::Option::Some(
23555 crate::model::parameter_validation::ValidationType::Regex(v.into()),
23556 );
23557 self
23558 }
23559
23560 /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
23561 /// if it holds a `Values`, `None` if the field is not set or
23562 /// holds a different branch.
23563 pub fn values(&self) -> std::option::Option<&std::boxed::Box<crate::model::ValueValidation>> {
23564 #[allow(unreachable_patterns)]
23565 self.validation_type.as_ref().and_then(|v| match v {
23566 crate::model::parameter_validation::ValidationType::Values(v) => {
23567 std::option::Option::Some(v)
23568 }
23569 _ => std::option::Option::None,
23570 })
23571 }
23572
23573 /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
23574 /// to hold a `Values`.
23575 ///
23576 /// Note that all the setters affecting `validation_type` are
23577 /// mutually exclusive.
23578 ///
23579 /// # Example
23580 /// ```ignore,no_run
23581 /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23582 /// use google_cloud_dataproc_v1::model::ValueValidation;
23583 /// let x = ParameterValidation::new().set_values(ValueValidation::default()/* use setters */);
23584 /// assert!(x.values().is_some());
23585 /// assert!(x.regex().is_none());
23586 /// ```
23587 pub fn set_values<T: std::convert::Into<std::boxed::Box<crate::model::ValueValidation>>>(
23588 mut self,
23589 v: T,
23590 ) -> Self {
23591 self.validation_type = std::option::Option::Some(
23592 crate::model::parameter_validation::ValidationType::Values(v.into()),
23593 );
23594 self
23595 }
23596}
23597
23598impl wkt::message::Message for ParameterValidation {
23599 fn typename() -> &'static str {
23600 "type.googleapis.com/google.cloud.dataproc.v1.ParameterValidation"
23601 }
23602}
23603
23604/// Defines additional types related to [ParameterValidation].
23605pub mod parameter_validation {
23606 #[allow(unused_imports)]
23607 use super::*;
23608
23609 /// Required. The type of validation to be performed.
23610 #[derive(Clone, Debug, PartialEq)]
23611 #[non_exhaustive]
23612 pub enum ValidationType {
23613 /// Validation based on regular expressions.
23614 Regex(std::boxed::Box<crate::model::RegexValidation>),
23615 /// Validation based on a list of allowed values.
23616 Values(std::boxed::Box<crate::model::ValueValidation>),
23617 }
23618}
23619
23620/// Validation based on regular expressions.
23621#[derive(Clone, Default, PartialEq)]
23622#[non_exhaustive]
23623pub struct RegexValidation {
23624 /// Required. RE2 regular expressions used to validate the parameter's value.
23625 /// The value must match the regex in its entirety (substring
23626 /// matches are not sufficient).
23627 pub regexes: std::vec::Vec<std::string::String>,
23628
23629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23630}
23631
23632impl RegexValidation {
23633 pub fn new() -> Self {
23634 std::default::Default::default()
23635 }
23636
23637 /// Sets the value of [regexes][crate::model::RegexValidation::regexes].
23638 ///
23639 /// # Example
23640 /// ```ignore,no_run
23641 /// # use google_cloud_dataproc_v1::model::RegexValidation;
23642 /// let x = RegexValidation::new().set_regexes(["a", "b", "c"]);
23643 /// ```
23644 pub fn set_regexes<T, V>(mut self, v: T) -> Self
23645 where
23646 T: std::iter::IntoIterator<Item = V>,
23647 V: std::convert::Into<std::string::String>,
23648 {
23649 use std::iter::Iterator;
23650 self.regexes = v.into_iter().map(|i| i.into()).collect();
23651 self
23652 }
23653}
23654
23655impl wkt::message::Message for RegexValidation {
23656 fn typename() -> &'static str {
23657 "type.googleapis.com/google.cloud.dataproc.v1.RegexValidation"
23658 }
23659}
23660
23661/// Validation based on a list of allowed values.
23662#[derive(Clone, Default, PartialEq)]
23663#[non_exhaustive]
23664pub struct ValueValidation {
23665 /// Required. List of allowed values for the parameter.
23666 pub values: std::vec::Vec<std::string::String>,
23667
23668 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23669}
23670
23671impl ValueValidation {
23672 pub fn new() -> Self {
23673 std::default::Default::default()
23674 }
23675
23676 /// Sets the value of [values][crate::model::ValueValidation::values].
23677 ///
23678 /// # Example
23679 /// ```ignore,no_run
23680 /// # use google_cloud_dataproc_v1::model::ValueValidation;
23681 /// let x = ValueValidation::new().set_values(["a", "b", "c"]);
23682 /// ```
23683 pub fn set_values<T, V>(mut self, v: T) -> Self
23684 where
23685 T: std::iter::IntoIterator<Item = V>,
23686 V: std::convert::Into<std::string::String>,
23687 {
23688 use std::iter::Iterator;
23689 self.values = v.into_iter().map(|i| i.into()).collect();
23690 self
23691 }
23692}
23693
23694impl wkt::message::Message for ValueValidation {
23695 fn typename() -> &'static str {
23696 "type.googleapis.com/google.cloud.dataproc.v1.ValueValidation"
23697 }
23698}
23699
23700/// A Dataproc workflow template resource.
23701#[derive(Clone, Default, PartialEq)]
23702#[non_exhaustive]
23703pub struct WorkflowMetadata {
23704 /// Output only. The resource name of the workflow template as described
23705 /// in <https://cloud.google.com/apis/design/resource_names>.
23706 ///
23707 /// * For `projects.regions.workflowTemplates`, the resource name of the
23708 /// template has the following format:
23709 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
23710 ///
23711 /// * For `projects.locations.workflowTemplates`, the resource name of the
23712 /// template has the following format:
23713 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
23714 ///
23715 pub template: std::string::String,
23716
23717 /// Output only. The version of template at the time of
23718 /// workflow instantiation.
23719 pub version: i32,
23720
23721 /// Output only. The create cluster operation metadata.
23722 pub create_cluster: std::option::Option<crate::model::ClusterOperation>,
23723
23724 /// Output only. The workflow graph.
23725 pub graph: std::option::Option<crate::model::WorkflowGraph>,
23726
23727 /// Output only. The delete cluster operation metadata.
23728 pub delete_cluster: std::option::Option<crate::model::ClusterOperation>,
23729
23730 /// Output only. The workflow state.
23731 pub state: crate::model::workflow_metadata::State,
23732
23733 /// Output only. The name of the target cluster.
23734 pub cluster_name: std::string::String,
23735
23736 /// Map from parameter names to values that were used for those parameters.
23737 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
23738
23739 /// Output only. Workflow start time.
23740 pub start_time: std::option::Option<wkt::Timestamp>,
23741
23742 /// Output only. Workflow end time.
23743 pub end_time: std::option::Option<wkt::Timestamp>,
23744
23745 /// Output only. The UUID of target cluster.
23746 pub cluster_uuid: std::string::String,
23747
23748 /// Output only. The timeout duration for the DAG of jobs, expressed in seconds
23749 /// (see [JSON representation of
23750 /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
23751 pub dag_timeout: std::option::Option<wkt::Duration>,
23752
23753 /// Output only. DAG start time, only set for workflows with
23754 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
23755 /// DAG begins.
23756 ///
23757 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
23758 pub dag_start_time: std::option::Option<wkt::Timestamp>,
23759
23760 /// Output only. DAG end time, only set for workflows with
23761 /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
23762 /// DAG ends.
23763 ///
23764 /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
23765 pub dag_end_time: std::option::Option<wkt::Timestamp>,
23766
23767 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23768}
23769
23770impl WorkflowMetadata {
23771 pub fn new() -> Self {
23772 std::default::Default::default()
23773 }
23774
23775 /// Sets the value of [template][crate::model::WorkflowMetadata::template].
23776 ///
23777 /// # Example
23778 /// ```ignore,no_run
23779 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23780 /// let x = WorkflowMetadata::new().set_template("example");
23781 /// ```
23782 pub fn set_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23783 self.template = v.into();
23784 self
23785 }
23786
23787 /// Sets the value of [version][crate::model::WorkflowMetadata::version].
23788 ///
23789 /// # Example
23790 /// ```ignore,no_run
23791 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23792 /// let x = WorkflowMetadata::new().set_version(42);
23793 /// ```
23794 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23795 self.version = v.into();
23796 self
23797 }
23798
23799 /// Sets the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
23800 ///
23801 /// # Example
23802 /// ```ignore,no_run
23803 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23804 /// use google_cloud_dataproc_v1::model::ClusterOperation;
23805 /// let x = WorkflowMetadata::new().set_create_cluster(ClusterOperation::default()/* use setters */);
23806 /// ```
23807 pub fn set_create_cluster<T>(mut self, v: T) -> Self
23808 where
23809 T: std::convert::Into<crate::model::ClusterOperation>,
23810 {
23811 self.create_cluster = std::option::Option::Some(v.into());
23812 self
23813 }
23814
23815 /// Sets or clears the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
23816 ///
23817 /// # Example
23818 /// ```ignore,no_run
23819 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23820 /// use google_cloud_dataproc_v1::model::ClusterOperation;
23821 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(Some(ClusterOperation::default()/* use setters */));
23822 /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(None::<ClusterOperation>);
23823 /// ```
23824 pub fn set_or_clear_create_cluster<T>(mut self, v: std::option::Option<T>) -> Self
23825 where
23826 T: std::convert::Into<crate::model::ClusterOperation>,
23827 {
23828 self.create_cluster = v.map(|x| x.into());
23829 self
23830 }
23831
23832 /// Sets the value of [graph][crate::model::WorkflowMetadata::graph].
23833 ///
23834 /// # Example
23835 /// ```ignore,no_run
23836 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23837 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
23838 /// let x = WorkflowMetadata::new().set_graph(WorkflowGraph::default()/* use setters */);
23839 /// ```
23840 pub fn set_graph<T>(mut self, v: T) -> Self
23841 where
23842 T: std::convert::Into<crate::model::WorkflowGraph>,
23843 {
23844 self.graph = std::option::Option::Some(v.into());
23845 self
23846 }
23847
23848 /// Sets or clears the value of [graph][crate::model::WorkflowMetadata::graph].
23849 ///
23850 /// # Example
23851 /// ```ignore,no_run
23852 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23853 /// use google_cloud_dataproc_v1::model::WorkflowGraph;
23854 /// let x = WorkflowMetadata::new().set_or_clear_graph(Some(WorkflowGraph::default()/* use setters */));
23855 /// let x = WorkflowMetadata::new().set_or_clear_graph(None::<WorkflowGraph>);
23856 /// ```
23857 pub fn set_or_clear_graph<T>(mut self, v: std::option::Option<T>) -> Self
23858 where
23859 T: std::convert::Into<crate::model::WorkflowGraph>,
23860 {
23861 self.graph = v.map(|x| x.into());
23862 self
23863 }
23864
23865 /// Sets the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
23866 ///
23867 /// # Example
23868 /// ```ignore,no_run
23869 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23870 /// use google_cloud_dataproc_v1::model::ClusterOperation;
23871 /// let x = WorkflowMetadata::new().set_delete_cluster(ClusterOperation::default()/* use setters */);
23872 /// ```
23873 pub fn set_delete_cluster<T>(mut self, v: T) -> Self
23874 where
23875 T: std::convert::Into<crate::model::ClusterOperation>,
23876 {
23877 self.delete_cluster = std::option::Option::Some(v.into());
23878 self
23879 }
23880
23881 /// Sets or clears the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
23882 ///
23883 /// # Example
23884 /// ```ignore,no_run
23885 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23886 /// use google_cloud_dataproc_v1::model::ClusterOperation;
23887 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(Some(ClusterOperation::default()/* use setters */));
23888 /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(None::<ClusterOperation>);
23889 /// ```
23890 pub fn set_or_clear_delete_cluster<T>(mut self, v: std::option::Option<T>) -> Self
23891 where
23892 T: std::convert::Into<crate::model::ClusterOperation>,
23893 {
23894 self.delete_cluster = v.map(|x| x.into());
23895 self
23896 }
23897
23898 /// Sets the value of [state][crate::model::WorkflowMetadata::state].
23899 ///
23900 /// # Example
23901 /// ```ignore,no_run
23902 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23903 /// use google_cloud_dataproc_v1::model::workflow_metadata::State;
23904 /// let x0 = WorkflowMetadata::new().set_state(State::Pending);
23905 /// let x1 = WorkflowMetadata::new().set_state(State::Running);
23906 /// let x2 = WorkflowMetadata::new().set_state(State::Done);
23907 /// ```
23908 pub fn set_state<T: std::convert::Into<crate::model::workflow_metadata::State>>(
23909 mut self,
23910 v: T,
23911 ) -> Self {
23912 self.state = v.into();
23913 self
23914 }
23915
23916 /// Sets the value of [cluster_name][crate::model::WorkflowMetadata::cluster_name].
23917 ///
23918 /// # Example
23919 /// ```ignore,no_run
23920 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23921 /// let x = WorkflowMetadata::new().set_cluster_name("example");
23922 /// ```
23923 pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23924 self.cluster_name = v.into();
23925 self
23926 }
23927
23928 /// Sets the value of [parameters][crate::model::WorkflowMetadata::parameters].
23929 ///
23930 /// # Example
23931 /// ```ignore,no_run
23932 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23933 /// let x = WorkflowMetadata::new().set_parameters([
23934 /// ("key0", "abc"),
23935 /// ("key1", "xyz"),
23936 /// ]);
23937 /// ```
23938 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
23939 where
23940 T: std::iter::IntoIterator<Item = (K, V)>,
23941 K: std::convert::Into<std::string::String>,
23942 V: std::convert::Into<std::string::String>,
23943 {
23944 use std::iter::Iterator;
23945 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23946 self
23947 }
23948
23949 /// Sets the value of [start_time][crate::model::WorkflowMetadata::start_time].
23950 ///
23951 /// # Example
23952 /// ```ignore,no_run
23953 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23954 /// use wkt::Timestamp;
23955 /// let x = WorkflowMetadata::new().set_start_time(Timestamp::default()/* use setters */);
23956 /// ```
23957 pub fn set_start_time<T>(mut self, v: T) -> Self
23958 where
23959 T: std::convert::Into<wkt::Timestamp>,
23960 {
23961 self.start_time = std::option::Option::Some(v.into());
23962 self
23963 }
23964
23965 /// Sets or clears the value of [start_time][crate::model::WorkflowMetadata::start_time].
23966 ///
23967 /// # Example
23968 /// ```ignore,no_run
23969 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23970 /// use wkt::Timestamp;
23971 /// let x = WorkflowMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
23972 /// let x = WorkflowMetadata::new().set_or_clear_start_time(None::<Timestamp>);
23973 /// ```
23974 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
23975 where
23976 T: std::convert::Into<wkt::Timestamp>,
23977 {
23978 self.start_time = v.map(|x| x.into());
23979 self
23980 }
23981
23982 /// Sets the value of [end_time][crate::model::WorkflowMetadata::end_time].
23983 ///
23984 /// # Example
23985 /// ```ignore,no_run
23986 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
23987 /// use wkt::Timestamp;
23988 /// let x = WorkflowMetadata::new().set_end_time(Timestamp::default()/* use setters */);
23989 /// ```
23990 pub fn set_end_time<T>(mut self, v: T) -> Self
23991 where
23992 T: std::convert::Into<wkt::Timestamp>,
23993 {
23994 self.end_time = std::option::Option::Some(v.into());
23995 self
23996 }
23997
23998 /// Sets or clears the value of [end_time][crate::model::WorkflowMetadata::end_time].
23999 ///
24000 /// # Example
24001 /// ```ignore,no_run
24002 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24003 /// use wkt::Timestamp;
24004 /// let x = WorkflowMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
24005 /// let x = WorkflowMetadata::new().set_or_clear_end_time(None::<Timestamp>);
24006 /// ```
24007 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24008 where
24009 T: std::convert::Into<wkt::Timestamp>,
24010 {
24011 self.end_time = v.map(|x| x.into());
24012 self
24013 }
24014
24015 /// Sets the value of [cluster_uuid][crate::model::WorkflowMetadata::cluster_uuid].
24016 ///
24017 /// # Example
24018 /// ```ignore,no_run
24019 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24020 /// let x = WorkflowMetadata::new().set_cluster_uuid("example");
24021 /// ```
24022 pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24023 self.cluster_uuid = v.into();
24024 self
24025 }
24026
24027 /// Sets the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24028 ///
24029 /// # Example
24030 /// ```ignore,no_run
24031 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24032 /// use wkt::Duration;
24033 /// let x = WorkflowMetadata::new().set_dag_timeout(Duration::default()/* use setters */);
24034 /// ```
24035 pub fn set_dag_timeout<T>(mut self, v: T) -> Self
24036 where
24037 T: std::convert::Into<wkt::Duration>,
24038 {
24039 self.dag_timeout = std::option::Option::Some(v.into());
24040 self
24041 }
24042
24043 /// Sets or clears the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24044 ///
24045 /// # Example
24046 /// ```ignore,no_run
24047 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24048 /// use wkt::Duration;
24049 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
24050 /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(None::<Duration>);
24051 /// ```
24052 pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
24053 where
24054 T: std::convert::Into<wkt::Duration>,
24055 {
24056 self.dag_timeout = v.map(|x| x.into());
24057 self
24058 }
24059
24060 /// Sets the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24061 ///
24062 /// # Example
24063 /// ```ignore,no_run
24064 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24065 /// use wkt::Timestamp;
24066 /// let x = WorkflowMetadata::new().set_dag_start_time(Timestamp::default()/* use setters */);
24067 /// ```
24068 pub fn set_dag_start_time<T>(mut self, v: T) -> Self
24069 where
24070 T: std::convert::Into<wkt::Timestamp>,
24071 {
24072 self.dag_start_time = std::option::Option::Some(v.into());
24073 self
24074 }
24075
24076 /// Sets or clears the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24077 ///
24078 /// # Example
24079 /// ```ignore,no_run
24080 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24081 /// use wkt::Timestamp;
24082 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(Some(Timestamp::default()/* use setters */));
24083 /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(None::<Timestamp>);
24084 /// ```
24085 pub fn set_or_clear_dag_start_time<T>(mut self, v: std::option::Option<T>) -> Self
24086 where
24087 T: std::convert::Into<wkt::Timestamp>,
24088 {
24089 self.dag_start_time = v.map(|x| x.into());
24090 self
24091 }
24092
24093 /// Sets the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24094 ///
24095 /// # Example
24096 /// ```ignore,no_run
24097 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24098 /// use wkt::Timestamp;
24099 /// let x = WorkflowMetadata::new().set_dag_end_time(Timestamp::default()/* use setters */);
24100 /// ```
24101 pub fn set_dag_end_time<T>(mut self, v: T) -> Self
24102 where
24103 T: std::convert::Into<wkt::Timestamp>,
24104 {
24105 self.dag_end_time = std::option::Option::Some(v.into());
24106 self
24107 }
24108
24109 /// Sets or clears the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24110 ///
24111 /// # Example
24112 /// ```ignore,no_run
24113 /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24114 /// use wkt::Timestamp;
24115 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(Some(Timestamp::default()/* use setters */));
24116 /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(None::<Timestamp>);
24117 /// ```
24118 pub fn set_or_clear_dag_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24119 where
24120 T: std::convert::Into<wkt::Timestamp>,
24121 {
24122 self.dag_end_time = v.map(|x| x.into());
24123 self
24124 }
24125}
24126
24127impl wkt::message::Message for WorkflowMetadata {
24128 fn typename() -> &'static str {
24129 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowMetadata"
24130 }
24131}
24132
24133/// Defines additional types related to [WorkflowMetadata].
24134pub mod workflow_metadata {
24135 #[allow(unused_imports)]
24136 use super::*;
24137
24138 /// The operation state.
24139 ///
24140 /// # Working with unknown values
24141 ///
24142 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24143 /// additional enum variants at any time. Adding new variants is not considered
24144 /// a breaking change. Applications should write their code in anticipation of:
24145 ///
24146 /// - New values appearing in future releases of the client library, **and**
24147 /// - New values received dynamically, without application changes.
24148 ///
24149 /// Please consult the [Working with enums] section in the user guide for some
24150 /// guidelines.
24151 ///
24152 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24153 #[derive(Clone, Debug, PartialEq)]
24154 #[non_exhaustive]
24155 pub enum State {
24156 /// Unused.
24157 Unknown,
24158 /// The operation has been created.
24159 Pending,
24160 /// The operation is running.
24161 Running,
24162 /// The operation is done; either cancelled or completed.
24163 Done,
24164 /// If set, the enum was initialized with an unknown value.
24165 ///
24166 /// Applications can examine the value using [State::value] or
24167 /// [State::name].
24168 UnknownValue(state::UnknownValue),
24169 }
24170
24171 #[doc(hidden)]
24172 pub mod state {
24173 #[allow(unused_imports)]
24174 use super::*;
24175 #[derive(Clone, Debug, PartialEq)]
24176 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24177 }
24178
24179 impl State {
24180 /// Gets the enum value.
24181 ///
24182 /// Returns `None` if the enum contains an unknown value deserialized from
24183 /// the string representation of enums.
24184 pub fn value(&self) -> std::option::Option<i32> {
24185 match self {
24186 Self::Unknown => std::option::Option::Some(0),
24187 Self::Pending => std::option::Option::Some(1),
24188 Self::Running => std::option::Option::Some(2),
24189 Self::Done => std::option::Option::Some(3),
24190 Self::UnknownValue(u) => u.0.value(),
24191 }
24192 }
24193
24194 /// Gets the enum value as a string.
24195 ///
24196 /// Returns `None` if the enum contains an unknown value deserialized from
24197 /// the integer representation of enums.
24198 pub fn name(&self) -> std::option::Option<&str> {
24199 match self {
24200 Self::Unknown => std::option::Option::Some("UNKNOWN"),
24201 Self::Pending => std::option::Option::Some("PENDING"),
24202 Self::Running => std::option::Option::Some("RUNNING"),
24203 Self::Done => std::option::Option::Some("DONE"),
24204 Self::UnknownValue(u) => u.0.name(),
24205 }
24206 }
24207 }
24208
24209 impl std::default::Default for State {
24210 fn default() -> Self {
24211 use std::convert::From;
24212 Self::from(0)
24213 }
24214 }
24215
24216 impl std::fmt::Display for State {
24217 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24218 wkt::internal::display_enum(f, self.name(), self.value())
24219 }
24220 }
24221
24222 impl std::convert::From<i32> for State {
24223 fn from(value: i32) -> Self {
24224 match value {
24225 0 => Self::Unknown,
24226 1 => Self::Pending,
24227 2 => Self::Running,
24228 3 => Self::Done,
24229 _ => Self::UnknownValue(state::UnknownValue(
24230 wkt::internal::UnknownEnumValue::Integer(value),
24231 )),
24232 }
24233 }
24234 }
24235
24236 impl std::convert::From<&str> for State {
24237 fn from(value: &str) -> Self {
24238 use std::string::ToString;
24239 match value {
24240 "UNKNOWN" => Self::Unknown,
24241 "PENDING" => Self::Pending,
24242 "RUNNING" => Self::Running,
24243 "DONE" => Self::Done,
24244 _ => Self::UnknownValue(state::UnknownValue(
24245 wkt::internal::UnknownEnumValue::String(value.to_string()),
24246 )),
24247 }
24248 }
24249 }
24250
24251 impl serde::ser::Serialize for State {
24252 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24253 where
24254 S: serde::Serializer,
24255 {
24256 match self {
24257 Self::Unknown => serializer.serialize_i32(0),
24258 Self::Pending => serializer.serialize_i32(1),
24259 Self::Running => serializer.serialize_i32(2),
24260 Self::Done => serializer.serialize_i32(3),
24261 Self::UnknownValue(u) => u.0.serialize(serializer),
24262 }
24263 }
24264 }
24265
24266 impl<'de> serde::de::Deserialize<'de> for State {
24267 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24268 where
24269 D: serde::Deserializer<'de>,
24270 {
24271 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
24272 ".google.cloud.dataproc.v1.WorkflowMetadata.State",
24273 ))
24274 }
24275 }
24276}
24277
24278/// The cluster operation triggered by a workflow.
24279#[derive(Clone, Default, PartialEq)]
24280#[non_exhaustive]
24281pub struct ClusterOperation {
24282 /// Output only. The id of the cluster operation.
24283 pub operation_id: std::string::String,
24284
24285 /// Output only. Error, if operation failed.
24286 pub error: std::string::String,
24287
24288 /// Output only. Indicates the operation is done.
24289 pub done: bool,
24290
24291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24292}
24293
24294impl ClusterOperation {
24295 pub fn new() -> Self {
24296 std::default::Default::default()
24297 }
24298
24299 /// Sets the value of [operation_id][crate::model::ClusterOperation::operation_id].
24300 ///
24301 /// # Example
24302 /// ```ignore,no_run
24303 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24304 /// let x = ClusterOperation::new().set_operation_id("example");
24305 /// ```
24306 pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24307 self.operation_id = v.into();
24308 self
24309 }
24310
24311 /// Sets the value of [error][crate::model::ClusterOperation::error].
24312 ///
24313 /// # Example
24314 /// ```ignore,no_run
24315 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24316 /// let x = ClusterOperation::new().set_error("example");
24317 /// ```
24318 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24319 self.error = v.into();
24320 self
24321 }
24322
24323 /// Sets the value of [done][crate::model::ClusterOperation::done].
24324 ///
24325 /// # Example
24326 /// ```ignore,no_run
24327 /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24328 /// let x = ClusterOperation::new().set_done(true);
24329 /// ```
24330 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24331 self.done = v.into();
24332 self
24333 }
24334}
24335
24336impl wkt::message::Message for ClusterOperation {
24337 fn typename() -> &'static str {
24338 "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperation"
24339 }
24340}
24341
24342/// The workflow graph.
24343#[derive(Clone, Default, PartialEq)]
24344#[non_exhaustive]
24345pub struct WorkflowGraph {
24346 /// Output only. The workflow nodes.
24347 pub nodes: std::vec::Vec<crate::model::WorkflowNode>,
24348
24349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24350}
24351
24352impl WorkflowGraph {
24353 pub fn new() -> Self {
24354 std::default::Default::default()
24355 }
24356
24357 /// Sets the value of [nodes][crate::model::WorkflowGraph::nodes].
24358 ///
24359 /// # Example
24360 /// ```ignore,no_run
24361 /// # use google_cloud_dataproc_v1::model::WorkflowGraph;
24362 /// use google_cloud_dataproc_v1::model::WorkflowNode;
24363 /// let x = WorkflowGraph::new()
24364 /// .set_nodes([
24365 /// WorkflowNode::default()/* use setters */,
24366 /// WorkflowNode::default()/* use (different) setters */,
24367 /// ]);
24368 /// ```
24369 pub fn set_nodes<T, V>(mut self, v: T) -> Self
24370 where
24371 T: std::iter::IntoIterator<Item = V>,
24372 V: std::convert::Into<crate::model::WorkflowNode>,
24373 {
24374 use std::iter::Iterator;
24375 self.nodes = v.into_iter().map(|i| i.into()).collect();
24376 self
24377 }
24378}
24379
24380impl wkt::message::Message for WorkflowGraph {
24381 fn typename() -> &'static str {
24382 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowGraph"
24383 }
24384}
24385
24386/// The workflow node.
24387#[derive(Clone, Default, PartialEq)]
24388#[non_exhaustive]
24389pub struct WorkflowNode {
24390 /// Output only. The name of the node.
24391 pub step_id: std::string::String,
24392
24393 /// Output only. Node's prerequisite nodes.
24394 pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
24395
24396 /// Output only. The job id; populated after the node enters RUNNING state.
24397 pub job_id: std::string::String,
24398
24399 /// Output only. The node state.
24400 pub state: crate::model::workflow_node::NodeState,
24401
24402 /// Output only. The error detail.
24403 pub error: std::string::String,
24404
24405 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24406}
24407
24408impl WorkflowNode {
24409 pub fn new() -> Self {
24410 std::default::Default::default()
24411 }
24412
24413 /// Sets the value of [step_id][crate::model::WorkflowNode::step_id].
24414 ///
24415 /// # Example
24416 /// ```ignore,no_run
24417 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24418 /// let x = WorkflowNode::new().set_step_id("example");
24419 /// ```
24420 pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24421 self.step_id = v.into();
24422 self
24423 }
24424
24425 /// Sets the value of [prerequisite_step_ids][crate::model::WorkflowNode::prerequisite_step_ids].
24426 ///
24427 /// # Example
24428 /// ```ignore,no_run
24429 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24430 /// let x = WorkflowNode::new().set_prerequisite_step_ids(["a", "b", "c"]);
24431 /// ```
24432 pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
24433 where
24434 T: std::iter::IntoIterator<Item = V>,
24435 V: std::convert::Into<std::string::String>,
24436 {
24437 use std::iter::Iterator;
24438 self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
24439 self
24440 }
24441
24442 /// Sets the value of [job_id][crate::model::WorkflowNode::job_id].
24443 ///
24444 /// # Example
24445 /// ```ignore,no_run
24446 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24447 /// let x = WorkflowNode::new().set_job_id("example");
24448 /// ```
24449 pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24450 self.job_id = v.into();
24451 self
24452 }
24453
24454 /// Sets the value of [state][crate::model::WorkflowNode::state].
24455 ///
24456 /// # Example
24457 /// ```ignore,no_run
24458 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24459 /// use google_cloud_dataproc_v1::model::workflow_node::NodeState;
24460 /// let x0 = WorkflowNode::new().set_state(NodeState::Blocked);
24461 /// let x1 = WorkflowNode::new().set_state(NodeState::Runnable);
24462 /// let x2 = WorkflowNode::new().set_state(NodeState::Running);
24463 /// ```
24464 pub fn set_state<T: std::convert::Into<crate::model::workflow_node::NodeState>>(
24465 mut self,
24466 v: T,
24467 ) -> Self {
24468 self.state = v.into();
24469 self
24470 }
24471
24472 /// Sets the value of [error][crate::model::WorkflowNode::error].
24473 ///
24474 /// # Example
24475 /// ```ignore,no_run
24476 /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24477 /// let x = WorkflowNode::new().set_error("example");
24478 /// ```
24479 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24480 self.error = v.into();
24481 self
24482 }
24483}
24484
24485impl wkt::message::Message for WorkflowNode {
24486 fn typename() -> &'static str {
24487 "type.googleapis.com/google.cloud.dataproc.v1.WorkflowNode"
24488 }
24489}
24490
24491/// Defines additional types related to [WorkflowNode].
24492pub mod workflow_node {
24493 #[allow(unused_imports)]
24494 use super::*;
24495
24496 /// The workflow node state.
24497 ///
24498 /// # Working with unknown values
24499 ///
24500 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24501 /// additional enum variants at any time. Adding new variants is not considered
24502 /// a breaking change. Applications should write their code in anticipation of:
24503 ///
24504 /// - New values appearing in future releases of the client library, **and**
24505 /// - New values received dynamically, without application changes.
24506 ///
24507 /// Please consult the [Working with enums] section in the user guide for some
24508 /// guidelines.
24509 ///
24510 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24511 #[derive(Clone, Debug, PartialEq)]
24512 #[non_exhaustive]
24513 pub enum NodeState {
24514 /// State is unspecified.
24515 Unspecified,
24516 /// The node is awaiting prerequisite node to finish.
24517 Blocked,
24518 /// The node is runnable but not running.
24519 Runnable,
24520 /// The node is running.
24521 Running,
24522 /// The node completed successfully.
24523 Completed,
24524 /// The node failed. A node can be marked FAILED because
24525 /// its ancestor or peer failed.
24526 Failed,
24527 /// If set, the enum was initialized with an unknown value.
24528 ///
24529 /// Applications can examine the value using [NodeState::value] or
24530 /// [NodeState::name].
24531 UnknownValue(node_state::UnknownValue),
24532 }
24533
24534 #[doc(hidden)]
24535 pub mod node_state {
24536 #[allow(unused_imports)]
24537 use super::*;
24538 #[derive(Clone, Debug, PartialEq)]
24539 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24540 }
24541
24542 impl NodeState {
24543 /// Gets the enum value.
24544 ///
24545 /// Returns `None` if the enum contains an unknown value deserialized from
24546 /// the string representation of enums.
24547 pub fn value(&self) -> std::option::Option<i32> {
24548 match self {
24549 Self::Unspecified => std::option::Option::Some(0),
24550 Self::Blocked => std::option::Option::Some(1),
24551 Self::Runnable => std::option::Option::Some(2),
24552 Self::Running => std::option::Option::Some(3),
24553 Self::Completed => std::option::Option::Some(4),
24554 Self::Failed => std::option::Option::Some(5),
24555 Self::UnknownValue(u) => u.0.value(),
24556 }
24557 }
24558
24559 /// Gets the enum value as a string.
24560 ///
24561 /// Returns `None` if the enum contains an unknown value deserialized from
24562 /// the integer representation of enums.
24563 pub fn name(&self) -> std::option::Option<&str> {
24564 match self {
24565 Self::Unspecified => std::option::Option::Some("NODE_STATE_UNSPECIFIED"),
24566 Self::Blocked => std::option::Option::Some("BLOCKED"),
24567 Self::Runnable => std::option::Option::Some("RUNNABLE"),
24568 Self::Running => std::option::Option::Some("RUNNING"),
24569 Self::Completed => std::option::Option::Some("COMPLETED"),
24570 Self::Failed => std::option::Option::Some("FAILED"),
24571 Self::UnknownValue(u) => u.0.name(),
24572 }
24573 }
24574 }
24575
24576 impl std::default::Default for NodeState {
24577 fn default() -> Self {
24578 use std::convert::From;
24579 Self::from(0)
24580 }
24581 }
24582
24583 impl std::fmt::Display for NodeState {
24584 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24585 wkt::internal::display_enum(f, self.name(), self.value())
24586 }
24587 }
24588
24589 impl std::convert::From<i32> for NodeState {
24590 fn from(value: i32) -> Self {
24591 match value {
24592 0 => Self::Unspecified,
24593 1 => Self::Blocked,
24594 2 => Self::Runnable,
24595 3 => Self::Running,
24596 4 => Self::Completed,
24597 5 => Self::Failed,
24598 _ => Self::UnknownValue(node_state::UnknownValue(
24599 wkt::internal::UnknownEnumValue::Integer(value),
24600 )),
24601 }
24602 }
24603 }
24604
24605 impl std::convert::From<&str> for NodeState {
24606 fn from(value: &str) -> Self {
24607 use std::string::ToString;
24608 match value {
24609 "NODE_STATE_UNSPECIFIED" => Self::Unspecified,
24610 "BLOCKED" => Self::Blocked,
24611 "RUNNABLE" => Self::Runnable,
24612 "RUNNING" => Self::Running,
24613 "COMPLETED" => Self::Completed,
24614 "FAILED" => Self::Failed,
24615 _ => Self::UnknownValue(node_state::UnknownValue(
24616 wkt::internal::UnknownEnumValue::String(value.to_string()),
24617 )),
24618 }
24619 }
24620 }
24621
24622 impl serde::ser::Serialize for NodeState {
24623 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24624 where
24625 S: serde::Serializer,
24626 {
24627 match self {
24628 Self::Unspecified => serializer.serialize_i32(0),
24629 Self::Blocked => serializer.serialize_i32(1),
24630 Self::Runnable => serializer.serialize_i32(2),
24631 Self::Running => serializer.serialize_i32(3),
24632 Self::Completed => serializer.serialize_i32(4),
24633 Self::Failed => serializer.serialize_i32(5),
24634 Self::UnknownValue(u) => u.0.serialize(serializer),
24635 }
24636 }
24637 }
24638
24639 impl<'de> serde::de::Deserialize<'de> for NodeState {
24640 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24641 where
24642 D: serde::Deserializer<'de>,
24643 {
24644 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeState>::new(
24645 ".google.cloud.dataproc.v1.WorkflowNode.NodeState",
24646 ))
24647 }
24648 }
24649}
24650
24651/// A request to create a workflow template.
24652#[derive(Clone, Default, PartialEq)]
24653#[non_exhaustive]
24654pub struct CreateWorkflowTemplateRequest {
24655 /// Required. The resource name of the region or location, as described
24656 /// in <https://cloud.google.com/apis/design/resource_names>.
24657 ///
24658 /// * For `projects.regions.workflowTemplates.create`, the resource name of the
24659 /// region has the following format:
24660 /// `projects/{project_id}/regions/{region}`
24661 ///
24662 /// * For `projects.locations.workflowTemplates.create`, the resource name of
24663 /// the location has the following format:
24664 /// `projects/{project_id}/locations/{location}`
24665 ///
24666 pub parent: std::string::String,
24667
24668 /// Required. The Dataproc workflow template to create.
24669 pub template: std::option::Option<crate::model::WorkflowTemplate>,
24670
24671 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24672}
24673
24674impl CreateWorkflowTemplateRequest {
24675 pub fn new() -> Self {
24676 std::default::Default::default()
24677 }
24678
24679 /// Sets the value of [parent][crate::model::CreateWorkflowTemplateRequest::parent].
24680 ///
24681 /// # Example
24682 /// ```ignore,no_run
24683 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
24684 /// let x = CreateWorkflowTemplateRequest::new().set_parent("example");
24685 /// ```
24686 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24687 self.parent = v.into();
24688 self
24689 }
24690
24691 /// Sets the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
24692 ///
24693 /// # Example
24694 /// ```ignore,no_run
24695 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
24696 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
24697 /// let x = CreateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
24698 /// ```
24699 pub fn set_template<T>(mut self, v: T) -> Self
24700 where
24701 T: std::convert::Into<crate::model::WorkflowTemplate>,
24702 {
24703 self.template = std::option::Option::Some(v.into());
24704 self
24705 }
24706
24707 /// Sets or clears the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
24708 ///
24709 /// # Example
24710 /// ```ignore,no_run
24711 /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
24712 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
24713 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
24714 /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
24715 /// ```
24716 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
24717 where
24718 T: std::convert::Into<crate::model::WorkflowTemplate>,
24719 {
24720 self.template = v.map(|x| x.into());
24721 self
24722 }
24723}
24724
24725impl wkt::message::Message for CreateWorkflowTemplateRequest {
24726 fn typename() -> &'static str {
24727 "type.googleapis.com/google.cloud.dataproc.v1.CreateWorkflowTemplateRequest"
24728 }
24729}
24730
24731/// A request to fetch a workflow template.
24732#[derive(Clone, Default, PartialEq)]
24733#[non_exhaustive]
24734pub struct GetWorkflowTemplateRequest {
24735 /// Required. The resource name of the workflow template, as described
24736 /// in <https://cloud.google.com/apis/design/resource_names>.
24737 ///
24738 /// * For `projects.regions.workflowTemplates.get`, the resource name of the
24739 /// template has the following format:
24740 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
24741 ///
24742 /// * For `projects.locations.workflowTemplates.get`, the resource name of the
24743 /// template has the following format:
24744 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
24745 ///
24746 pub name: std::string::String,
24747
24748 /// Optional. The version of workflow template to retrieve. Only previously
24749 /// instantiated versions can be retrieved.
24750 ///
24751 /// If unspecified, retrieves the current version.
24752 pub version: i32,
24753
24754 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24755}
24756
24757impl GetWorkflowTemplateRequest {
24758 pub fn new() -> Self {
24759 std::default::Default::default()
24760 }
24761
24762 /// Sets the value of [name][crate::model::GetWorkflowTemplateRequest::name].
24763 ///
24764 /// # Example
24765 /// ```ignore,no_run
24766 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
24767 /// let x = GetWorkflowTemplateRequest::new().set_name("example");
24768 /// ```
24769 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24770 self.name = v.into();
24771 self
24772 }
24773
24774 /// Sets the value of [version][crate::model::GetWorkflowTemplateRequest::version].
24775 ///
24776 /// # Example
24777 /// ```ignore,no_run
24778 /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
24779 /// let x = GetWorkflowTemplateRequest::new().set_version(42);
24780 /// ```
24781 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24782 self.version = v.into();
24783 self
24784 }
24785}
24786
24787impl wkt::message::Message for GetWorkflowTemplateRequest {
24788 fn typename() -> &'static str {
24789 "type.googleapis.com/google.cloud.dataproc.v1.GetWorkflowTemplateRequest"
24790 }
24791}
24792
24793/// A request to instantiate a workflow template.
24794#[derive(Clone, Default, PartialEq)]
24795#[non_exhaustive]
24796pub struct InstantiateWorkflowTemplateRequest {
24797 /// Required. The resource name of the workflow template, as described
24798 /// in <https://cloud.google.com/apis/design/resource_names>.
24799 ///
24800 /// * For `projects.regions.workflowTemplates.instantiate`, the resource name
24801 /// of the template has the following format:
24802 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
24803 ///
24804 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
24805 /// of the template has the following format:
24806 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
24807 ///
24808 pub name: std::string::String,
24809
24810 /// Optional. The version of workflow template to instantiate. If specified,
24811 /// the workflow will be instantiated only if the current version of
24812 /// the workflow template has the supplied version.
24813 ///
24814 /// This option cannot be used to instantiate a previous version of
24815 /// workflow template.
24816 pub version: i32,
24817
24818 /// Optional. A tag that prevents multiple concurrent workflow
24819 /// instances with the same tag from running. This mitigates risk of
24820 /// concurrent instances started due to retries.
24821 ///
24822 /// It is recommended to always set this value to a
24823 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
24824 ///
24825 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
24826 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
24827 pub request_id: std::string::String,
24828
24829 /// Optional. Map from parameter names to values that should be used for those
24830 /// parameters. Values may not exceed 1000 characters.
24831 pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
24832
24833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24834}
24835
24836impl InstantiateWorkflowTemplateRequest {
24837 pub fn new() -> Self {
24838 std::default::Default::default()
24839 }
24840
24841 /// Sets the value of [name][crate::model::InstantiateWorkflowTemplateRequest::name].
24842 ///
24843 /// # Example
24844 /// ```ignore,no_run
24845 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
24846 /// let x = InstantiateWorkflowTemplateRequest::new().set_name("example");
24847 /// ```
24848 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24849 self.name = v.into();
24850 self
24851 }
24852
24853 /// Sets the value of [version][crate::model::InstantiateWorkflowTemplateRequest::version].
24854 ///
24855 /// # Example
24856 /// ```ignore,no_run
24857 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
24858 /// let x = InstantiateWorkflowTemplateRequest::new().set_version(42);
24859 /// ```
24860 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24861 self.version = v.into();
24862 self
24863 }
24864
24865 /// Sets the value of [request_id][crate::model::InstantiateWorkflowTemplateRequest::request_id].
24866 ///
24867 /// # Example
24868 /// ```ignore,no_run
24869 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
24870 /// let x = InstantiateWorkflowTemplateRequest::new().set_request_id("example");
24871 /// ```
24872 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24873 self.request_id = v.into();
24874 self
24875 }
24876
24877 /// Sets the value of [parameters][crate::model::InstantiateWorkflowTemplateRequest::parameters].
24878 ///
24879 /// # Example
24880 /// ```ignore,no_run
24881 /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
24882 /// let x = InstantiateWorkflowTemplateRequest::new().set_parameters([
24883 /// ("key0", "abc"),
24884 /// ("key1", "xyz"),
24885 /// ]);
24886 /// ```
24887 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
24888 where
24889 T: std::iter::IntoIterator<Item = (K, V)>,
24890 K: std::convert::Into<std::string::String>,
24891 V: std::convert::Into<std::string::String>,
24892 {
24893 use std::iter::Iterator;
24894 self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24895 self
24896 }
24897}
24898
24899impl wkt::message::Message for InstantiateWorkflowTemplateRequest {
24900 fn typename() -> &'static str {
24901 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest"
24902 }
24903}
24904
24905/// A request to instantiate an inline workflow template.
24906#[derive(Clone, Default, PartialEq)]
24907#[non_exhaustive]
24908pub struct InstantiateInlineWorkflowTemplateRequest {
24909 /// Required. The resource name of the region or location, as described
24910 /// in <https://cloud.google.com/apis/design/resource_names>.
24911 ///
24912 /// * For `projects.regions.workflowTemplates,instantiateinline`, the resource
24913 /// name of the region has the following format:
24914 /// `projects/{project_id}/regions/{region}`
24915 ///
24916 /// * For `projects.locations.workflowTemplates.instantiateinline`, the
24917 /// resource name of the location has the following format:
24918 /// `projects/{project_id}/locations/{location}`
24919 ///
24920 pub parent: std::string::String,
24921
24922 /// Required. The workflow template to instantiate.
24923 pub template: std::option::Option<crate::model::WorkflowTemplate>,
24924
24925 /// Optional. A tag that prevents multiple concurrent workflow
24926 /// instances with the same tag from running. This mitigates risk of
24927 /// concurrent instances started due to retries.
24928 ///
24929 /// It is recommended to always set this value to a
24930 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
24931 ///
24932 /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
24933 /// underscores (_), and hyphens (-). The maximum length is 40 characters.
24934 pub request_id: std::string::String,
24935
24936 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24937}
24938
24939impl InstantiateInlineWorkflowTemplateRequest {
24940 pub fn new() -> Self {
24941 std::default::Default::default()
24942 }
24943
24944 /// Sets the value of [parent][crate::model::InstantiateInlineWorkflowTemplateRequest::parent].
24945 ///
24946 /// # Example
24947 /// ```ignore,no_run
24948 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
24949 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_parent("example");
24950 /// ```
24951 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24952 self.parent = v.into();
24953 self
24954 }
24955
24956 /// Sets the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
24957 ///
24958 /// # Example
24959 /// ```ignore,no_run
24960 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
24961 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
24962 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
24963 /// ```
24964 pub fn set_template<T>(mut self, v: T) -> Self
24965 where
24966 T: std::convert::Into<crate::model::WorkflowTemplate>,
24967 {
24968 self.template = std::option::Option::Some(v.into());
24969 self
24970 }
24971
24972 /// Sets or clears the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
24973 ///
24974 /// # Example
24975 /// ```ignore,no_run
24976 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
24977 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
24978 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
24979 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
24980 /// ```
24981 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
24982 where
24983 T: std::convert::Into<crate::model::WorkflowTemplate>,
24984 {
24985 self.template = v.map(|x| x.into());
24986 self
24987 }
24988
24989 /// Sets the value of [request_id][crate::model::InstantiateInlineWorkflowTemplateRequest::request_id].
24990 ///
24991 /// # Example
24992 /// ```ignore,no_run
24993 /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
24994 /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_request_id("example");
24995 /// ```
24996 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24997 self.request_id = v.into();
24998 self
24999 }
25000}
25001
25002impl wkt::message::Message for InstantiateInlineWorkflowTemplateRequest {
25003 fn typename() -> &'static str {
25004 "type.googleapis.com/google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest"
25005 }
25006}
25007
25008/// A request to update a workflow template.
25009#[derive(Clone, Default, PartialEq)]
25010#[non_exhaustive]
25011pub struct UpdateWorkflowTemplateRequest {
25012 /// Required. The updated workflow template.
25013 ///
25014 /// The `template.version` field must match the current version.
25015 pub template: std::option::Option<crate::model::WorkflowTemplate>,
25016
25017 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25018}
25019
25020impl UpdateWorkflowTemplateRequest {
25021 pub fn new() -> Self {
25022 std::default::Default::default()
25023 }
25024
25025 /// Sets the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25026 ///
25027 /// # Example
25028 /// ```ignore,no_run
25029 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25030 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25031 /// let x = UpdateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25032 /// ```
25033 pub fn set_template<T>(mut self, v: T) -> Self
25034 where
25035 T: std::convert::Into<crate::model::WorkflowTemplate>,
25036 {
25037 self.template = std::option::Option::Some(v.into());
25038 self
25039 }
25040
25041 /// Sets or clears the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25042 ///
25043 /// # Example
25044 /// ```ignore,no_run
25045 /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25046 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25047 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25048 /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25049 /// ```
25050 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25051 where
25052 T: std::convert::Into<crate::model::WorkflowTemplate>,
25053 {
25054 self.template = v.map(|x| x.into());
25055 self
25056 }
25057}
25058
25059impl wkt::message::Message for UpdateWorkflowTemplateRequest {
25060 fn typename() -> &'static str {
25061 "type.googleapis.com/google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest"
25062 }
25063}
25064
25065/// A request to list workflow templates in a project.
25066#[derive(Clone, Default, PartialEq)]
25067#[non_exhaustive]
25068pub struct ListWorkflowTemplatesRequest {
25069 /// Required. The resource name of the region or location, as described
25070 /// in <https://cloud.google.com/apis/design/resource_names>.
25071 ///
25072 /// * For `projects.regions.workflowTemplates,list`, the resource
25073 /// name of the region has the following format:
25074 /// `projects/{project_id}/regions/{region}`
25075 ///
25076 /// * For `projects.locations.workflowTemplates.list`, the
25077 /// resource name of the location has the following format:
25078 /// `projects/{project_id}/locations/{location}`
25079 ///
25080 pub parent: std::string::String,
25081
25082 /// Optional. The maximum number of results to return in each response.
25083 pub page_size: i32,
25084
25085 /// Optional. The page token, returned by a previous call, to request the
25086 /// next page of results.
25087 pub page_token: std::string::String,
25088
25089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25090}
25091
25092impl ListWorkflowTemplatesRequest {
25093 pub fn new() -> Self {
25094 std::default::Default::default()
25095 }
25096
25097 /// Sets the value of [parent][crate::model::ListWorkflowTemplatesRequest::parent].
25098 ///
25099 /// # Example
25100 /// ```ignore,no_run
25101 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25102 /// let x = ListWorkflowTemplatesRequest::new().set_parent("example");
25103 /// ```
25104 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25105 self.parent = v.into();
25106 self
25107 }
25108
25109 /// Sets the value of [page_size][crate::model::ListWorkflowTemplatesRequest::page_size].
25110 ///
25111 /// # Example
25112 /// ```ignore,no_run
25113 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25114 /// let x = ListWorkflowTemplatesRequest::new().set_page_size(42);
25115 /// ```
25116 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25117 self.page_size = v.into();
25118 self
25119 }
25120
25121 /// Sets the value of [page_token][crate::model::ListWorkflowTemplatesRequest::page_token].
25122 ///
25123 /// # Example
25124 /// ```ignore,no_run
25125 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25126 /// let x = ListWorkflowTemplatesRequest::new().set_page_token("example");
25127 /// ```
25128 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25129 self.page_token = v.into();
25130 self
25131 }
25132}
25133
25134impl wkt::message::Message for ListWorkflowTemplatesRequest {
25135 fn typename() -> &'static str {
25136 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesRequest"
25137 }
25138}
25139
25140/// A response to a request to list workflow templates in a project.
25141#[derive(Clone, Default, PartialEq)]
25142#[non_exhaustive]
25143pub struct ListWorkflowTemplatesResponse {
25144 /// Output only. WorkflowTemplates list.
25145 pub templates: std::vec::Vec<crate::model::WorkflowTemplate>,
25146
25147 /// Output only. This token is included in the response if there are more
25148 /// results to fetch. To fetch additional results, provide this value as the
25149 /// page_token in a subsequent \<code\>ListWorkflowTemplatesRequest\</code\>.
25150 pub next_page_token: std::string::String,
25151
25152 /// Output only. List of workflow templates that could not be included in the
25153 /// response. Attempting to get one of these resources may indicate why it was
25154 /// not included in the list response.
25155 pub unreachable: std::vec::Vec<std::string::String>,
25156
25157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25158}
25159
25160impl ListWorkflowTemplatesResponse {
25161 pub fn new() -> Self {
25162 std::default::Default::default()
25163 }
25164
25165 /// Sets the value of [templates][crate::model::ListWorkflowTemplatesResponse::templates].
25166 ///
25167 /// # Example
25168 /// ```ignore,no_run
25169 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25170 /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25171 /// let x = ListWorkflowTemplatesResponse::new()
25172 /// .set_templates([
25173 /// WorkflowTemplate::default()/* use setters */,
25174 /// WorkflowTemplate::default()/* use (different) setters */,
25175 /// ]);
25176 /// ```
25177 pub fn set_templates<T, V>(mut self, v: T) -> Self
25178 where
25179 T: std::iter::IntoIterator<Item = V>,
25180 V: std::convert::Into<crate::model::WorkflowTemplate>,
25181 {
25182 use std::iter::Iterator;
25183 self.templates = v.into_iter().map(|i| i.into()).collect();
25184 self
25185 }
25186
25187 /// Sets the value of [next_page_token][crate::model::ListWorkflowTemplatesResponse::next_page_token].
25188 ///
25189 /// # Example
25190 /// ```ignore,no_run
25191 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25192 /// let x = ListWorkflowTemplatesResponse::new().set_next_page_token("example");
25193 /// ```
25194 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25195 self.next_page_token = v.into();
25196 self
25197 }
25198
25199 /// Sets the value of [unreachable][crate::model::ListWorkflowTemplatesResponse::unreachable].
25200 ///
25201 /// # Example
25202 /// ```ignore,no_run
25203 /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25204 /// let x = ListWorkflowTemplatesResponse::new().set_unreachable(["a", "b", "c"]);
25205 /// ```
25206 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
25207 where
25208 T: std::iter::IntoIterator<Item = V>,
25209 V: std::convert::Into<std::string::String>,
25210 {
25211 use std::iter::Iterator;
25212 self.unreachable = v.into_iter().map(|i| i.into()).collect();
25213 self
25214 }
25215}
25216
25217impl wkt::message::Message for ListWorkflowTemplatesResponse {
25218 fn typename() -> &'static str {
25219 "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesResponse"
25220 }
25221}
25222
25223#[doc(hidden)]
25224impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowTemplatesResponse {
25225 type PageItem = crate::model::WorkflowTemplate;
25226
25227 fn items(self) -> std::vec::Vec<Self::PageItem> {
25228 self.templates
25229 }
25230
25231 fn next_page_token(&self) -> std::string::String {
25232 use std::clone::Clone;
25233 self.next_page_token.clone()
25234 }
25235}
25236
25237/// A request to delete a workflow template.
25238///
25239/// Currently started workflows will remain running.
25240#[derive(Clone, Default, PartialEq)]
25241#[non_exhaustive]
25242pub struct DeleteWorkflowTemplateRequest {
25243 /// Required. The resource name of the workflow template, as described
25244 /// in <https://cloud.google.com/apis/design/resource_names>.
25245 ///
25246 /// * For `projects.regions.workflowTemplates.delete`, the resource name
25247 /// of the template has the following format:
25248 /// `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25249 ///
25250 /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
25251 /// of the template has the following format:
25252 /// `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25253 ///
25254 pub name: std::string::String,
25255
25256 /// Optional. The version of workflow template to delete. If specified,
25257 /// will only delete the template if the current server version matches
25258 /// specified version.
25259 pub version: i32,
25260
25261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25262}
25263
25264impl DeleteWorkflowTemplateRequest {
25265 pub fn new() -> Self {
25266 std::default::Default::default()
25267 }
25268
25269 /// Sets the value of [name][crate::model::DeleteWorkflowTemplateRequest::name].
25270 ///
25271 /// # Example
25272 /// ```ignore,no_run
25273 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
25274 /// let x = DeleteWorkflowTemplateRequest::new().set_name("example");
25275 /// ```
25276 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25277 self.name = v.into();
25278 self
25279 }
25280
25281 /// Sets the value of [version][crate::model::DeleteWorkflowTemplateRequest::version].
25282 ///
25283 /// # Example
25284 /// ```ignore,no_run
25285 /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
25286 /// let x = DeleteWorkflowTemplateRequest::new().set_version(42);
25287 /// ```
25288 pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25289 self.version = v.into();
25290 self
25291 }
25292}
25293
25294impl wkt::message::Message for DeleteWorkflowTemplateRequest {
25295 fn typename() -> &'static str {
25296 "type.googleapis.com/google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest"
25297 }
25298}
25299
25300/// Cluster components that can be activated.
25301///
25302/// # Working with unknown values
25303///
25304/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25305/// additional enum variants at any time. Adding new variants is not considered
25306/// a breaking change. Applications should write their code in anticipation of:
25307///
25308/// - New values appearing in future releases of the client library, **and**
25309/// - New values received dynamically, without application changes.
25310///
25311/// Please consult the [Working with enums] section in the user guide for some
25312/// guidelines.
25313///
25314/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25315#[derive(Clone, Debug, PartialEq)]
25316#[non_exhaustive]
25317pub enum Component {
25318 /// Unspecified component. Specifying this will cause Cluster creation to fail.
25319 Unspecified,
25320 /// The Anaconda component is no longer supported or applicable to
25321 /// [supported Dataproc on Compute Engine image versions]
25322 /// (<https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-version-clusters#supported-dataproc-image-versions>).
25323 /// It cannot be activated on clusters created with supported Dataproc on
25324 /// Compute Engine image versions.
25325 Anaconda,
25326 /// Delta Lake.
25327 Delta,
25328 /// Docker
25329 Docker,
25330 /// The Druid query engine. (alpha)
25331 Druid,
25332 /// Flink
25333 Flink,
25334 /// HBase. (beta)
25335 Hbase,
25336 /// The Hive Web HCatalog (the REST service for accessing HCatalog).
25337 HiveWebhcat,
25338 /// Hudi.
25339 Hudi,
25340 /// Iceberg.
25341 Iceberg,
25342 /// The Jupyter Notebook.
25343 Jupyter,
25344 /// The Jupyter Kernel Gateway.
25345 JupyterKernelGateway,
25346 /// The Pig component.
25347 Pig,
25348 /// The Presto query engine.
25349 Presto,
25350 /// The Trino query engine.
25351 Trino,
25352 /// The Ranger service.
25353 Ranger,
25354 /// The Solr service.
25355 Solr,
25356 /// The Zeppelin notebook.
25357 Zeppelin,
25358 /// The Zookeeper service.
25359 Zookeeper,
25360 /// If set, the enum was initialized with an unknown value.
25361 ///
25362 /// Applications can examine the value using [Component::value] or
25363 /// [Component::name].
25364 UnknownValue(component::UnknownValue),
25365}
25366
25367#[doc(hidden)]
25368pub mod component {
25369 #[allow(unused_imports)]
25370 use super::*;
25371 #[derive(Clone, Debug, PartialEq)]
25372 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25373}
25374
25375impl Component {
25376 /// Gets the enum value.
25377 ///
25378 /// Returns `None` if the enum contains an unknown value deserialized from
25379 /// the string representation of enums.
25380 pub fn value(&self) -> std::option::Option<i32> {
25381 match self {
25382 Self::Unspecified => std::option::Option::Some(0),
25383 Self::Anaconda => std::option::Option::Some(5),
25384 Self::Delta => std::option::Option::Some(20),
25385 Self::Docker => std::option::Option::Some(13),
25386 Self::Druid => std::option::Option::Some(9),
25387 Self::Flink => std::option::Option::Some(14),
25388 Self::Hbase => std::option::Option::Some(11),
25389 Self::HiveWebhcat => std::option::Option::Some(3),
25390 Self::Hudi => std::option::Option::Some(18),
25391 Self::Iceberg => std::option::Option::Some(19),
25392 Self::Jupyter => std::option::Option::Some(1),
25393 Self::JupyterKernelGateway => std::option::Option::Some(22),
25394 Self::Pig => std::option::Option::Some(21),
25395 Self::Presto => std::option::Option::Some(6),
25396 Self::Trino => std::option::Option::Some(17),
25397 Self::Ranger => std::option::Option::Some(12),
25398 Self::Solr => std::option::Option::Some(10),
25399 Self::Zeppelin => std::option::Option::Some(4),
25400 Self::Zookeeper => std::option::Option::Some(8),
25401 Self::UnknownValue(u) => u.0.value(),
25402 }
25403 }
25404
25405 /// Gets the enum value as a string.
25406 ///
25407 /// Returns `None` if the enum contains an unknown value deserialized from
25408 /// the integer representation of enums.
25409 pub fn name(&self) -> std::option::Option<&str> {
25410 match self {
25411 Self::Unspecified => std::option::Option::Some("COMPONENT_UNSPECIFIED"),
25412 Self::Anaconda => std::option::Option::Some("ANACONDA"),
25413 Self::Delta => std::option::Option::Some("DELTA"),
25414 Self::Docker => std::option::Option::Some("DOCKER"),
25415 Self::Druid => std::option::Option::Some("DRUID"),
25416 Self::Flink => std::option::Option::Some("FLINK"),
25417 Self::Hbase => std::option::Option::Some("HBASE"),
25418 Self::HiveWebhcat => std::option::Option::Some("HIVE_WEBHCAT"),
25419 Self::Hudi => std::option::Option::Some("HUDI"),
25420 Self::Iceberg => std::option::Option::Some("ICEBERG"),
25421 Self::Jupyter => std::option::Option::Some("JUPYTER"),
25422 Self::JupyterKernelGateway => std::option::Option::Some("JUPYTER_KERNEL_GATEWAY"),
25423 Self::Pig => std::option::Option::Some("PIG"),
25424 Self::Presto => std::option::Option::Some("PRESTO"),
25425 Self::Trino => std::option::Option::Some("TRINO"),
25426 Self::Ranger => std::option::Option::Some("RANGER"),
25427 Self::Solr => std::option::Option::Some("SOLR"),
25428 Self::Zeppelin => std::option::Option::Some("ZEPPELIN"),
25429 Self::Zookeeper => std::option::Option::Some("ZOOKEEPER"),
25430 Self::UnknownValue(u) => u.0.name(),
25431 }
25432 }
25433}
25434
25435impl std::default::Default for Component {
25436 fn default() -> Self {
25437 use std::convert::From;
25438 Self::from(0)
25439 }
25440}
25441
25442impl std::fmt::Display for Component {
25443 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25444 wkt::internal::display_enum(f, self.name(), self.value())
25445 }
25446}
25447
25448impl std::convert::From<i32> for Component {
25449 fn from(value: i32) -> Self {
25450 match value {
25451 0 => Self::Unspecified,
25452 1 => Self::Jupyter,
25453 3 => Self::HiveWebhcat,
25454 4 => Self::Zeppelin,
25455 5 => Self::Anaconda,
25456 6 => Self::Presto,
25457 8 => Self::Zookeeper,
25458 9 => Self::Druid,
25459 10 => Self::Solr,
25460 11 => Self::Hbase,
25461 12 => Self::Ranger,
25462 13 => Self::Docker,
25463 14 => Self::Flink,
25464 17 => Self::Trino,
25465 18 => Self::Hudi,
25466 19 => Self::Iceberg,
25467 20 => Self::Delta,
25468 21 => Self::Pig,
25469 22 => Self::JupyterKernelGateway,
25470 _ => Self::UnknownValue(component::UnknownValue(
25471 wkt::internal::UnknownEnumValue::Integer(value),
25472 )),
25473 }
25474 }
25475}
25476
25477impl std::convert::From<&str> for Component {
25478 fn from(value: &str) -> Self {
25479 use std::string::ToString;
25480 match value {
25481 "COMPONENT_UNSPECIFIED" => Self::Unspecified,
25482 "ANACONDA" => Self::Anaconda,
25483 "DELTA" => Self::Delta,
25484 "DOCKER" => Self::Docker,
25485 "DRUID" => Self::Druid,
25486 "FLINK" => Self::Flink,
25487 "HBASE" => Self::Hbase,
25488 "HIVE_WEBHCAT" => Self::HiveWebhcat,
25489 "HUDI" => Self::Hudi,
25490 "ICEBERG" => Self::Iceberg,
25491 "JUPYTER" => Self::Jupyter,
25492 "JUPYTER_KERNEL_GATEWAY" => Self::JupyterKernelGateway,
25493 "PIG" => Self::Pig,
25494 "PRESTO" => Self::Presto,
25495 "TRINO" => Self::Trino,
25496 "RANGER" => Self::Ranger,
25497 "SOLR" => Self::Solr,
25498 "ZEPPELIN" => Self::Zeppelin,
25499 "ZOOKEEPER" => Self::Zookeeper,
25500 _ => Self::UnknownValue(component::UnknownValue(
25501 wkt::internal::UnknownEnumValue::String(value.to_string()),
25502 )),
25503 }
25504 }
25505}
25506
25507impl serde::ser::Serialize for Component {
25508 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25509 where
25510 S: serde::Serializer,
25511 {
25512 match self {
25513 Self::Unspecified => serializer.serialize_i32(0),
25514 Self::Anaconda => serializer.serialize_i32(5),
25515 Self::Delta => serializer.serialize_i32(20),
25516 Self::Docker => serializer.serialize_i32(13),
25517 Self::Druid => serializer.serialize_i32(9),
25518 Self::Flink => serializer.serialize_i32(14),
25519 Self::Hbase => serializer.serialize_i32(11),
25520 Self::HiveWebhcat => serializer.serialize_i32(3),
25521 Self::Hudi => serializer.serialize_i32(18),
25522 Self::Iceberg => serializer.serialize_i32(19),
25523 Self::Jupyter => serializer.serialize_i32(1),
25524 Self::JupyterKernelGateway => serializer.serialize_i32(22),
25525 Self::Pig => serializer.serialize_i32(21),
25526 Self::Presto => serializer.serialize_i32(6),
25527 Self::Trino => serializer.serialize_i32(17),
25528 Self::Ranger => serializer.serialize_i32(12),
25529 Self::Solr => serializer.serialize_i32(10),
25530 Self::Zeppelin => serializer.serialize_i32(4),
25531 Self::Zookeeper => serializer.serialize_i32(8),
25532 Self::UnknownValue(u) => u.0.serialize(serializer),
25533 }
25534 }
25535}
25536
25537impl<'de> serde::de::Deserialize<'de> for Component {
25538 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25539 where
25540 D: serde::Deserializer<'de>,
25541 {
25542 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Component>::new(
25543 ".google.cloud.dataproc.v1.Component",
25544 ))
25545 }
25546}
25547
25548/// Actions in response to failure of a resource associated with a cluster.
25549///
25550/// # Working with unknown values
25551///
25552/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25553/// additional enum variants at any time. Adding new variants is not considered
25554/// a breaking change. Applications should write their code in anticipation of:
25555///
25556/// - New values appearing in future releases of the client library, **and**
25557/// - New values received dynamically, without application changes.
25558///
25559/// Please consult the [Working with enums] section in the user guide for some
25560/// guidelines.
25561///
25562/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25563#[derive(Clone, Debug, PartialEq)]
25564#[non_exhaustive]
25565pub enum FailureAction {
25566 /// When FailureAction is unspecified, failure action defaults to NO_ACTION.
25567 Unspecified,
25568 /// Take no action on failure to create a cluster resource. NO_ACTION is the
25569 /// default.
25570 NoAction,
25571 /// Delete the failed cluster resource.
25572 Delete,
25573 /// If set, the enum was initialized with an unknown value.
25574 ///
25575 /// Applications can examine the value using [FailureAction::value] or
25576 /// [FailureAction::name].
25577 UnknownValue(failure_action::UnknownValue),
25578}
25579
25580#[doc(hidden)]
25581pub mod failure_action {
25582 #[allow(unused_imports)]
25583 use super::*;
25584 #[derive(Clone, Debug, PartialEq)]
25585 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25586}
25587
25588impl FailureAction {
25589 /// Gets the enum value.
25590 ///
25591 /// Returns `None` if the enum contains an unknown value deserialized from
25592 /// the string representation of enums.
25593 pub fn value(&self) -> std::option::Option<i32> {
25594 match self {
25595 Self::Unspecified => std::option::Option::Some(0),
25596 Self::NoAction => std::option::Option::Some(1),
25597 Self::Delete => std::option::Option::Some(2),
25598 Self::UnknownValue(u) => u.0.value(),
25599 }
25600 }
25601
25602 /// Gets the enum value as a string.
25603 ///
25604 /// Returns `None` if the enum contains an unknown value deserialized from
25605 /// the integer representation of enums.
25606 pub fn name(&self) -> std::option::Option<&str> {
25607 match self {
25608 Self::Unspecified => std::option::Option::Some("FAILURE_ACTION_UNSPECIFIED"),
25609 Self::NoAction => std::option::Option::Some("NO_ACTION"),
25610 Self::Delete => std::option::Option::Some("DELETE"),
25611 Self::UnknownValue(u) => u.0.name(),
25612 }
25613 }
25614}
25615
25616impl std::default::Default for FailureAction {
25617 fn default() -> Self {
25618 use std::convert::From;
25619 Self::from(0)
25620 }
25621}
25622
25623impl std::fmt::Display for FailureAction {
25624 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25625 wkt::internal::display_enum(f, self.name(), self.value())
25626 }
25627}
25628
25629impl std::convert::From<i32> for FailureAction {
25630 fn from(value: i32) -> Self {
25631 match value {
25632 0 => Self::Unspecified,
25633 1 => Self::NoAction,
25634 2 => Self::Delete,
25635 _ => Self::UnknownValue(failure_action::UnknownValue(
25636 wkt::internal::UnknownEnumValue::Integer(value),
25637 )),
25638 }
25639 }
25640}
25641
25642impl std::convert::From<&str> for FailureAction {
25643 fn from(value: &str) -> Self {
25644 use std::string::ToString;
25645 match value {
25646 "FAILURE_ACTION_UNSPECIFIED" => Self::Unspecified,
25647 "NO_ACTION" => Self::NoAction,
25648 "DELETE" => Self::Delete,
25649 _ => Self::UnknownValue(failure_action::UnknownValue(
25650 wkt::internal::UnknownEnumValue::String(value.to_string()),
25651 )),
25652 }
25653 }
25654}
25655
25656impl serde::ser::Serialize for FailureAction {
25657 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25658 where
25659 S: serde::Serializer,
25660 {
25661 match self {
25662 Self::Unspecified => serializer.serialize_i32(0),
25663 Self::NoAction => serializer.serialize_i32(1),
25664 Self::Delete => serializer.serialize_i32(2),
25665 Self::UnknownValue(u) => u.0.serialize(serializer),
25666 }
25667 }
25668}
25669
25670impl<'de> serde::de::Deserialize<'de> for FailureAction {
25671 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25672 where
25673 D: serde::Deserializer<'de>,
25674 {
25675 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureAction>::new(
25676 ".google.cloud.dataproc.v1.FailureAction",
25677 ))
25678 }
25679}