Skip to main content

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    /// Optional. The type of the clusters for which this autoscaling policy is to
81    /// be configured.
82    pub cluster_type: crate::model::autoscaling_policy::ClusterType,
83
84    /// Autoscaling algorithm for policy.
85    pub algorithm: std::option::Option<crate::model::autoscaling_policy::Algorithm>,
86
87    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
88}
89
90impl AutoscalingPolicy {
91    pub fn new() -> Self {
92        std::default::Default::default()
93    }
94
95    /// Sets the value of [id][crate::model::AutoscalingPolicy::id].
96    ///
97    /// # Example
98    /// ```ignore,no_run
99    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
100    /// let x = AutoscalingPolicy::new().set_id("example");
101    /// ```
102    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
103        self.id = v.into();
104        self
105    }
106
107    /// Sets the value of [name][crate::model::AutoscalingPolicy::name].
108    ///
109    /// # Example
110    /// ```ignore,no_run
111    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
112    /// let x = AutoscalingPolicy::new().set_name("example");
113    /// ```
114    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
115        self.name = v.into();
116        self
117    }
118
119    /// Sets the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
120    ///
121    /// # Example
122    /// ```ignore,no_run
123    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
124    /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
125    /// let x = AutoscalingPolicy::new().set_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
126    /// ```
127    pub fn set_worker_config<T>(mut self, v: T) -> Self
128    where
129        T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
130    {
131        self.worker_config = std::option::Option::Some(v.into());
132        self
133    }
134
135    /// Sets or clears the value of [worker_config][crate::model::AutoscalingPolicy::worker_config].
136    ///
137    /// # Example
138    /// ```ignore,no_run
139    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
140    /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
141    /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
142    /// let x = AutoscalingPolicy::new().set_or_clear_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
143    /// ```
144    pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
145    where
146        T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
147    {
148        self.worker_config = v.map(|x| x.into());
149        self
150    }
151
152    /// Sets the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
153    ///
154    /// # Example
155    /// ```ignore,no_run
156    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
157    /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
158    /// let x = AutoscalingPolicy::new().set_secondary_worker_config(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */);
159    /// ```
160    pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
161    where
162        T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
163    {
164        self.secondary_worker_config = std::option::Option::Some(v.into());
165        self
166    }
167
168    /// Sets or clears the value of [secondary_worker_config][crate::model::AutoscalingPolicy::secondary_worker_config].
169    ///
170    /// # Example
171    /// ```ignore,no_run
172    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
173    /// use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
174    /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(Some(InstanceGroupAutoscalingPolicyConfig::default()/* use setters */));
175    /// let x = AutoscalingPolicy::new().set_or_clear_secondary_worker_config(None::<InstanceGroupAutoscalingPolicyConfig>);
176    /// ```
177    pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
178    where
179        T: std::convert::Into<crate::model::InstanceGroupAutoscalingPolicyConfig>,
180    {
181        self.secondary_worker_config = v.map(|x| x.into());
182        self
183    }
184
185    /// Sets the value of [labels][crate::model::AutoscalingPolicy::labels].
186    ///
187    /// # Example
188    /// ```ignore,no_run
189    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
190    /// let x = AutoscalingPolicy::new().set_labels([
191    ///     ("key0", "abc"),
192    ///     ("key1", "xyz"),
193    /// ]);
194    /// ```
195    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
196    where
197        T: std::iter::IntoIterator<Item = (K, V)>,
198        K: std::convert::Into<std::string::String>,
199        V: std::convert::Into<std::string::String>,
200    {
201        use std::iter::Iterator;
202        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
203        self
204    }
205
206    /// Sets the value of [cluster_type][crate::model::AutoscalingPolicy::cluster_type].
207    ///
208    /// # Example
209    /// ```ignore,no_run
210    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
211    /// use google_cloud_dataproc_v1::model::autoscaling_policy::ClusterType;
212    /// let x0 = AutoscalingPolicy::new().set_cluster_type(ClusterType::Standard);
213    /// let x1 = AutoscalingPolicy::new().set_cluster_type(ClusterType::ZeroScale);
214    /// ```
215    pub fn set_cluster_type<
216        T: std::convert::Into<crate::model::autoscaling_policy::ClusterType>,
217    >(
218        mut self,
219        v: T,
220    ) -> Self {
221        self.cluster_type = v.into();
222        self
223    }
224
225    /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm].
226    ///
227    /// Note that all the setters affecting `algorithm` are mutually
228    /// exclusive.
229    ///
230    /// # Example
231    /// ```ignore,no_run
232    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
233    /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
234    /// let x = AutoscalingPolicy::new().set_algorithm(Some(
235    ///     google_cloud_dataproc_v1::model::autoscaling_policy::Algorithm::BasicAlgorithm(BasicAutoscalingAlgorithm::default().into())));
236    /// ```
237    pub fn set_algorithm<
238        T: std::convert::Into<std::option::Option<crate::model::autoscaling_policy::Algorithm>>,
239    >(
240        mut self,
241        v: T,
242    ) -> Self {
243        self.algorithm = v.into();
244        self
245    }
246
247    /// The value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
248    /// if it holds a `BasicAlgorithm`, `None` if the field is not set or
249    /// holds a different branch.
250    pub fn basic_algorithm(
251        &self,
252    ) -> std::option::Option<&std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>> {
253        #[allow(unreachable_patterns)]
254        self.algorithm.as_ref().and_then(|v| match v {
255            crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v) => {
256                std::option::Option::Some(v)
257            }
258            _ => std::option::Option::None,
259        })
260    }
261
262    /// Sets the value of [algorithm][crate::model::AutoscalingPolicy::algorithm]
263    /// to hold a `BasicAlgorithm`.
264    ///
265    /// Note that all the setters affecting `algorithm` are
266    /// mutually exclusive.
267    ///
268    /// # Example
269    /// ```ignore,no_run
270    /// # use google_cloud_dataproc_v1::model::AutoscalingPolicy;
271    /// use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
272    /// let x = AutoscalingPolicy::new().set_basic_algorithm(BasicAutoscalingAlgorithm::default()/* use setters */);
273    /// assert!(x.basic_algorithm().is_some());
274    /// ```
275    pub fn set_basic_algorithm<
276        T: std::convert::Into<std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>>,
277    >(
278        mut self,
279        v: T,
280    ) -> Self {
281        self.algorithm = std::option::Option::Some(
282            crate::model::autoscaling_policy::Algorithm::BasicAlgorithm(v.into()),
283        );
284        self
285    }
286}
287
288impl wkt::message::Message for AutoscalingPolicy {
289    fn typename() -> &'static str {
290        "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingPolicy"
291    }
292}
293
294/// Defines additional types related to [AutoscalingPolicy].
295pub mod autoscaling_policy {
296    #[allow(unused_imports)]
297    use super::*;
298
299    /// The type of the clusters for which this autoscaling policy is to be
300    /// configured.
301    ///
302    /// # Working with unknown values
303    ///
304    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
305    /// additional enum variants at any time. Adding new variants is not considered
306    /// a breaking change. Applications should write their code in anticipation of:
307    ///
308    /// - New values appearing in future releases of the client library, **and**
309    /// - New values received dynamically, without application changes.
310    ///
311    /// Please consult the [Working with enums] section in the user guide for some
312    /// guidelines.
313    ///
314    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
315    #[derive(Clone, Debug, PartialEq)]
316    #[non_exhaustive]
317    pub enum ClusterType {
318        /// Not set.
319        Unspecified,
320        /// Standard dataproc cluster with a minimum of two primary workers.
321        Standard,
322        /// Clusters that can use only secondary workers and be scaled down to zero
323        /// secondary worker nodes.
324        ZeroScale,
325        /// If set, the enum was initialized with an unknown value.
326        ///
327        /// Applications can examine the value using [ClusterType::value] or
328        /// [ClusterType::name].
329        UnknownValue(cluster_type::UnknownValue),
330    }
331
332    #[doc(hidden)]
333    pub mod cluster_type {
334        #[allow(unused_imports)]
335        use super::*;
336        #[derive(Clone, Debug, PartialEq)]
337        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
338    }
339
340    impl ClusterType {
341        /// Gets the enum value.
342        ///
343        /// Returns `None` if the enum contains an unknown value deserialized from
344        /// the string representation of enums.
345        pub fn value(&self) -> std::option::Option<i32> {
346            match self {
347                Self::Unspecified => std::option::Option::Some(0),
348                Self::Standard => std::option::Option::Some(1),
349                Self::ZeroScale => std::option::Option::Some(2),
350                Self::UnknownValue(u) => u.0.value(),
351            }
352        }
353
354        /// Gets the enum value as a string.
355        ///
356        /// Returns `None` if the enum contains an unknown value deserialized from
357        /// the integer representation of enums.
358        pub fn name(&self) -> std::option::Option<&str> {
359            match self {
360                Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
361                Self::Standard => std::option::Option::Some("STANDARD"),
362                Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
363                Self::UnknownValue(u) => u.0.name(),
364            }
365        }
366    }
367
368    impl std::default::Default for ClusterType {
369        fn default() -> Self {
370            use std::convert::From;
371            Self::from(0)
372        }
373    }
374
375    impl std::fmt::Display for ClusterType {
376        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
377            wkt::internal::display_enum(f, self.name(), self.value())
378        }
379    }
380
381    impl std::convert::From<i32> for ClusterType {
382        fn from(value: i32) -> Self {
383            match value {
384                0 => Self::Unspecified,
385                1 => Self::Standard,
386                2 => Self::ZeroScale,
387                _ => Self::UnknownValue(cluster_type::UnknownValue(
388                    wkt::internal::UnknownEnumValue::Integer(value),
389                )),
390            }
391        }
392    }
393
394    impl std::convert::From<&str> for ClusterType {
395        fn from(value: &str) -> Self {
396            use std::string::ToString;
397            match value {
398                "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
399                "STANDARD" => Self::Standard,
400                "ZERO_SCALE" => Self::ZeroScale,
401                _ => Self::UnknownValue(cluster_type::UnknownValue(
402                    wkt::internal::UnknownEnumValue::String(value.to_string()),
403                )),
404            }
405        }
406    }
407
408    impl serde::ser::Serialize for ClusterType {
409        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
410        where
411            S: serde::Serializer,
412        {
413            match self {
414                Self::Unspecified => serializer.serialize_i32(0),
415                Self::Standard => serializer.serialize_i32(1),
416                Self::ZeroScale => serializer.serialize_i32(2),
417                Self::UnknownValue(u) => u.0.serialize(serializer),
418            }
419        }
420    }
421
422    impl<'de> serde::de::Deserialize<'de> for ClusterType {
423        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
424        where
425            D: serde::Deserializer<'de>,
426        {
427            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
428                ".google.cloud.dataproc.v1.AutoscalingPolicy.ClusterType",
429            ))
430        }
431    }
432
433    /// Autoscaling algorithm for policy.
434    #[derive(Clone, Debug, PartialEq)]
435    #[non_exhaustive]
436    pub enum Algorithm {
437        BasicAlgorithm(std::boxed::Box<crate::model::BasicAutoscalingAlgorithm>),
438    }
439}
440
441/// Basic algorithm for autoscaling.
442#[derive(Clone, Default, PartialEq)]
443#[non_exhaustive]
444pub struct BasicAutoscalingAlgorithm {
445    /// Optional. Duration between scaling events. A scaling period starts after
446    /// the update operation from the previous event has completed.
447    ///
448    /// Bounds: [2m, 1d]. Default: 2m.
449    pub cooldown_period: std::option::Option<wkt::Duration>,
450
451    pub config: std::option::Option<crate::model::basic_autoscaling_algorithm::Config>,
452
453    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
454}
455
456impl BasicAutoscalingAlgorithm {
457    pub fn new() -> Self {
458        std::default::Default::default()
459    }
460
461    /// Sets the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
462    ///
463    /// # Example
464    /// ```ignore,no_run
465    /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
466    /// use wkt::Duration;
467    /// let x = BasicAutoscalingAlgorithm::new().set_cooldown_period(Duration::default()/* use setters */);
468    /// ```
469    pub fn set_cooldown_period<T>(mut self, v: T) -> Self
470    where
471        T: std::convert::Into<wkt::Duration>,
472    {
473        self.cooldown_period = std::option::Option::Some(v.into());
474        self
475    }
476
477    /// Sets or clears the value of [cooldown_period][crate::model::BasicAutoscalingAlgorithm::cooldown_period].
478    ///
479    /// # Example
480    /// ```ignore,no_run
481    /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
482    /// use wkt::Duration;
483    /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(Some(Duration::default()/* use setters */));
484    /// let x = BasicAutoscalingAlgorithm::new().set_or_clear_cooldown_period(None::<Duration>);
485    /// ```
486    pub fn set_or_clear_cooldown_period<T>(mut self, v: std::option::Option<T>) -> Self
487    where
488        T: std::convert::Into<wkt::Duration>,
489    {
490        self.cooldown_period = v.map(|x| x.into());
491        self
492    }
493
494    /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config].
495    ///
496    /// Note that all the setters affecting `config` are mutually
497    /// exclusive.
498    ///
499    /// # Example
500    /// ```ignore,no_run
501    /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
502    /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
503    /// let x = BasicAutoscalingAlgorithm::new().set_config(Some(
504    ///     google_cloud_dataproc_v1::model::basic_autoscaling_algorithm::Config::YarnConfig(BasicYarnAutoscalingConfig::default().into())));
505    /// ```
506    pub fn set_config<
507        T: std::convert::Into<std::option::Option<crate::model::basic_autoscaling_algorithm::Config>>,
508    >(
509        mut self,
510        v: T,
511    ) -> Self {
512        self.config = v.into();
513        self
514    }
515
516    /// The value of [config][crate::model::BasicAutoscalingAlgorithm::config]
517    /// if it holds a `YarnConfig`, `None` if the field is not set or
518    /// holds a different branch.
519    pub fn yarn_config(
520        &self,
521    ) -> std::option::Option<&std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>> {
522        #[allow(unreachable_patterns)]
523        self.config.as_ref().and_then(|v| match v {
524            crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v) => {
525                std::option::Option::Some(v)
526            }
527            _ => std::option::Option::None,
528        })
529    }
530
531    /// Sets the value of [config][crate::model::BasicAutoscalingAlgorithm::config]
532    /// to hold a `YarnConfig`.
533    ///
534    /// Note that all the setters affecting `config` are
535    /// mutually exclusive.
536    ///
537    /// # Example
538    /// ```ignore,no_run
539    /// # use google_cloud_dataproc_v1::model::BasicAutoscalingAlgorithm;
540    /// use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
541    /// let x = BasicAutoscalingAlgorithm::new().set_yarn_config(BasicYarnAutoscalingConfig::default()/* use setters */);
542    /// assert!(x.yarn_config().is_some());
543    /// ```
544    pub fn set_yarn_config<
545        T: std::convert::Into<std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>>,
546    >(
547        mut self,
548        v: T,
549    ) -> Self {
550        self.config = std::option::Option::Some(
551            crate::model::basic_autoscaling_algorithm::Config::YarnConfig(v.into()),
552        );
553        self
554    }
555}
556
557impl wkt::message::Message for BasicAutoscalingAlgorithm {
558    fn typename() -> &'static str {
559        "type.googleapis.com/google.cloud.dataproc.v1.BasicAutoscalingAlgorithm"
560    }
561}
562
563/// Defines additional types related to [BasicAutoscalingAlgorithm].
564pub mod basic_autoscaling_algorithm {
565    #[allow(unused_imports)]
566    use super::*;
567
568    #[derive(Clone, Debug, PartialEq)]
569    #[non_exhaustive]
570    pub enum Config {
571        /// Required. YARN autoscaling configuration.
572        YarnConfig(std::boxed::Box<crate::model::BasicYarnAutoscalingConfig>),
573    }
574}
575
576/// Basic autoscaling configurations for YARN.
577#[derive(Clone, Default, PartialEq)]
578#[non_exhaustive]
579pub struct BasicYarnAutoscalingConfig {
580    /// Required. Timeout for YARN graceful decommissioning of Node Managers.
581    /// Specifies the duration to wait for jobs to complete before forcefully
582    /// removing workers (and potentially interrupting jobs). Only applicable to
583    /// downscaling operations.
584    ///
585    /// Bounds: [0s, 1d].
586    pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
587
588    /// Required. Fraction of average YARN pending memory in the last cooldown
589    /// period for which to add workers. A scale-up factor of 1.0 will result in
590    /// scaling up so that there is no pending memory remaining after the update
591    /// (more aggressive scaling). A scale-up factor closer to 0 will result in a
592    /// smaller magnitude of scaling up (less aggressive scaling). See [How
593    /// autoscaling
594    /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
595    /// for more information.
596    ///
597    /// Bounds: [0.0, 1.0].
598    pub scale_up_factor: f64,
599
600    /// Required. Fraction of average YARN pending memory in the last cooldown
601    /// period for which to remove workers. A scale-down factor of 1 will result in
602    /// scaling down so that there is no available memory remaining after the
603    /// update (more aggressive scaling). A scale-down factor of 0 disables
604    /// removing workers, which can be beneficial for autoscaling a single job.
605    /// See [How autoscaling
606    /// works](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works)
607    /// for more information.
608    ///
609    /// Bounds: [0.0, 1.0].
610    pub scale_down_factor: f64,
611
612    /// Optional. Minimum scale-up threshold as a fraction of total cluster size
613    /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
614    /// 0.1 means the autoscaler must recommend at least a 2-worker scale-up for
615    /// the cluster to scale. A threshold of 0 means the autoscaler will scale up
616    /// on any recommended change.
617    ///
618    /// Bounds: [0.0, 1.0]. Default: 0.0.
619    pub scale_up_min_worker_fraction: f64,
620
621    /// Optional. Minimum scale-down threshold as a fraction of total cluster size
622    /// before scaling occurs. For example, in a 20-worker cluster, a threshold of
623    /// 0.1 means the autoscaler must recommend at least a 2 worker scale-down for
624    /// the cluster to scale. A threshold of 0 means the autoscaler will scale down
625    /// on any recommended change.
626    ///
627    /// Bounds: [0.0, 1.0]. Default: 0.0.
628    pub scale_down_min_worker_fraction: f64,
629
630    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
631}
632
633impl BasicYarnAutoscalingConfig {
634    pub fn new() -> Self {
635        std::default::Default::default()
636    }
637
638    /// Sets the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
639    ///
640    /// # Example
641    /// ```ignore,no_run
642    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
643    /// use wkt::Duration;
644    /// let x = BasicYarnAutoscalingConfig::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
645    /// ```
646    pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
647    where
648        T: std::convert::Into<wkt::Duration>,
649    {
650        self.graceful_decommission_timeout = std::option::Option::Some(v.into());
651        self
652    }
653
654    /// Sets or clears the value of [graceful_decommission_timeout][crate::model::BasicYarnAutoscalingConfig::graceful_decommission_timeout].
655    ///
656    /// # Example
657    /// ```ignore,no_run
658    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
659    /// use wkt::Duration;
660    /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
661    /// let x = BasicYarnAutoscalingConfig::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
662    /// ```
663    pub fn set_or_clear_graceful_decommission_timeout<T>(
664        mut self,
665        v: std::option::Option<T>,
666    ) -> Self
667    where
668        T: std::convert::Into<wkt::Duration>,
669    {
670        self.graceful_decommission_timeout = v.map(|x| x.into());
671        self
672    }
673
674    /// Sets the value of [scale_up_factor][crate::model::BasicYarnAutoscalingConfig::scale_up_factor].
675    ///
676    /// # Example
677    /// ```ignore,no_run
678    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
679    /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_factor(42.0);
680    /// ```
681    pub fn set_scale_up_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
682        self.scale_up_factor = v.into();
683        self
684    }
685
686    /// Sets the value of [scale_down_factor][crate::model::BasicYarnAutoscalingConfig::scale_down_factor].
687    ///
688    /// # Example
689    /// ```ignore,no_run
690    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
691    /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_factor(42.0);
692    /// ```
693    pub fn set_scale_down_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
694        self.scale_down_factor = v.into();
695        self
696    }
697
698    /// Sets the value of [scale_up_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_up_min_worker_fraction].
699    ///
700    /// # Example
701    /// ```ignore,no_run
702    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
703    /// let x = BasicYarnAutoscalingConfig::new().set_scale_up_min_worker_fraction(42.0);
704    /// ```
705    pub fn set_scale_up_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
706        self.scale_up_min_worker_fraction = v.into();
707        self
708    }
709
710    /// Sets the value of [scale_down_min_worker_fraction][crate::model::BasicYarnAutoscalingConfig::scale_down_min_worker_fraction].
711    ///
712    /// # Example
713    /// ```ignore,no_run
714    /// # use google_cloud_dataproc_v1::model::BasicYarnAutoscalingConfig;
715    /// let x = BasicYarnAutoscalingConfig::new().set_scale_down_min_worker_fraction(42.0);
716    /// ```
717    pub fn set_scale_down_min_worker_fraction<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
718        self.scale_down_min_worker_fraction = v.into();
719        self
720    }
721}
722
723impl wkt::message::Message for BasicYarnAutoscalingConfig {
724    fn typename() -> &'static str {
725        "type.googleapis.com/google.cloud.dataproc.v1.BasicYarnAutoscalingConfig"
726    }
727}
728
729/// Configuration for the size bounds of an instance group, including its
730/// proportional size to other groups.
731#[derive(Clone, Default, PartialEq)]
732#[non_exhaustive]
733pub struct InstanceGroupAutoscalingPolicyConfig {
734    /// Optional. Minimum number of instances for this group.
735    ///
736    /// Primary workers - Bounds: [2, max_instances]. Default: 2.
737    /// Secondary workers - Bounds: [0, max_instances]. Default: 0.
738    pub min_instances: i32,
739
740    /// Required. Maximum number of instances for this group. Required for primary
741    /// workers. Note that by default, clusters will not use secondary workers.
742    /// Required for secondary workers if the minimum secondary instances is set.
743    ///
744    /// Primary workers - Bounds: [min_instances, ).
745    /// Secondary workers - Bounds: [min_instances, ). Default: 0.
746    pub max_instances: i32,
747
748    /// Optional. Weight for the instance group, which is used to determine the
749    /// fraction of total workers in the cluster from this instance group.
750    /// For example, if primary workers have weight 2, and secondary workers have
751    /// weight 1, the cluster will have approximately 2 primary workers for each
752    /// secondary worker.
753    ///
754    /// The cluster may not reach the specified balance if constrained
755    /// by min/max bounds or other autoscaling settings. For example, if
756    /// `max_instances` for secondary workers is 0, then only primary workers will
757    /// be added. The cluster can also be out of balance when created.
758    ///
759    /// If weight is not set on any instance group, the cluster will default to
760    /// equal weight for all groups: the cluster will attempt to maintain an equal
761    /// number of workers in each group within the configured size bounds for each
762    /// group. If weight is set for one group only, the cluster will default to
763    /// zero weight on the unset group. For example if weight is set only on
764    /// primary workers, the cluster will use primary workers only and no
765    /// secondary workers.
766    pub weight: i32,
767
768    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
769}
770
771impl InstanceGroupAutoscalingPolicyConfig {
772    pub fn new() -> Self {
773        std::default::Default::default()
774    }
775
776    /// Sets the value of [min_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::min_instances].
777    ///
778    /// # Example
779    /// ```ignore,no_run
780    /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
781    /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_min_instances(42);
782    /// ```
783    pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
784        self.min_instances = v.into();
785        self
786    }
787
788    /// Sets the value of [max_instances][crate::model::InstanceGroupAutoscalingPolicyConfig::max_instances].
789    ///
790    /// # Example
791    /// ```ignore,no_run
792    /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
793    /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_max_instances(42);
794    /// ```
795    pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
796        self.max_instances = v.into();
797        self
798    }
799
800    /// Sets the value of [weight][crate::model::InstanceGroupAutoscalingPolicyConfig::weight].
801    ///
802    /// # Example
803    /// ```ignore,no_run
804    /// # use google_cloud_dataproc_v1::model::InstanceGroupAutoscalingPolicyConfig;
805    /// let x = InstanceGroupAutoscalingPolicyConfig::new().set_weight(42);
806    /// ```
807    pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
808        self.weight = v.into();
809        self
810    }
811}
812
813impl wkt::message::Message for InstanceGroupAutoscalingPolicyConfig {
814    fn typename() -> &'static str {
815        "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig"
816    }
817}
818
819/// A request to create an autoscaling policy.
820#[derive(Clone, Default, PartialEq)]
821#[non_exhaustive]
822pub struct CreateAutoscalingPolicyRequest {
823    /// Required. The "resource name" of the region or location, as described
824    /// in <https://cloud.google.com/apis/design/resource_names>.
825    ///
826    /// * For `projects.regions.autoscalingPolicies.create`, the resource name
827    ///   of the region has the following format:
828    ///   `projects/{project_id}/regions/{region}`
829    ///
830    /// * For `projects.locations.autoscalingPolicies.create`, the resource name
831    ///   of the location has the following format:
832    ///   `projects/{project_id}/locations/{location}`
833    ///
834    pub parent: std::string::String,
835
836    /// Required. The autoscaling policy to create.
837    pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
838
839    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
840}
841
842impl CreateAutoscalingPolicyRequest {
843    pub fn new() -> Self {
844        std::default::Default::default()
845    }
846
847    /// Sets the value of [parent][crate::model::CreateAutoscalingPolicyRequest::parent].
848    ///
849    /// # Example
850    /// ```ignore,no_run
851    /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
852    /// let x = CreateAutoscalingPolicyRequest::new().set_parent("example");
853    /// ```
854    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
855        self.parent = v.into();
856        self
857    }
858
859    /// Sets the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
860    ///
861    /// # Example
862    /// ```ignore,no_run
863    /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
864    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
865    /// let x = CreateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
866    /// ```
867    pub fn set_policy<T>(mut self, v: T) -> Self
868    where
869        T: std::convert::Into<crate::model::AutoscalingPolicy>,
870    {
871        self.policy = std::option::Option::Some(v.into());
872        self
873    }
874
875    /// Sets or clears the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
876    ///
877    /// # Example
878    /// ```ignore,no_run
879    /// # use google_cloud_dataproc_v1::model::CreateAutoscalingPolicyRequest;
880    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
881    /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
882    /// let x = CreateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
883    /// ```
884    pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
885    where
886        T: std::convert::Into<crate::model::AutoscalingPolicy>,
887    {
888        self.policy = v.map(|x| x.into());
889        self
890    }
891}
892
893impl wkt::message::Message for CreateAutoscalingPolicyRequest {
894    fn typename() -> &'static str {
895        "type.googleapis.com/google.cloud.dataproc.v1.CreateAutoscalingPolicyRequest"
896    }
897}
898
899/// A request to fetch an autoscaling policy.
900#[derive(Clone, Default, PartialEq)]
901#[non_exhaustive]
902pub struct GetAutoscalingPolicyRequest {
903    /// Required. The "resource name" of the autoscaling policy, as described
904    /// in <https://cloud.google.com/apis/design/resource_names>.
905    ///
906    /// * For `projects.regions.autoscalingPolicies.get`, the resource name
907    ///   of the policy has the following format:
908    ///   `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
909    ///
910    /// * For `projects.locations.autoscalingPolicies.get`, the resource name
911    ///   of the policy has the following format:
912    ///   `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
913    ///
914    pub name: std::string::String,
915
916    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
917}
918
919impl GetAutoscalingPolicyRequest {
920    pub fn new() -> Self {
921        std::default::Default::default()
922    }
923
924    /// Sets the value of [name][crate::model::GetAutoscalingPolicyRequest::name].
925    ///
926    /// # Example
927    /// ```ignore,no_run
928    /// # use google_cloud_dataproc_v1::model::GetAutoscalingPolicyRequest;
929    /// let x = GetAutoscalingPolicyRequest::new().set_name("example");
930    /// ```
931    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
932        self.name = v.into();
933        self
934    }
935}
936
937impl wkt::message::Message for GetAutoscalingPolicyRequest {
938    fn typename() -> &'static str {
939        "type.googleapis.com/google.cloud.dataproc.v1.GetAutoscalingPolicyRequest"
940    }
941}
942
943/// A request to update an autoscaling policy.
944#[derive(Clone, Default, PartialEq)]
945#[non_exhaustive]
946pub struct UpdateAutoscalingPolicyRequest {
947    /// Required. The updated autoscaling policy.
948    pub policy: std::option::Option<crate::model::AutoscalingPolicy>,
949
950    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
951}
952
953impl UpdateAutoscalingPolicyRequest {
954    pub fn new() -> Self {
955        std::default::Default::default()
956    }
957
958    /// Sets the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
959    ///
960    /// # Example
961    /// ```ignore,no_run
962    /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
963    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
964    /// let x = UpdateAutoscalingPolicyRequest::new().set_policy(AutoscalingPolicy::default()/* use setters */);
965    /// ```
966    pub fn set_policy<T>(mut self, v: T) -> Self
967    where
968        T: std::convert::Into<crate::model::AutoscalingPolicy>,
969    {
970        self.policy = std::option::Option::Some(v.into());
971        self
972    }
973
974    /// Sets or clears the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
975    ///
976    /// # Example
977    /// ```ignore,no_run
978    /// # use google_cloud_dataproc_v1::model::UpdateAutoscalingPolicyRequest;
979    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
980    /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(Some(AutoscalingPolicy::default()/* use setters */));
981    /// let x = UpdateAutoscalingPolicyRequest::new().set_or_clear_policy(None::<AutoscalingPolicy>);
982    /// ```
983    pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
984    where
985        T: std::convert::Into<crate::model::AutoscalingPolicy>,
986    {
987        self.policy = v.map(|x| x.into());
988        self
989    }
990}
991
992impl wkt::message::Message for UpdateAutoscalingPolicyRequest {
993    fn typename() -> &'static str {
994        "type.googleapis.com/google.cloud.dataproc.v1.UpdateAutoscalingPolicyRequest"
995    }
996}
997
998/// A request to delete an autoscaling policy.
999///
1000/// Autoscaling policies in use by one or more clusters will not be deleted.
1001#[derive(Clone, Default, PartialEq)]
1002#[non_exhaustive]
1003pub struct DeleteAutoscalingPolicyRequest {
1004    /// Required. The "resource name" of the autoscaling policy, as described
1005    /// in <https://cloud.google.com/apis/design/resource_names>.
1006    ///
1007    /// * For `projects.regions.autoscalingPolicies.delete`, the resource name
1008    ///   of the policy has the following format:
1009    ///   `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
1010    ///
1011    /// * For `projects.locations.autoscalingPolicies.delete`, the resource name
1012    ///   of the policy has the following format:
1013    ///   `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
1014    ///
1015    pub name: std::string::String,
1016
1017    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1018}
1019
1020impl DeleteAutoscalingPolicyRequest {
1021    pub fn new() -> Self {
1022        std::default::Default::default()
1023    }
1024
1025    /// Sets the value of [name][crate::model::DeleteAutoscalingPolicyRequest::name].
1026    ///
1027    /// # Example
1028    /// ```ignore,no_run
1029    /// # use google_cloud_dataproc_v1::model::DeleteAutoscalingPolicyRequest;
1030    /// let x = DeleteAutoscalingPolicyRequest::new().set_name("example");
1031    /// ```
1032    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1033        self.name = v.into();
1034        self
1035    }
1036}
1037
1038impl wkt::message::Message for DeleteAutoscalingPolicyRequest {
1039    fn typename() -> &'static str {
1040        "type.googleapis.com/google.cloud.dataproc.v1.DeleteAutoscalingPolicyRequest"
1041    }
1042}
1043
1044/// A request to list autoscaling policies in a project.
1045#[derive(Clone, Default, PartialEq)]
1046#[non_exhaustive]
1047pub struct ListAutoscalingPoliciesRequest {
1048    /// Required. The "resource name" of the region or location, as described
1049    /// in <https://cloud.google.com/apis/design/resource_names>.
1050    ///
1051    /// * For `projects.regions.autoscalingPolicies.list`, the resource name
1052    ///   of the region has the following format:
1053    ///   `projects/{project_id}/regions/{region}`
1054    ///
1055    /// * For `projects.locations.autoscalingPolicies.list`, the resource name
1056    ///   of the location has the following format:
1057    ///   `projects/{project_id}/locations/{location}`
1058    ///
1059    pub parent: std::string::String,
1060
1061    /// Optional. The maximum number of results to return in each response.
1062    /// Must be less than or equal to 1000. Defaults to 100.
1063    pub page_size: i32,
1064
1065    /// Optional. The page token, returned by a previous call, to request the
1066    /// next page of results.
1067    pub page_token: std::string::String,
1068
1069    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1070}
1071
1072impl ListAutoscalingPoliciesRequest {
1073    pub fn new() -> Self {
1074        std::default::Default::default()
1075    }
1076
1077    /// Sets the value of [parent][crate::model::ListAutoscalingPoliciesRequest::parent].
1078    ///
1079    /// # Example
1080    /// ```ignore,no_run
1081    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1082    /// let x = ListAutoscalingPoliciesRequest::new().set_parent("example");
1083    /// ```
1084    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1085        self.parent = v.into();
1086        self
1087    }
1088
1089    /// Sets the value of [page_size][crate::model::ListAutoscalingPoliciesRequest::page_size].
1090    ///
1091    /// # Example
1092    /// ```ignore,no_run
1093    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1094    /// let x = ListAutoscalingPoliciesRequest::new().set_page_size(42);
1095    /// ```
1096    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1097        self.page_size = v.into();
1098        self
1099    }
1100
1101    /// Sets the value of [page_token][crate::model::ListAutoscalingPoliciesRequest::page_token].
1102    ///
1103    /// # Example
1104    /// ```ignore,no_run
1105    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesRequest;
1106    /// let x = ListAutoscalingPoliciesRequest::new().set_page_token("example");
1107    /// ```
1108    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1109        self.page_token = v.into();
1110        self
1111    }
1112}
1113
1114impl wkt::message::Message for ListAutoscalingPoliciesRequest {
1115    fn typename() -> &'static str {
1116        "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesRequest"
1117    }
1118}
1119
1120/// A response to a request to list autoscaling policies in a project.
1121#[derive(Clone, Default, PartialEq)]
1122#[non_exhaustive]
1123pub struct ListAutoscalingPoliciesResponse {
1124    /// Output only. Autoscaling policies list.
1125    pub policies: std::vec::Vec<crate::model::AutoscalingPolicy>,
1126
1127    /// Output only. This token is included in the response if there are more
1128    /// results to fetch.
1129    pub next_page_token: std::string::String,
1130
1131    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1132}
1133
1134impl ListAutoscalingPoliciesResponse {
1135    pub fn new() -> Self {
1136        std::default::Default::default()
1137    }
1138
1139    /// Sets the value of [policies][crate::model::ListAutoscalingPoliciesResponse::policies].
1140    ///
1141    /// # Example
1142    /// ```ignore,no_run
1143    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1144    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
1145    /// let x = ListAutoscalingPoliciesResponse::new()
1146    ///     .set_policies([
1147    ///         AutoscalingPolicy::default()/* use setters */,
1148    ///         AutoscalingPolicy::default()/* use (different) setters */,
1149    ///     ]);
1150    /// ```
1151    pub fn set_policies<T, V>(mut self, v: T) -> Self
1152    where
1153        T: std::iter::IntoIterator<Item = V>,
1154        V: std::convert::Into<crate::model::AutoscalingPolicy>,
1155    {
1156        use std::iter::Iterator;
1157        self.policies = v.into_iter().map(|i| i.into()).collect();
1158        self
1159    }
1160
1161    /// Sets the value of [next_page_token][crate::model::ListAutoscalingPoliciesResponse::next_page_token].
1162    ///
1163    /// # Example
1164    /// ```ignore,no_run
1165    /// # use google_cloud_dataproc_v1::model::ListAutoscalingPoliciesResponse;
1166    /// let x = ListAutoscalingPoliciesResponse::new().set_next_page_token("example");
1167    /// ```
1168    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1169        self.next_page_token = v.into();
1170        self
1171    }
1172}
1173
1174impl wkt::message::Message for ListAutoscalingPoliciesResponse {
1175    fn typename() -> &'static str {
1176        "type.googleapis.com/google.cloud.dataproc.v1.ListAutoscalingPoliciesResponse"
1177    }
1178}
1179
1180#[doc(hidden)]
1181impl google_cloud_gax::paginator::internal::PageableResponse for ListAutoscalingPoliciesResponse {
1182    type PageItem = crate::model::AutoscalingPolicy;
1183
1184    fn items(self) -> std::vec::Vec<Self::PageItem> {
1185        self.policies
1186    }
1187
1188    fn next_page_token(&self) -> std::string::String {
1189        use std::clone::Clone;
1190        self.next_page_token.clone()
1191    }
1192}
1193
1194/// A request to create a batch workload.
1195#[derive(Clone, Default, PartialEq)]
1196#[non_exhaustive]
1197pub struct CreateBatchRequest {
1198    /// Required. The parent resource where this batch will be created.
1199    pub parent: std::string::String,
1200
1201    /// Required. The batch to create.
1202    pub batch: std::option::Option<crate::model::Batch>,
1203
1204    /// Optional. The ID to use for the batch, which will become the final
1205    /// component of the batch's resource name.
1206    ///
1207    /// This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
1208    pub batch_id: std::string::String,
1209
1210    /// Optional. A unique ID used to identify the request. If the service
1211    /// receives two
1212    /// [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
1213    /// with the same request_id, the second request is ignored and the
1214    /// Operation that corresponds to the first Batch created and stored
1215    /// in the backend is returned.
1216    ///
1217    /// Recommendation: Set this value to a
1218    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
1219    ///
1220    /// The value must contain only letters (a-z, A-Z), numbers (0-9),
1221    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
1222    pub request_id: std::string::String,
1223
1224    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1225}
1226
1227impl CreateBatchRequest {
1228    pub fn new() -> Self {
1229        std::default::Default::default()
1230    }
1231
1232    /// Sets the value of [parent][crate::model::CreateBatchRequest::parent].
1233    ///
1234    /// # Example
1235    /// ```ignore,no_run
1236    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1237    /// let x = CreateBatchRequest::new().set_parent("example");
1238    /// ```
1239    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1240        self.parent = v.into();
1241        self
1242    }
1243
1244    /// Sets the value of [batch][crate::model::CreateBatchRequest::batch].
1245    ///
1246    /// # Example
1247    /// ```ignore,no_run
1248    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1249    /// use google_cloud_dataproc_v1::model::Batch;
1250    /// let x = CreateBatchRequest::new().set_batch(Batch::default()/* use setters */);
1251    /// ```
1252    pub fn set_batch<T>(mut self, v: T) -> Self
1253    where
1254        T: std::convert::Into<crate::model::Batch>,
1255    {
1256        self.batch = std::option::Option::Some(v.into());
1257        self
1258    }
1259
1260    /// Sets or clears the value of [batch][crate::model::CreateBatchRequest::batch].
1261    ///
1262    /// # Example
1263    /// ```ignore,no_run
1264    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1265    /// use google_cloud_dataproc_v1::model::Batch;
1266    /// let x = CreateBatchRequest::new().set_or_clear_batch(Some(Batch::default()/* use setters */));
1267    /// let x = CreateBatchRequest::new().set_or_clear_batch(None::<Batch>);
1268    /// ```
1269    pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1270    where
1271        T: std::convert::Into<crate::model::Batch>,
1272    {
1273        self.batch = v.map(|x| x.into());
1274        self
1275    }
1276
1277    /// Sets the value of [batch_id][crate::model::CreateBatchRequest::batch_id].
1278    ///
1279    /// # Example
1280    /// ```ignore,no_run
1281    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1282    /// let x = CreateBatchRequest::new().set_batch_id("example");
1283    /// ```
1284    pub fn set_batch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1285        self.batch_id = v.into();
1286        self
1287    }
1288
1289    /// Sets the value of [request_id][crate::model::CreateBatchRequest::request_id].
1290    ///
1291    /// # Example
1292    /// ```ignore,no_run
1293    /// # use google_cloud_dataproc_v1::model::CreateBatchRequest;
1294    /// let x = CreateBatchRequest::new().set_request_id("example");
1295    /// ```
1296    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1297        self.request_id = v.into();
1298        self
1299    }
1300}
1301
1302impl wkt::message::Message for CreateBatchRequest {
1303    fn typename() -> &'static str {
1304        "type.googleapis.com/google.cloud.dataproc.v1.CreateBatchRequest"
1305    }
1306}
1307
1308/// A request to get the resource representation for a batch workload.
1309#[derive(Clone, Default, PartialEq)]
1310#[non_exhaustive]
1311pub struct GetBatchRequest {
1312    /// Required. The fully qualified name of the batch to retrieve
1313    /// in the format
1314    /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1315    pub name: std::string::String,
1316
1317    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1318}
1319
1320impl GetBatchRequest {
1321    pub fn new() -> Self {
1322        std::default::Default::default()
1323    }
1324
1325    /// Sets the value of [name][crate::model::GetBatchRequest::name].
1326    ///
1327    /// # Example
1328    /// ```ignore,no_run
1329    /// # use google_cloud_dataproc_v1::model::GetBatchRequest;
1330    /// let x = GetBatchRequest::new().set_name("example");
1331    /// ```
1332    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1333        self.name = v.into();
1334        self
1335    }
1336}
1337
1338impl wkt::message::Message for GetBatchRequest {
1339    fn typename() -> &'static str {
1340        "type.googleapis.com/google.cloud.dataproc.v1.GetBatchRequest"
1341    }
1342}
1343
1344/// A request to list batch workloads in a project.
1345#[derive(Clone, Default, PartialEq)]
1346#[non_exhaustive]
1347pub struct ListBatchesRequest {
1348    /// Required. The parent, which owns this collection of batches.
1349    pub parent: std::string::String,
1350
1351    /// Optional. The maximum number of batches to return in each response.
1352    /// The service may return fewer than this value.
1353    /// The default page size is 20; the maximum page size is 1000.
1354    pub page_size: i32,
1355
1356    /// Optional. A page token received from a previous `ListBatches` call.
1357    /// Provide this token to retrieve the subsequent page.
1358    pub page_token: std::string::String,
1359
1360    /// Optional. A filter for the batches to return in the response.
1361    ///
1362    /// A filter is a logical expression constraining the values of various fields
1363    /// in each batch resource. Filters are case sensitive, and may contain
1364    /// multiple clauses combined with logical operators (AND/OR).
1365    /// Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`.
1366    ///
1367    /// e.g. `state = RUNNING and create_time < "2023-01-01T00:00:00Z"`
1368    /// filters for batches in state RUNNING that were created before 2023-01-01
1369    ///
1370    /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
1371    /// description of the filter syntax and a list of supported comparisons.
1372    pub filter: std::string::String,
1373
1374    /// Optional. Field(s) on which to sort the list of batches.
1375    ///
1376    /// Currently the only supported sort orders are unspecified (empty) and
1377    /// `create_time desc` to sort by most recently created batches first.
1378    ///
1379    /// See <https://google.aip.dev/132#ordering> for more details.
1380    pub order_by: std::string::String,
1381
1382    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1383}
1384
1385impl ListBatchesRequest {
1386    pub fn new() -> Self {
1387        std::default::Default::default()
1388    }
1389
1390    /// Sets the value of [parent][crate::model::ListBatchesRequest::parent].
1391    ///
1392    /// # Example
1393    /// ```ignore,no_run
1394    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1395    /// let x = ListBatchesRequest::new().set_parent("example");
1396    /// ```
1397    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1398        self.parent = v.into();
1399        self
1400    }
1401
1402    /// Sets the value of [page_size][crate::model::ListBatchesRequest::page_size].
1403    ///
1404    /// # Example
1405    /// ```ignore,no_run
1406    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1407    /// let x = ListBatchesRequest::new().set_page_size(42);
1408    /// ```
1409    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1410        self.page_size = v.into();
1411        self
1412    }
1413
1414    /// Sets the value of [page_token][crate::model::ListBatchesRequest::page_token].
1415    ///
1416    /// # Example
1417    /// ```ignore,no_run
1418    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1419    /// let x = ListBatchesRequest::new().set_page_token("example");
1420    /// ```
1421    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1422        self.page_token = v.into();
1423        self
1424    }
1425
1426    /// Sets the value of [filter][crate::model::ListBatchesRequest::filter].
1427    ///
1428    /// # Example
1429    /// ```ignore,no_run
1430    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1431    /// let x = ListBatchesRequest::new().set_filter("example");
1432    /// ```
1433    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1434        self.filter = v.into();
1435        self
1436    }
1437
1438    /// Sets the value of [order_by][crate::model::ListBatchesRequest::order_by].
1439    ///
1440    /// # Example
1441    /// ```ignore,no_run
1442    /// # use google_cloud_dataproc_v1::model::ListBatchesRequest;
1443    /// let x = ListBatchesRequest::new().set_order_by("example");
1444    /// ```
1445    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1446        self.order_by = v.into();
1447        self
1448    }
1449}
1450
1451impl wkt::message::Message for ListBatchesRequest {
1452    fn typename() -> &'static str {
1453        "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesRequest"
1454    }
1455}
1456
1457/// A list of batch workloads.
1458#[derive(Clone, Default, PartialEq)]
1459#[non_exhaustive]
1460pub struct ListBatchesResponse {
1461    /// The batches from the specified collection.
1462    pub batches: std::vec::Vec<crate::model::Batch>,
1463
1464    /// A token, which can be sent as `page_token` to retrieve the next page.
1465    /// If this field is omitted, there are no subsequent pages.
1466    pub next_page_token: std::string::String,
1467
1468    /// Output only. List of Batches that could not be included in the response.
1469    /// Attempting to get one of these resources may indicate why it was not
1470    /// included in the list response.
1471    pub unreachable: std::vec::Vec<std::string::String>,
1472
1473    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1474}
1475
1476impl ListBatchesResponse {
1477    pub fn new() -> Self {
1478        std::default::Default::default()
1479    }
1480
1481    /// Sets the value of [batches][crate::model::ListBatchesResponse::batches].
1482    ///
1483    /// # Example
1484    /// ```ignore,no_run
1485    /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1486    /// use google_cloud_dataproc_v1::model::Batch;
1487    /// let x = ListBatchesResponse::new()
1488    ///     .set_batches([
1489    ///         Batch::default()/* use setters */,
1490    ///         Batch::default()/* use (different) setters */,
1491    ///     ]);
1492    /// ```
1493    pub fn set_batches<T, V>(mut self, v: T) -> Self
1494    where
1495        T: std::iter::IntoIterator<Item = V>,
1496        V: std::convert::Into<crate::model::Batch>,
1497    {
1498        use std::iter::Iterator;
1499        self.batches = v.into_iter().map(|i| i.into()).collect();
1500        self
1501    }
1502
1503    /// Sets the value of [next_page_token][crate::model::ListBatchesResponse::next_page_token].
1504    ///
1505    /// # Example
1506    /// ```ignore,no_run
1507    /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1508    /// let x = ListBatchesResponse::new().set_next_page_token("example");
1509    /// ```
1510    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1511        self.next_page_token = v.into();
1512        self
1513    }
1514
1515    /// Sets the value of [unreachable][crate::model::ListBatchesResponse::unreachable].
1516    ///
1517    /// # Example
1518    /// ```ignore,no_run
1519    /// # use google_cloud_dataproc_v1::model::ListBatchesResponse;
1520    /// let x = ListBatchesResponse::new().set_unreachable(["a", "b", "c"]);
1521    /// ```
1522    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1523    where
1524        T: std::iter::IntoIterator<Item = V>,
1525        V: std::convert::Into<std::string::String>,
1526    {
1527        use std::iter::Iterator;
1528        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1529        self
1530    }
1531}
1532
1533impl wkt::message::Message for ListBatchesResponse {
1534    fn typename() -> &'static str {
1535        "type.googleapis.com/google.cloud.dataproc.v1.ListBatchesResponse"
1536    }
1537}
1538
1539#[doc(hidden)]
1540impl google_cloud_gax::paginator::internal::PageableResponse for ListBatchesResponse {
1541    type PageItem = crate::model::Batch;
1542
1543    fn items(self) -> std::vec::Vec<Self::PageItem> {
1544        self.batches
1545    }
1546
1547    fn next_page_token(&self) -> std::string::String {
1548        use std::clone::Clone;
1549        self.next_page_token.clone()
1550    }
1551}
1552
1553/// A request to delete a batch workload.
1554#[derive(Clone, Default, PartialEq)]
1555#[non_exhaustive]
1556pub struct DeleteBatchRequest {
1557    /// Required. The fully qualified name of the batch to retrieve
1558    /// in the format
1559    /// "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
1560    pub name: std::string::String,
1561
1562    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1563}
1564
1565impl DeleteBatchRequest {
1566    pub fn new() -> Self {
1567        std::default::Default::default()
1568    }
1569
1570    /// Sets the value of [name][crate::model::DeleteBatchRequest::name].
1571    ///
1572    /// # Example
1573    /// ```ignore,no_run
1574    /// # use google_cloud_dataproc_v1::model::DeleteBatchRequest;
1575    /// let x = DeleteBatchRequest::new().set_name("example");
1576    /// ```
1577    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1578        self.name = v.into();
1579        self
1580    }
1581}
1582
1583impl wkt::message::Message for DeleteBatchRequest {
1584    fn typename() -> &'static str {
1585        "type.googleapis.com/google.cloud.dataproc.v1.DeleteBatchRequest"
1586    }
1587}
1588
1589/// A representation of a batch workload in the service.
1590#[derive(Clone, Default, PartialEq)]
1591#[non_exhaustive]
1592pub struct Batch {
1593    /// Output only. The resource name of the batch.
1594    pub name: std::string::String,
1595
1596    /// Output only. A batch UUID (Unique Universal Identifier). The service
1597    /// generates this value when it creates the batch.
1598    pub uuid: std::string::String,
1599
1600    /// Output only. The time when the batch was created.
1601    pub create_time: std::option::Option<wkt::Timestamp>,
1602
1603    /// Output only. Runtime information about batch execution.
1604    pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
1605
1606    /// Output only. The state of the batch.
1607    pub state: crate::model::batch::State,
1608
1609    /// Output only. Batch state details, such as a failure
1610    /// description if the state is `FAILED`.
1611    pub state_message: std::string::String,
1612
1613    /// Output only. The time when the batch entered a current state.
1614    pub state_time: std::option::Option<wkt::Timestamp>,
1615
1616    /// Output only. The email address of the user who created the batch.
1617    pub creator: std::string::String,
1618
1619    /// Optional. The labels to associate with this batch.
1620    /// Label **keys** must contain 1 to 63 characters, and must conform to
1621    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
1622    /// Label **values** may be empty, but, if present, must contain 1 to 63
1623    /// characters, and must conform to [RFC
1624    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
1625    /// associated with a batch.
1626    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1627
1628    /// Optional. Runtime configuration for the batch execution.
1629    pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
1630
1631    /// Optional. Environment configuration for the batch execution.
1632    pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
1633
1634    /// Output only. The resource name of the operation associated with this batch.
1635    pub operation: std::string::String,
1636
1637    /// Output only. Historical state information for the batch.
1638    pub state_history: std::vec::Vec<crate::model::batch::StateHistory>,
1639
1640    /// The application/framework-specific portion of the batch configuration.
1641    pub batch_config: std::option::Option<crate::model::batch::BatchConfig>,
1642
1643    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1644}
1645
1646impl Batch {
1647    pub fn new() -> Self {
1648        std::default::Default::default()
1649    }
1650
1651    /// Sets the value of [name][crate::model::Batch::name].
1652    ///
1653    /// # Example
1654    /// ```ignore,no_run
1655    /// # use google_cloud_dataproc_v1::model::Batch;
1656    /// let x = Batch::new().set_name("example");
1657    /// ```
1658    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1659        self.name = v.into();
1660        self
1661    }
1662
1663    /// Sets the value of [uuid][crate::model::Batch::uuid].
1664    ///
1665    /// # Example
1666    /// ```ignore,no_run
1667    /// # use google_cloud_dataproc_v1::model::Batch;
1668    /// let x = Batch::new().set_uuid("example");
1669    /// ```
1670    pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1671        self.uuid = v.into();
1672        self
1673    }
1674
1675    /// Sets the value of [create_time][crate::model::Batch::create_time].
1676    ///
1677    /// # Example
1678    /// ```ignore,no_run
1679    /// # use google_cloud_dataproc_v1::model::Batch;
1680    /// use wkt::Timestamp;
1681    /// let x = Batch::new().set_create_time(Timestamp::default()/* use setters */);
1682    /// ```
1683    pub fn set_create_time<T>(mut self, v: T) -> Self
1684    where
1685        T: std::convert::Into<wkt::Timestamp>,
1686    {
1687        self.create_time = std::option::Option::Some(v.into());
1688        self
1689    }
1690
1691    /// Sets or clears the value of [create_time][crate::model::Batch::create_time].
1692    ///
1693    /// # Example
1694    /// ```ignore,no_run
1695    /// # use google_cloud_dataproc_v1::model::Batch;
1696    /// use wkt::Timestamp;
1697    /// let x = Batch::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1698    /// let x = Batch::new().set_or_clear_create_time(None::<Timestamp>);
1699    /// ```
1700    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1701    where
1702        T: std::convert::Into<wkt::Timestamp>,
1703    {
1704        self.create_time = v.map(|x| x.into());
1705        self
1706    }
1707
1708    /// Sets the value of [runtime_info][crate::model::Batch::runtime_info].
1709    ///
1710    /// # Example
1711    /// ```ignore,no_run
1712    /// # use google_cloud_dataproc_v1::model::Batch;
1713    /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1714    /// let x = Batch::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
1715    /// ```
1716    pub fn set_runtime_info<T>(mut self, v: T) -> Self
1717    where
1718        T: std::convert::Into<crate::model::RuntimeInfo>,
1719    {
1720        self.runtime_info = std::option::Option::Some(v.into());
1721        self
1722    }
1723
1724    /// Sets or clears the value of [runtime_info][crate::model::Batch::runtime_info].
1725    ///
1726    /// # Example
1727    /// ```ignore,no_run
1728    /// # use google_cloud_dataproc_v1::model::Batch;
1729    /// use google_cloud_dataproc_v1::model::RuntimeInfo;
1730    /// let x = Batch::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
1731    /// let x = Batch::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
1732    /// ```
1733    pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
1734    where
1735        T: std::convert::Into<crate::model::RuntimeInfo>,
1736    {
1737        self.runtime_info = v.map(|x| x.into());
1738        self
1739    }
1740
1741    /// Sets the value of [state][crate::model::Batch::state].
1742    ///
1743    /// # Example
1744    /// ```ignore,no_run
1745    /// # use google_cloud_dataproc_v1::model::Batch;
1746    /// use google_cloud_dataproc_v1::model::batch::State;
1747    /// let x0 = Batch::new().set_state(State::Pending);
1748    /// let x1 = Batch::new().set_state(State::Running);
1749    /// let x2 = Batch::new().set_state(State::Cancelling);
1750    /// ```
1751    pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(mut self, v: T) -> Self {
1752        self.state = v.into();
1753        self
1754    }
1755
1756    /// Sets the value of [state_message][crate::model::Batch::state_message].
1757    ///
1758    /// # Example
1759    /// ```ignore,no_run
1760    /// # use google_cloud_dataproc_v1::model::Batch;
1761    /// let x = Batch::new().set_state_message("example");
1762    /// ```
1763    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1764        self.state_message = v.into();
1765        self
1766    }
1767
1768    /// Sets the value of [state_time][crate::model::Batch::state_time].
1769    ///
1770    /// # Example
1771    /// ```ignore,no_run
1772    /// # use google_cloud_dataproc_v1::model::Batch;
1773    /// use wkt::Timestamp;
1774    /// let x = Batch::new().set_state_time(Timestamp::default()/* use setters */);
1775    /// ```
1776    pub fn set_state_time<T>(mut self, v: T) -> Self
1777    where
1778        T: std::convert::Into<wkt::Timestamp>,
1779    {
1780        self.state_time = std::option::Option::Some(v.into());
1781        self
1782    }
1783
1784    /// Sets or clears the value of [state_time][crate::model::Batch::state_time].
1785    ///
1786    /// # Example
1787    /// ```ignore,no_run
1788    /// # use google_cloud_dataproc_v1::model::Batch;
1789    /// use wkt::Timestamp;
1790    /// let x = Batch::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
1791    /// let x = Batch::new().set_or_clear_state_time(None::<Timestamp>);
1792    /// ```
1793    pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
1794    where
1795        T: std::convert::Into<wkt::Timestamp>,
1796    {
1797        self.state_time = v.map(|x| x.into());
1798        self
1799    }
1800
1801    /// Sets the value of [creator][crate::model::Batch::creator].
1802    ///
1803    /// # Example
1804    /// ```ignore,no_run
1805    /// # use google_cloud_dataproc_v1::model::Batch;
1806    /// let x = Batch::new().set_creator("example");
1807    /// ```
1808    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1809        self.creator = v.into();
1810        self
1811    }
1812
1813    /// Sets the value of [labels][crate::model::Batch::labels].
1814    ///
1815    /// # Example
1816    /// ```ignore,no_run
1817    /// # use google_cloud_dataproc_v1::model::Batch;
1818    /// let x = Batch::new().set_labels([
1819    ///     ("key0", "abc"),
1820    ///     ("key1", "xyz"),
1821    /// ]);
1822    /// ```
1823    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1824    where
1825        T: std::iter::IntoIterator<Item = (K, V)>,
1826        K: std::convert::Into<std::string::String>,
1827        V: std::convert::Into<std::string::String>,
1828    {
1829        use std::iter::Iterator;
1830        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1831        self
1832    }
1833
1834    /// Sets the value of [runtime_config][crate::model::Batch::runtime_config].
1835    ///
1836    /// # Example
1837    /// ```ignore,no_run
1838    /// # use google_cloud_dataproc_v1::model::Batch;
1839    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1840    /// let x = Batch::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
1841    /// ```
1842    pub fn set_runtime_config<T>(mut self, v: T) -> Self
1843    where
1844        T: std::convert::Into<crate::model::RuntimeConfig>,
1845    {
1846        self.runtime_config = std::option::Option::Some(v.into());
1847        self
1848    }
1849
1850    /// Sets or clears the value of [runtime_config][crate::model::Batch::runtime_config].
1851    ///
1852    /// # Example
1853    /// ```ignore,no_run
1854    /// # use google_cloud_dataproc_v1::model::Batch;
1855    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
1856    /// let x = Batch::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
1857    /// let x = Batch::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
1858    /// ```
1859    pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
1860    where
1861        T: std::convert::Into<crate::model::RuntimeConfig>,
1862    {
1863        self.runtime_config = v.map(|x| x.into());
1864        self
1865    }
1866
1867    /// Sets the value of [environment_config][crate::model::Batch::environment_config].
1868    ///
1869    /// # Example
1870    /// ```ignore,no_run
1871    /// # use google_cloud_dataproc_v1::model::Batch;
1872    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1873    /// let x = Batch::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
1874    /// ```
1875    pub fn set_environment_config<T>(mut self, v: T) -> Self
1876    where
1877        T: std::convert::Into<crate::model::EnvironmentConfig>,
1878    {
1879        self.environment_config = std::option::Option::Some(v.into());
1880        self
1881    }
1882
1883    /// Sets or clears the value of [environment_config][crate::model::Batch::environment_config].
1884    ///
1885    /// # Example
1886    /// ```ignore,no_run
1887    /// # use google_cloud_dataproc_v1::model::Batch;
1888    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
1889    /// let x = Batch::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
1890    /// let x = Batch::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
1891    /// ```
1892    pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
1893    where
1894        T: std::convert::Into<crate::model::EnvironmentConfig>,
1895    {
1896        self.environment_config = v.map(|x| x.into());
1897        self
1898    }
1899
1900    /// Sets the value of [operation][crate::model::Batch::operation].
1901    ///
1902    /// # Example
1903    /// ```ignore,no_run
1904    /// # use google_cloud_dataproc_v1::model::Batch;
1905    /// let x = Batch::new().set_operation("example");
1906    /// ```
1907    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1908        self.operation = v.into();
1909        self
1910    }
1911
1912    /// Sets the value of [state_history][crate::model::Batch::state_history].
1913    ///
1914    /// # Example
1915    /// ```ignore,no_run
1916    /// # use google_cloud_dataproc_v1::model::Batch;
1917    /// use google_cloud_dataproc_v1::model::batch::StateHistory;
1918    /// let x = Batch::new()
1919    ///     .set_state_history([
1920    ///         StateHistory::default()/* use setters */,
1921    ///         StateHistory::default()/* use (different) setters */,
1922    ///     ]);
1923    /// ```
1924    pub fn set_state_history<T, V>(mut self, v: T) -> Self
1925    where
1926        T: std::iter::IntoIterator<Item = V>,
1927        V: std::convert::Into<crate::model::batch::StateHistory>,
1928    {
1929        use std::iter::Iterator;
1930        self.state_history = v.into_iter().map(|i| i.into()).collect();
1931        self
1932    }
1933
1934    /// Sets the value of [batch_config][crate::model::Batch::batch_config].
1935    ///
1936    /// Note that all the setters affecting `batch_config` are mutually
1937    /// exclusive.
1938    ///
1939    /// # Example
1940    /// ```ignore,no_run
1941    /// # use google_cloud_dataproc_v1::model::Batch;
1942    /// use google_cloud_dataproc_v1::model::PySparkBatch;
1943    /// let x = Batch::new().set_batch_config(Some(
1944    ///     google_cloud_dataproc_v1::model::batch::BatchConfig::PysparkBatch(PySparkBatch::default().into())));
1945    /// ```
1946    pub fn set_batch_config<
1947        T: std::convert::Into<std::option::Option<crate::model::batch::BatchConfig>>,
1948    >(
1949        mut self,
1950        v: T,
1951    ) -> Self {
1952        self.batch_config = v.into();
1953        self
1954    }
1955
1956    /// The value of [batch_config][crate::model::Batch::batch_config]
1957    /// if it holds a `PysparkBatch`, `None` if the field is not set or
1958    /// holds a different branch.
1959    pub fn pyspark_batch(
1960        &self,
1961    ) -> std::option::Option<&std::boxed::Box<crate::model::PySparkBatch>> {
1962        #[allow(unreachable_patterns)]
1963        self.batch_config.as_ref().and_then(|v| match v {
1964            crate::model::batch::BatchConfig::PysparkBatch(v) => std::option::Option::Some(v),
1965            _ => std::option::Option::None,
1966        })
1967    }
1968
1969    /// Sets the value of [batch_config][crate::model::Batch::batch_config]
1970    /// to hold a `PysparkBatch`.
1971    ///
1972    /// Note that all the setters affecting `batch_config` are
1973    /// mutually exclusive.
1974    ///
1975    /// # Example
1976    /// ```ignore,no_run
1977    /// # use google_cloud_dataproc_v1::model::Batch;
1978    /// use google_cloud_dataproc_v1::model::PySparkBatch;
1979    /// let x = Batch::new().set_pyspark_batch(PySparkBatch::default()/* use setters */);
1980    /// assert!(x.pyspark_batch().is_some());
1981    /// assert!(x.spark_batch().is_none());
1982    /// assert!(x.spark_r_batch().is_none());
1983    /// assert!(x.spark_sql_batch().is_none());
1984    /// ```
1985    pub fn set_pyspark_batch<T: std::convert::Into<std::boxed::Box<crate::model::PySparkBatch>>>(
1986        mut self,
1987        v: T,
1988    ) -> Self {
1989        self.batch_config =
1990            std::option::Option::Some(crate::model::batch::BatchConfig::PysparkBatch(v.into()));
1991        self
1992    }
1993
1994    /// The value of [batch_config][crate::model::Batch::batch_config]
1995    /// if it holds a `SparkBatch`, `None` if the field is not set or
1996    /// holds a different branch.
1997    pub fn spark_batch(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkBatch>> {
1998        #[allow(unreachable_patterns)]
1999        self.batch_config.as_ref().and_then(|v| match v {
2000            crate::model::batch::BatchConfig::SparkBatch(v) => std::option::Option::Some(v),
2001            _ => std::option::Option::None,
2002        })
2003    }
2004
2005    /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2006    /// to hold a `SparkBatch`.
2007    ///
2008    /// Note that all the setters affecting `batch_config` are
2009    /// mutually exclusive.
2010    ///
2011    /// # Example
2012    /// ```ignore,no_run
2013    /// # use google_cloud_dataproc_v1::model::Batch;
2014    /// use google_cloud_dataproc_v1::model::SparkBatch;
2015    /// let x = Batch::new().set_spark_batch(SparkBatch::default()/* use setters */);
2016    /// assert!(x.spark_batch().is_some());
2017    /// assert!(x.pyspark_batch().is_none());
2018    /// assert!(x.spark_r_batch().is_none());
2019    /// assert!(x.spark_sql_batch().is_none());
2020    /// ```
2021    pub fn set_spark_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkBatch>>>(
2022        mut self,
2023        v: T,
2024    ) -> Self {
2025        self.batch_config =
2026            std::option::Option::Some(crate::model::batch::BatchConfig::SparkBatch(v.into()));
2027        self
2028    }
2029
2030    /// The value of [batch_config][crate::model::Batch::batch_config]
2031    /// if it holds a `SparkRBatch`, `None` if the field is not set or
2032    /// holds a different branch.
2033    pub fn spark_r_batch(
2034        &self,
2035    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkRBatch>> {
2036        #[allow(unreachable_patterns)]
2037        self.batch_config.as_ref().and_then(|v| match v {
2038            crate::model::batch::BatchConfig::SparkRBatch(v) => std::option::Option::Some(v),
2039            _ => std::option::Option::None,
2040        })
2041    }
2042
2043    /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2044    /// to hold a `SparkRBatch`.
2045    ///
2046    /// Note that all the setters affecting `batch_config` are
2047    /// mutually exclusive.
2048    ///
2049    /// # Example
2050    /// ```ignore,no_run
2051    /// # use google_cloud_dataproc_v1::model::Batch;
2052    /// use google_cloud_dataproc_v1::model::SparkRBatch;
2053    /// let x = Batch::new().set_spark_r_batch(SparkRBatch::default()/* use setters */);
2054    /// assert!(x.spark_r_batch().is_some());
2055    /// assert!(x.pyspark_batch().is_none());
2056    /// assert!(x.spark_batch().is_none());
2057    /// assert!(x.spark_sql_batch().is_none());
2058    /// ```
2059    pub fn set_spark_r_batch<T: std::convert::Into<std::boxed::Box<crate::model::SparkRBatch>>>(
2060        mut self,
2061        v: T,
2062    ) -> Self {
2063        self.batch_config =
2064            std::option::Option::Some(crate::model::batch::BatchConfig::SparkRBatch(v.into()));
2065        self
2066    }
2067
2068    /// The value of [batch_config][crate::model::Batch::batch_config]
2069    /// if it holds a `SparkSqlBatch`, `None` if the field is not set or
2070    /// holds a different branch.
2071    pub fn spark_sql_batch(
2072        &self,
2073    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlBatch>> {
2074        #[allow(unreachable_patterns)]
2075        self.batch_config.as_ref().and_then(|v| match v {
2076            crate::model::batch::BatchConfig::SparkSqlBatch(v) => std::option::Option::Some(v),
2077            _ => std::option::Option::None,
2078        })
2079    }
2080
2081    /// Sets the value of [batch_config][crate::model::Batch::batch_config]
2082    /// to hold a `SparkSqlBatch`.
2083    ///
2084    /// Note that all the setters affecting `batch_config` are
2085    /// mutually exclusive.
2086    ///
2087    /// # Example
2088    /// ```ignore,no_run
2089    /// # use google_cloud_dataproc_v1::model::Batch;
2090    /// use google_cloud_dataproc_v1::model::SparkSqlBatch;
2091    /// let x = Batch::new().set_spark_sql_batch(SparkSqlBatch::default()/* use setters */);
2092    /// assert!(x.spark_sql_batch().is_some());
2093    /// assert!(x.pyspark_batch().is_none());
2094    /// assert!(x.spark_batch().is_none());
2095    /// assert!(x.spark_r_batch().is_none());
2096    /// ```
2097    pub fn set_spark_sql_batch<
2098        T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlBatch>>,
2099    >(
2100        mut self,
2101        v: T,
2102    ) -> Self {
2103        self.batch_config =
2104            std::option::Option::Some(crate::model::batch::BatchConfig::SparkSqlBatch(v.into()));
2105        self
2106    }
2107}
2108
2109impl wkt::message::Message for Batch {
2110    fn typename() -> &'static str {
2111        "type.googleapis.com/google.cloud.dataproc.v1.Batch"
2112    }
2113}
2114
2115/// Defines additional types related to [Batch].
2116pub mod batch {
2117    #[allow(unused_imports)]
2118    use super::*;
2119
2120    /// Historical state information.
2121    #[derive(Clone, Default, PartialEq)]
2122    #[non_exhaustive]
2123    pub struct StateHistory {
2124        /// Output only. The state of the batch at this point in history.
2125        pub state: crate::model::batch::State,
2126
2127        /// Output only. Details about the state at this point in history.
2128        pub state_message: std::string::String,
2129
2130        /// Output only. The time when the batch entered the historical state.
2131        pub state_start_time: std::option::Option<wkt::Timestamp>,
2132
2133        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2134    }
2135
2136    impl StateHistory {
2137        pub fn new() -> Self {
2138            std::default::Default::default()
2139        }
2140
2141        /// Sets the value of [state][crate::model::batch::StateHistory::state].
2142        ///
2143        /// # Example
2144        /// ```ignore,no_run
2145        /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2146        /// use google_cloud_dataproc_v1::model::batch::State;
2147        /// let x0 = StateHistory::new().set_state(State::Pending);
2148        /// let x1 = StateHistory::new().set_state(State::Running);
2149        /// let x2 = StateHistory::new().set_state(State::Cancelling);
2150        /// ```
2151        pub fn set_state<T: std::convert::Into<crate::model::batch::State>>(
2152            mut self,
2153            v: T,
2154        ) -> Self {
2155            self.state = v.into();
2156            self
2157        }
2158
2159        /// Sets the value of [state_message][crate::model::batch::StateHistory::state_message].
2160        ///
2161        /// # Example
2162        /// ```ignore,no_run
2163        /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2164        /// let x = StateHistory::new().set_state_message("example");
2165        /// ```
2166        pub fn set_state_message<T: std::convert::Into<std::string::String>>(
2167            mut self,
2168            v: T,
2169        ) -> Self {
2170            self.state_message = v.into();
2171            self
2172        }
2173
2174        /// Sets the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2175        ///
2176        /// # Example
2177        /// ```ignore,no_run
2178        /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2179        /// use wkt::Timestamp;
2180        /// let x = StateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
2181        /// ```
2182        pub fn set_state_start_time<T>(mut self, v: T) -> Self
2183        where
2184            T: std::convert::Into<wkt::Timestamp>,
2185        {
2186            self.state_start_time = std::option::Option::Some(v.into());
2187            self
2188        }
2189
2190        /// Sets or clears the value of [state_start_time][crate::model::batch::StateHistory::state_start_time].
2191        ///
2192        /// # Example
2193        /// ```ignore,no_run
2194        /// # use google_cloud_dataproc_v1::model::batch::StateHistory;
2195        /// use wkt::Timestamp;
2196        /// let x = StateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
2197        /// let x = StateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
2198        /// ```
2199        pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2200        where
2201            T: std::convert::Into<wkt::Timestamp>,
2202        {
2203            self.state_start_time = v.map(|x| x.into());
2204            self
2205        }
2206    }
2207
2208    impl wkt::message::Message for StateHistory {
2209        fn typename() -> &'static str {
2210            "type.googleapis.com/google.cloud.dataproc.v1.Batch.StateHistory"
2211        }
2212    }
2213
2214    /// The batch state.
2215    ///
2216    /// # Working with unknown values
2217    ///
2218    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2219    /// additional enum variants at any time. Adding new variants is not considered
2220    /// a breaking change. Applications should write their code in anticipation of:
2221    ///
2222    /// - New values appearing in future releases of the client library, **and**
2223    /// - New values received dynamically, without application changes.
2224    ///
2225    /// Please consult the [Working with enums] section in the user guide for some
2226    /// guidelines.
2227    ///
2228    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2229    #[derive(Clone, Debug, PartialEq)]
2230    #[non_exhaustive]
2231    pub enum State {
2232        /// The batch state is unknown.
2233        Unspecified,
2234        /// The batch is created before running.
2235        Pending,
2236        /// The batch is running.
2237        Running,
2238        /// The batch is cancelling.
2239        Cancelling,
2240        /// The batch cancellation was successful.
2241        Cancelled,
2242        /// The batch completed successfully.
2243        Succeeded,
2244        /// The batch is no longer running due to an error.
2245        Failed,
2246        /// If set, the enum was initialized with an unknown value.
2247        ///
2248        /// Applications can examine the value using [State::value] or
2249        /// [State::name].
2250        UnknownValue(state::UnknownValue),
2251    }
2252
2253    #[doc(hidden)]
2254    pub mod state {
2255        #[allow(unused_imports)]
2256        use super::*;
2257        #[derive(Clone, Debug, PartialEq)]
2258        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2259    }
2260
2261    impl State {
2262        /// Gets the enum value.
2263        ///
2264        /// Returns `None` if the enum contains an unknown value deserialized from
2265        /// the string representation of enums.
2266        pub fn value(&self) -> std::option::Option<i32> {
2267            match self {
2268                Self::Unspecified => std::option::Option::Some(0),
2269                Self::Pending => std::option::Option::Some(1),
2270                Self::Running => std::option::Option::Some(2),
2271                Self::Cancelling => std::option::Option::Some(3),
2272                Self::Cancelled => std::option::Option::Some(4),
2273                Self::Succeeded => std::option::Option::Some(5),
2274                Self::Failed => std::option::Option::Some(6),
2275                Self::UnknownValue(u) => u.0.value(),
2276            }
2277        }
2278
2279        /// Gets the enum value as a string.
2280        ///
2281        /// Returns `None` if the enum contains an unknown value deserialized from
2282        /// the integer representation of enums.
2283        pub fn name(&self) -> std::option::Option<&str> {
2284            match self {
2285                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2286                Self::Pending => std::option::Option::Some("PENDING"),
2287                Self::Running => std::option::Option::Some("RUNNING"),
2288                Self::Cancelling => std::option::Option::Some("CANCELLING"),
2289                Self::Cancelled => std::option::Option::Some("CANCELLED"),
2290                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2291                Self::Failed => std::option::Option::Some("FAILED"),
2292                Self::UnknownValue(u) => u.0.name(),
2293            }
2294        }
2295    }
2296
2297    impl std::default::Default for State {
2298        fn default() -> Self {
2299            use std::convert::From;
2300            Self::from(0)
2301        }
2302    }
2303
2304    impl std::fmt::Display for State {
2305        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2306            wkt::internal::display_enum(f, self.name(), self.value())
2307        }
2308    }
2309
2310    impl std::convert::From<i32> for State {
2311        fn from(value: i32) -> Self {
2312            match value {
2313                0 => Self::Unspecified,
2314                1 => Self::Pending,
2315                2 => Self::Running,
2316                3 => Self::Cancelling,
2317                4 => Self::Cancelled,
2318                5 => Self::Succeeded,
2319                6 => Self::Failed,
2320                _ => Self::UnknownValue(state::UnknownValue(
2321                    wkt::internal::UnknownEnumValue::Integer(value),
2322                )),
2323            }
2324        }
2325    }
2326
2327    impl std::convert::From<&str> for State {
2328        fn from(value: &str) -> Self {
2329            use std::string::ToString;
2330            match value {
2331                "STATE_UNSPECIFIED" => Self::Unspecified,
2332                "PENDING" => Self::Pending,
2333                "RUNNING" => Self::Running,
2334                "CANCELLING" => Self::Cancelling,
2335                "CANCELLED" => Self::Cancelled,
2336                "SUCCEEDED" => Self::Succeeded,
2337                "FAILED" => Self::Failed,
2338                _ => Self::UnknownValue(state::UnknownValue(
2339                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2340                )),
2341            }
2342        }
2343    }
2344
2345    impl serde::ser::Serialize for State {
2346        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2347        where
2348            S: serde::Serializer,
2349        {
2350            match self {
2351                Self::Unspecified => serializer.serialize_i32(0),
2352                Self::Pending => serializer.serialize_i32(1),
2353                Self::Running => serializer.serialize_i32(2),
2354                Self::Cancelling => serializer.serialize_i32(3),
2355                Self::Cancelled => serializer.serialize_i32(4),
2356                Self::Succeeded => serializer.serialize_i32(5),
2357                Self::Failed => serializer.serialize_i32(6),
2358                Self::UnknownValue(u) => u.0.serialize(serializer),
2359            }
2360        }
2361    }
2362
2363    impl<'de> serde::de::Deserialize<'de> for State {
2364        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2365        where
2366            D: serde::Deserializer<'de>,
2367        {
2368            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2369                ".google.cloud.dataproc.v1.Batch.State",
2370            ))
2371        }
2372    }
2373
2374    /// The application/framework-specific portion of the batch configuration.
2375    #[derive(Clone, Debug, PartialEq)]
2376    #[non_exhaustive]
2377    pub enum BatchConfig {
2378        /// Optional. PySpark batch config.
2379        PysparkBatch(std::boxed::Box<crate::model::PySparkBatch>),
2380        /// Optional. Spark batch config.
2381        SparkBatch(std::boxed::Box<crate::model::SparkBatch>),
2382        /// Optional. SparkR batch config.
2383        SparkRBatch(std::boxed::Box<crate::model::SparkRBatch>),
2384        /// Optional. SparkSql batch config.
2385        SparkSqlBatch(std::boxed::Box<crate::model::SparkSqlBatch>),
2386    }
2387}
2388
2389/// A configuration for running an
2390/// [Apache
2391/// PySpark](https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html)
2392/// batch workload.
2393#[derive(Clone, Default, PartialEq)]
2394#[non_exhaustive]
2395pub struct PySparkBatch {
2396    /// Required. The HCFS URI of the main Python file to use as the Spark driver.
2397    /// Must be a .py file.
2398    pub main_python_file_uri: std::string::String,
2399
2400    /// Optional. The arguments to pass to the driver. Do not include arguments
2401    /// that can be set as batch properties, such as `--conf`, since a collision
2402    /// can occur that causes an incorrect batch submission.
2403    pub args: std::vec::Vec<std::string::String>,
2404
2405    /// Optional. HCFS file URIs of Python files to pass to the PySpark
2406    /// framework. Supported file types: `.py`, `.egg`, and `.zip`.
2407    pub python_file_uris: std::vec::Vec<std::string::String>,
2408
2409    /// Optional. HCFS URIs of jar files to add to the classpath of the
2410    /// Spark driver and tasks.
2411    pub jar_file_uris: std::vec::Vec<std::string::String>,
2412
2413    /// Optional. HCFS URIs of files to be placed in the working directory of
2414    /// each executor.
2415    pub file_uris: std::vec::Vec<std::string::String>,
2416
2417    /// Optional. HCFS URIs of archives to be extracted into the working directory
2418    /// of each executor. Supported file types:
2419    /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2420    pub archive_uris: std::vec::Vec<std::string::String>,
2421
2422    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2423}
2424
2425impl PySparkBatch {
2426    pub fn new() -> Self {
2427        std::default::Default::default()
2428    }
2429
2430    /// Sets the value of [main_python_file_uri][crate::model::PySparkBatch::main_python_file_uri].
2431    ///
2432    /// # Example
2433    /// ```ignore,no_run
2434    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2435    /// let x = PySparkBatch::new().set_main_python_file_uri("example");
2436    /// ```
2437    pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
2438        mut self,
2439        v: T,
2440    ) -> Self {
2441        self.main_python_file_uri = v.into();
2442        self
2443    }
2444
2445    /// Sets the value of [args][crate::model::PySparkBatch::args].
2446    ///
2447    /// # Example
2448    /// ```ignore,no_run
2449    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2450    /// let x = PySparkBatch::new().set_args(["a", "b", "c"]);
2451    /// ```
2452    pub fn set_args<T, V>(mut self, v: T) -> Self
2453    where
2454        T: std::iter::IntoIterator<Item = V>,
2455        V: std::convert::Into<std::string::String>,
2456    {
2457        use std::iter::Iterator;
2458        self.args = v.into_iter().map(|i| i.into()).collect();
2459        self
2460    }
2461
2462    /// Sets the value of [python_file_uris][crate::model::PySparkBatch::python_file_uris].
2463    ///
2464    /// # Example
2465    /// ```ignore,no_run
2466    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2467    /// let x = PySparkBatch::new().set_python_file_uris(["a", "b", "c"]);
2468    /// ```
2469    pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
2470    where
2471        T: std::iter::IntoIterator<Item = V>,
2472        V: std::convert::Into<std::string::String>,
2473    {
2474        use std::iter::Iterator;
2475        self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
2476        self
2477    }
2478
2479    /// Sets the value of [jar_file_uris][crate::model::PySparkBatch::jar_file_uris].
2480    ///
2481    /// # Example
2482    /// ```ignore,no_run
2483    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2484    /// let x = PySparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2485    /// ```
2486    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2487    where
2488        T: std::iter::IntoIterator<Item = V>,
2489        V: std::convert::Into<std::string::String>,
2490    {
2491        use std::iter::Iterator;
2492        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2493        self
2494    }
2495
2496    /// Sets the value of [file_uris][crate::model::PySparkBatch::file_uris].
2497    ///
2498    /// # Example
2499    /// ```ignore,no_run
2500    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2501    /// let x = PySparkBatch::new().set_file_uris(["a", "b", "c"]);
2502    /// ```
2503    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2504    where
2505        T: std::iter::IntoIterator<Item = V>,
2506        V: std::convert::Into<std::string::String>,
2507    {
2508        use std::iter::Iterator;
2509        self.file_uris = v.into_iter().map(|i| i.into()).collect();
2510        self
2511    }
2512
2513    /// Sets the value of [archive_uris][crate::model::PySparkBatch::archive_uris].
2514    ///
2515    /// # Example
2516    /// ```ignore,no_run
2517    /// # use google_cloud_dataproc_v1::model::PySparkBatch;
2518    /// let x = PySparkBatch::new().set_archive_uris(["a", "b", "c"]);
2519    /// ```
2520    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2521    where
2522        T: std::iter::IntoIterator<Item = V>,
2523        V: std::convert::Into<std::string::String>,
2524    {
2525        use std::iter::Iterator;
2526        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2527        self
2528    }
2529}
2530
2531impl wkt::message::Message for PySparkBatch {
2532    fn typename() -> &'static str {
2533        "type.googleapis.com/google.cloud.dataproc.v1.PySparkBatch"
2534    }
2535}
2536
2537/// A configuration for running an [Apache Spark](https://spark.apache.org/)
2538/// batch workload.
2539#[derive(Clone, Default, PartialEq)]
2540#[non_exhaustive]
2541pub struct SparkBatch {
2542    /// Optional. The arguments to pass to the driver. Do not include arguments
2543    /// that can be set as batch properties, such as `--conf`, since a collision
2544    /// can occur that causes an incorrect batch submission.
2545    pub args: std::vec::Vec<std::string::String>,
2546
2547    /// Optional. HCFS URIs of jar files to add to the classpath of the
2548    /// Spark driver and tasks.
2549    pub jar_file_uris: std::vec::Vec<std::string::String>,
2550
2551    /// Optional. HCFS URIs of files to be placed in the working directory of
2552    /// each executor.
2553    pub file_uris: std::vec::Vec<std::string::String>,
2554
2555    /// Optional. HCFS URIs of archives to be extracted into the working directory
2556    /// of each executor. Supported file types:
2557    /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2558    pub archive_uris: std::vec::Vec<std::string::String>,
2559
2560    /// The specification of the main method to call to drive the Spark
2561    /// workload. Specify either the jar file that contains the main class or the
2562    /// main class name. To pass both a main jar and a main class in that jar, add
2563    /// the jar to `jar_file_uris`, and then specify the main class
2564    /// name in `main_class`.
2565    pub driver: std::option::Option<crate::model::spark_batch::Driver>,
2566
2567    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2568}
2569
2570impl SparkBatch {
2571    pub fn new() -> Self {
2572        std::default::Default::default()
2573    }
2574
2575    /// Sets the value of [args][crate::model::SparkBatch::args].
2576    ///
2577    /// # Example
2578    /// ```ignore,no_run
2579    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2580    /// let x = SparkBatch::new().set_args(["a", "b", "c"]);
2581    /// ```
2582    pub fn set_args<T, V>(mut self, v: T) -> Self
2583    where
2584        T: std::iter::IntoIterator<Item = V>,
2585        V: std::convert::Into<std::string::String>,
2586    {
2587        use std::iter::Iterator;
2588        self.args = v.into_iter().map(|i| i.into()).collect();
2589        self
2590    }
2591
2592    /// Sets the value of [jar_file_uris][crate::model::SparkBatch::jar_file_uris].
2593    ///
2594    /// # Example
2595    /// ```ignore,no_run
2596    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2597    /// let x = SparkBatch::new().set_jar_file_uris(["a", "b", "c"]);
2598    /// ```
2599    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2600    where
2601        T: std::iter::IntoIterator<Item = V>,
2602        V: std::convert::Into<std::string::String>,
2603    {
2604        use std::iter::Iterator;
2605        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2606        self
2607    }
2608
2609    /// Sets the value of [file_uris][crate::model::SparkBatch::file_uris].
2610    ///
2611    /// # Example
2612    /// ```ignore,no_run
2613    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2614    /// let x = SparkBatch::new().set_file_uris(["a", "b", "c"]);
2615    /// ```
2616    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2617    where
2618        T: std::iter::IntoIterator<Item = V>,
2619        V: std::convert::Into<std::string::String>,
2620    {
2621        use std::iter::Iterator;
2622        self.file_uris = v.into_iter().map(|i| i.into()).collect();
2623        self
2624    }
2625
2626    /// Sets the value of [archive_uris][crate::model::SparkBatch::archive_uris].
2627    ///
2628    /// # Example
2629    /// ```ignore,no_run
2630    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2631    /// let x = SparkBatch::new().set_archive_uris(["a", "b", "c"]);
2632    /// ```
2633    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2634    where
2635        T: std::iter::IntoIterator<Item = V>,
2636        V: std::convert::Into<std::string::String>,
2637    {
2638        use std::iter::Iterator;
2639        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2640        self
2641    }
2642
2643    /// Sets the value of [driver][crate::model::SparkBatch::driver].
2644    ///
2645    /// Note that all the setters affecting `driver` are mutually
2646    /// exclusive.
2647    ///
2648    /// # Example
2649    /// ```ignore,no_run
2650    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2651    /// use google_cloud_dataproc_v1::model::spark_batch::Driver;
2652    /// let x = SparkBatch::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
2653    /// ```
2654    pub fn set_driver<
2655        T: std::convert::Into<std::option::Option<crate::model::spark_batch::Driver>>,
2656    >(
2657        mut self,
2658        v: T,
2659    ) -> Self {
2660        self.driver = v.into();
2661        self
2662    }
2663
2664    /// The value of [driver][crate::model::SparkBatch::driver]
2665    /// if it holds a `MainJarFileUri`, `None` if the field is not set or
2666    /// holds a different branch.
2667    pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
2668        #[allow(unreachable_patterns)]
2669        self.driver.as_ref().and_then(|v| match v {
2670            crate::model::spark_batch::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
2671            _ => std::option::Option::None,
2672        })
2673    }
2674
2675    /// Sets the value of [driver][crate::model::SparkBatch::driver]
2676    /// to hold a `MainJarFileUri`.
2677    ///
2678    /// Note that all the setters affecting `driver` are
2679    /// mutually exclusive.
2680    ///
2681    /// # Example
2682    /// ```ignore,no_run
2683    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2684    /// let x = SparkBatch::new().set_main_jar_file_uri("example");
2685    /// assert!(x.main_jar_file_uri().is_some());
2686    /// assert!(x.main_class().is_none());
2687    /// ```
2688    pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
2689        mut self,
2690        v: T,
2691    ) -> Self {
2692        self.driver =
2693            std::option::Option::Some(crate::model::spark_batch::Driver::MainJarFileUri(v.into()));
2694        self
2695    }
2696
2697    /// The value of [driver][crate::model::SparkBatch::driver]
2698    /// if it holds a `MainClass`, `None` if the field is not set or
2699    /// holds a different branch.
2700    pub fn main_class(&self) -> std::option::Option<&std::string::String> {
2701        #[allow(unreachable_patterns)]
2702        self.driver.as_ref().and_then(|v| match v {
2703            crate::model::spark_batch::Driver::MainClass(v) => std::option::Option::Some(v),
2704            _ => std::option::Option::None,
2705        })
2706    }
2707
2708    /// Sets the value of [driver][crate::model::SparkBatch::driver]
2709    /// to hold a `MainClass`.
2710    ///
2711    /// Note that all the setters affecting `driver` are
2712    /// mutually exclusive.
2713    ///
2714    /// # Example
2715    /// ```ignore,no_run
2716    /// # use google_cloud_dataproc_v1::model::SparkBatch;
2717    /// let x = SparkBatch::new().set_main_class("example");
2718    /// assert!(x.main_class().is_some());
2719    /// assert!(x.main_jar_file_uri().is_none());
2720    /// ```
2721    pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2722        self.driver =
2723            std::option::Option::Some(crate::model::spark_batch::Driver::MainClass(v.into()));
2724        self
2725    }
2726}
2727
2728impl wkt::message::Message for SparkBatch {
2729    fn typename() -> &'static str {
2730        "type.googleapis.com/google.cloud.dataproc.v1.SparkBatch"
2731    }
2732}
2733
2734/// Defines additional types related to [SparkBatch].
2735pub mod spark_batch {
2736    #[allow(unused_imports)]
2737    use super::*;
2738
2739    /// The specification of the main method to call to drive the Spark
2740    /// workload. Specify either the jar file that contains the main class or the
2741    /// main class name. To pass both a main jar and a main class in that jar, add
2742    /// the jar to `jar_file_uris`, and then specify the main class
2743    /// name in `main_class`.
2744    #[derive(Clone, Debug, PartialEq)]
2745    #[non_exhaustive]
2746    pub enum Driver {
2747        /// Optional. The HCFS URI of the jar file that contains the main class.
2748        MainJarFileUri(std::string::String),
2749        /// Optional. The name of the driver main class. The jar file that contains
2750        /// the class must be in the classpath or specified in `jar_file_uris`.
2751        MainClass(std::string::String),
2752    }
2753}
2754
2755/// A configuration for running an
2756/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
2757/// batch workload.
2758#[derive(Clone, Default, PartialEq)]
2759#[non_exhaustive]
2760pub struct SparkRBatch {
2761    /// Required. The HCFS URI of the main R file to use as the driver.
2762    /// Must be a `.R` or `.r` file.
2763    pub main_r_file_uri: std::string::String,
2764
2765    /// Optional. The arguments to pass to the Spark driver. Do not include
2766    /// arguments that can be set as batch properties, such as `--conf`, since a
2767    /// collision can occur that causes an incorrect batch submission.
2768    pub args: std::vec::Vec<std::string::String>,
2769
2770    /// Optional. HCFS URIs of files to be placed in the working directory of
2771    /// each executor.
2772    pub file_uris: std::vec::Vec<std::string::String>,
2773
2774    /// Optional. HCFS URIs of archives to be extracted into the working directory
2775    /// of each executor. Supported file types:
2776    /// `.jar`, `.tar`, `.tar.gz`, `.tgz`, and `.zip`.
2777    pub archive_uris: std::vec::Vec<std::string::String>,
2778
2779    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2780}
2781
2782impl SparkRBatch {
2783    pub fn new() -> Self {
2784        std::default::Default::default()
2785    }
2786
2787    /// Sets the value of [main_r_file_uri][crate::model::SparkRBatch::main_r_file_uri].
2788    ///
2789    /// # Example
2790    /// ```ignore,no_run
2791    /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2792    /// let x = SparkRBatch::new().set_main_r_file_uri("example");
2793    /// ```
2794    pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2795        self.main_r_file_uri = v.into();
2796        self
2797    }
2798
2799    /// Sets the value of [args][crate::model::SparkRBatch::args].
2800    ///
2801    /// # Example
2802    /// ```ignore,no_run
2803    /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2804    /// let x = SparkRBatch::new().set_args(["a", "b", "c"]);
2805    /// ```
2806    pub fn set_args<T, V>(mut self, v: T) -> Self
2807    where
2808        T: std::iter::IntoIterator<Item = V>,
2809        V: std::convert::Into<std::string::String>,
2810    {
2811        use std::iter::Iterator;
2812        self.args = v.into_iter().map(|i| i.into()).collect();
2813        self
2814    }
2815
2816    /// Sets the value of [file_uris][crate::model::SparkRBatch::file_uris].
2817    ///
2818    /// # Example
2819    /// ```ignore,no_run
2820    /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2821    /// let x = SparkRBatch::new().set_file_uris(["a", "b", "c"]);
2822    /// ```
2823    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
2824    where
2825        T: std::iter::IntoIterator<Item = V>,
2826        V: std::convert::Into<std::string::String>,
2827    {
2828        use std::iter::Iterator;
2829        self.file_uris = v.into_iter().map(|i| i.into()).collect();
2830        self
2831    }
2832
2833    /// Sets the value of [archive_uris][crate::model::SparkRBatch::archive_uris].
2834    ///
2835    /// # Example
2836    /// ```ignore,no_run
2837    /// # use google_cloud_dataproc_v1::model::SparkRBatch;
2838    /// let x = SparkRBatch::new().set_archive_uris(["a", "b", "c"]);
2839    /// ```
2840    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
2841    where
2842        T: std::iter::IntoIterator<Item = V>,
2843        V: std::convert::Into<std::string::String>,
2844    {
2845        use std::iter::Iterator;
2846        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
2847        self
2848    }
2849}
2850
2851impl wkt::message::Message for SparkRBatch {
2852    fn typename() -> &'static str {
2853        "type.googleapis.com/google.cloud.dataproc.v1.SparkRBatch"
2854    }
2855}
2856
2857/// A configuration for running
2858/// [Apache Spark SQL](https://spark.apache.org/sql/) queries as a batch
2859/// workload.
2860#[derive(Clone, Default, PartialEq)]
2861#[non_exhaustive]
2862pub struct SparkSqlBatch {
2863    /// Required. The HCFS URI of the script that contains Spark SQL queries to
2864    /// execute.
2865    pub query_file_uri: std::string::String,
2866
2867    /// Optional. Mapping of query variable names to values (equivalent to the
2868    /// Spark SQL command: `SET name="value";`).
2869    pub query_variables: std::collections::HashMap<std::string::String, std::string::String>,
2870
2871    /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2872    pub jar_file_uris: std::vec::Vec<std::string::String>,
2873
2874    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2875}
2876
2877impl SparkSqlBatch {
2878    pub fn new() -> Self {
2879        std::default::Default::default()
2880    }
2881
2882    /// Sets the value of [query_file_uri][crate::model::SparkSqlBatch::query_file_uri].
2883    ///
2884    /// # Example
2885    /// ```ignore,no_run
2886    /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2887    /// let x = SparkSqlBatch::new().set_query_file_uri("example");
2888    /// ```
2889    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2890        self.query_file_uri = v.into();
2891        self
2892    }
2893
2894    /// Sets the value of [query_variables][crate::model::SparkSqlBatch::query_variables].
2895    ///
2896    /// # Example
2897    /// ```ignore,no_run
2898    /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2899    /// let x = SparkSqlBatch::new().set_query_variables([
2900    ///     ("key0", "abc"),
2901    ///     ("key1", "xyz"),
2902    /// ]);
2903    /// ```
2904    pub fn set_query_variables<T, K, V>(mut self, v: T) -> Self
2905    where
2906        T: std::iter::IntoIterator<Item = (K, V)>,
2907        K: std::convert::Into<std::string::String>,
2908        V: std::convert::Into<std::string::String>,
2909    {
2910        use std::iter::Iterator;
2911        self.query_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2912        self
2913    }
2914
2915    /// Sets the value of [jar_file_uris][crate::model::SparkSqlBatch::jar_file_uris].
2916    ///
2917    /// # Example
2918    /// ```ignore,no_run
2919    /// # use google_cloud_dataproc_v1::model::SparkSqlBatch;
2920    /// let x = SparkSqlBatch::new().set_jar_file_uris(["a", "b", "c"]);
2921    /// ```
2922    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
2923    where
2924        T: std::iter::IntoIterator<Item = V>,
2925        V: std::convert::Into<std::string::String>,
2926    {
2927        use std::iter::Iterator;
2928        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
2929        self
2930    }
2931}
2932
2933impl wkt::message::Message for SparkSqlBatch {
2934    fn typename() -> &'static str {
2935        "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlBatch"
2936    }
2937}
2938
2939/// Describes the identifying information, config, and status of
2940/// a Dataproc cluster
2941#[derive(Clone, Default, PartialEq)]
2942#[non_exhaustive]
2943pub struct Cluster {
2944    /// Required. The Google Cloud Platform project ID that the cluster belongs to.
2945    pub project_id: std::string::String,
2946
2947    /// Required. The cluster name, which must be unique within a project.
2948    /// The name must start with a lowercase letter, and can contain
2949    /// up to 51 lowercase letters, numbers, and hyphens. It cannot end
2950    /// with a hyphen. The name of a deleted cluster can be reused.
2951    pub cluster_name: std::string::String,
2952
2953    /// Optional. The cluster config for a cluster of Compute Engine Instances.
2954    /// Note that Dataproc may set default values, and values may change
2955    /// when clusters are updated.
2956    ///
2957    /// Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
2958    pub config: std::option::Option<crate::model::ClusterConfig>,
2959
2960    /// Optional. The virtual cluster config is used when creating a Dataproc
2961    /// cluster that does not directly control the underlying compute resources,
2962    /// for example, when creating a [Dataproc-on-GKE
2963    /// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
2964    /// Dataproc may set default values, and values may change when
2965    /// clusters are updated. Exactly one of
2966    /// [config][google.cloud.dataproc.v1.Cluster.config] or
2967    /// [virtual_cluster_config][google.cloud.dataproc.v1.Cluster.virtual_cluster_config]
2968    /// must be specified.
2969    ///
2970    /// [google.cloud.dataproc.v1.Cluster.config]: crate::model::Cluster::config
2971    /// [google.cloud.dataproc.v1.Cluster.virtual_cluster_config]: crate::model::Cluster::virtual_cluster_config
2972    pub virtual_cluster_config: std::option::Option<crate::model::VirtualClusterConfig>,
2973
2974    /// Optional. The labels to associate with this cluster.
2975    /// Label **keys** must contain 1 to 63 characters, and must conform to
2976    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
2977    /// Label **values** may be empty, but, if present, must contain 1 to 63
2978    /// characters, and must conform to [RFC
2979    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
2980    /// associated with a cluster.
2981    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2982
2983    /// Output only. Cluster status.
2984    pub status: std::option::Option<crate::model::ClusterStatus>,
2985
2986    /// Output only. The previous cluster status.
2987    pub status_history: std::vec::Vec<crate::model::ClusterStatus>,
2988
2989    /// Output only. A cluster UUID (Unique Universal Identifier). Dataproc
2990    /// generates this value when it creates the cluster.
2991    pub cluster_uuid: std::string::String,
2992
2993    /// Output only. Contains cluster daemon metrics such as HDFS and YARN stats.
2994    ///
2995    /// **Beta Feature**: This report is available for testing purposes only. It
2996    /// may be changed before final release.
2997    pub metrics: std::option::Option<crate::model::ClusterMetrics>,
2998
2999    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3000}
3001
3002impl Cluster {
3003    pub fn new() -> Self {
3004        std::default::Default::default()
3005    }
3006
3007    /// Sets the value of [project_id][crate::model::Cluster::project_id].
3008    ///
3009    /// # Example
3010    /// ```ignore,no_run
3011    /// # use google_cloud_dataproc_v1::model::Cluster;
3012    /// let x = Cluster::new().set_project_id("example");
3013    /// ```
3014    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3015        self.project_id = v.into();
3016        self
3017    }
3018
3019    /// Sets the value of [cluster_name][crate::model::Cluster::cluster_name].
3020    ///
3021    /// # Example
3022    /// ```ignore,no_run
3023    /// # use google_cloud_dataproc_v1::model::Cluster;
3024    /// let x = Cluster::new().set_cluster_name("example");
3025    /// ```
3026    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3027        self.cluster_name = v.into();
3028        self
3029    }
3030
3031    /// Sets the value of [config][crate::model::Cluster::config].
3032    ///
3033    /// # Example
3034    /// ```ignore,no_run
3035    /// # use google_cloud_dataproc_v1::model::Cluster;
3036    /// use google_cloud_dataproc_v1::model::ClusterConfig;
3037    /// let x = Cluster::new().set_config(ClusterConfig::default()/* use setters */);
3038    /// ```
3039    pub fn set_config<T>(mut self, v: T) -> Self
3040    where
3041        T: std::convert::Into<crate::model::ClusterConfig>,
3042    {
3043        self.config = std::option::Option::Some(v.into());
3044        self
3045    }
3046
3047    /// Sets or clears the value of [config][crate::model::Cluster::config].
3048    ///
3049    /// # Example
3050    /// ```ignore,no_run
3051    /// # use google_cloud_dataproc_v1::model::Cluster;
3052    /// use google_cloud_dataproc_v1::model::ClusterConfig;
3053    /// let x = Cluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
3054    /// let x = Cluster::new().set_or_clear_config(None::<ClusterConfig>);
3055    /// ```
3056    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
3057    where
3058        T: std::convert::Into<crate::model::ClusterConfig>,
3059    {
3060        self.config = v.map(|x| x.into());
3061        self
3062    }
3063
3064    /// Sets the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3065    ///
3066    /// # Example
3067    /// ```ignore,no_run
3068    /// # use google_cloud_dataproc_v1::model::Cluster;
3069    /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3070    /// let x = Cluster::new().set_virtual_cluster_config(VirtualClusterConfig::default()/* use setters */);
3071    /// ```
3072    pub fn set_virtual_cluster_config<T>(mut self, v: T) -> Self
3073    where
3074        T: std::convert::Into<crate::model::VirtualClusterConfig>,
3075    {
3076        self.virtual_cluster_config = std::option::Option::Some(v.into());
3077        self
3078    }
3079
3080    /// Sets or clears the value of [virtual_cluster_config][crate::model::Cluster::virtual_cluster_config].
3081    ///
3082    /// # Example
3083    /// ```ignore,no_run
3084    /// # use google_cloud_dataproc_v1::model::Cluster;
3085    /// use google_cloud_dataproc_v1::model::VirtualClusterConfig;
3086    /// let x = Cluster::new().set_or_clear_virtual_cluster_config(Some(VirtualClusterConfig::default()/* use setters */));
3087    /// let x = Cluster::new().set_or_clear_virtual_cluster_config(None::<VirtualClusterConfig>);
3088    /// ```
3089    pub fn set_or_clear_virtual_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3090    where
3091        T: std::convert::Into<crate::model::VirtualClusterConfig>,
3092    {
3093        self.virtual_cluster_config = v.map(|x| x.into());
3094        self
3095    }
3096
3097    /// Sets the value of [labels][crate::model::Cluster::labels].
3098    ///
3099    /// # Example
3100    /// ```ignore,no_run
3101    /// # use google_cloud_dataproc_v1::model::Cluster;
3102    /// let x = Cluster::new().set_labels([
3103    ///     ("key0", "abc"),
3104    ///     ("key1", "xyz"),
3105    /// ]);
3106    /// ```
3107    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3108    where
3109        T: std::iter::IntoIterator<Item = (K, V)>,
3110        K: std::convert::Into<std::string::String>,
3111        V: std::convert::Into<std::string::String>,
3112    {
3113        use std::iter::Iterator;
3114        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3115        self
3116    }
3117
3118    /// Sets the value of [status][crate::model::Cluster::status].
3119    ///
3120    /// # Example
3121    /// ```ignore,no_run
3122    /// # use google_cloud_dataproc_v1::model::Cluster;
3123    /// use google_cloud_dataproc_v1::model::ClusterStatus;
3124    /// let x = Cluster::new().set_status(ClusterStatus::default()/* use setters */);
3125    /// ```
3126    pub fn set_status<T>(mut self, v: T) -> Self
3127    where
3128        T: std::convert::Into<crate::model::ClusterStatus>,
3129    {
3130        self.status = std::option::Option::Some(v.into());
3131        self
3132    }
3133
3134    /// Sets or clears the value of [status][crate::model::Cluster::status].
3135    ///
3136    /// # Example
3137    /// ```ignore,no_run
3138    /// # use google_cloud_dataproc_v1::model::Cluster;
3139    /// use google_cloud_dataproc_v1::model::ClusterStatus;
3140    /// let x = Cluster::new().set_or_clear_status(Some(ClusterStatus::default()/* use setters */));
3141    /// let x = Cluster::new().set_or_clear_status(None::<ClusterStatus>);
3142    /// ```
3143    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
3144    where
3145        T: std::convert::Into<crate::model::ClusterStatus>,
3146    {
3147        self.status = v.map(|x| x.into());
3148        self
3149    }
3150
3151    /// Sets the value of [status_history][crate::model::Cluster::status_history].
3152    ///
3153    /// # Example
3154    /// ```ignore,no_run
3155    /// # use google_cloud_dataproc_v1::model::Cluster;
3156    /// use google_cloud_dataproc_v1::model::ClusterStatus;
3157    /// let x = Cluster::new()
3158    ///     .set_status_history([
3159    ///         ClusterStatus::default()/* use setters */,
3160    ///         ClusterStatus::default()/* use (different) setters */,
3161    ///     ]);
3162    /// ```
3163    pub fn set_status_history<T, V>(mut self, v: T) -> Self
3164    where
3165        T: std::iter::IntoIterator<Item = V>,
3166        V: std::convert::Into<crate::model::ClusterStatus>,
3167    {
3168        use std::iter::Iterator;
3169        self.status_history = v.into_iter().map(|i| i.into()).collect();
3170        self
3171    }
3172
3173    /// Sets the value of [cluster_uuid][crate::model::Cluster::cluster_uuid].
3174    ///
3175    /// # Example
3176    /// ```ignore,no_run
3177    /// # use google_cloud_dataproc_v1::model::Cluster;
3178    /// let x = Cluster::new().set_cluster_uuid("example");
3179    /// ```
3180    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3181        self.cluster_uuid = v.into();
3182        self
3183    }
3184
3185    /// Sets the value of [metrics][crate::model::Cluster::metrics].
3186    ///
3187    /// # Example
3188    /// ```ignore,no_run
3189    /// # use google_cloud_dataproc_v1::model::Cluster;
3190    /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3191    /// let x = Cluster::new().set_metrics(ClusterMetrics::default()/* use setters */);
3192    /// ```
3193    pub fn set_metrics<T>(mut self, v: T) -> Self
3194    where
3195        T: std::convert::Into<crate::model::ClusterMetrics>,
3196    {
3197        self.metrics = std::option::Option::Some(v.into());
3198        self
3199    }
3200
3201    /// Sets or clears the value of [metrics][crate::model::Cluster::metrics].
3202    ///
3203    /// # Example
3204    /// ```ignore,no_run
3205    /// # use google_cloud_dataproc_v1::model::Cluster;
3206    /// use google_cloud_dataproc_v1::model::ClusterMetrics;
3207    /// let x = Cluster::new().set_or_clear_metrics(Some(ClusterMetrics::default()/* use setters */));
3208    /// let x = Cluster::new().set_or_clear_metrics(None::<ClusterMetrics>);
3209    /// ```
3210    pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
3211    where
3212        T: std::convert::Into<crate::model::ClusterMetrics>,
3213    {
3214        self.metrics = v.map(|x| x.into());
3215        self
3216    }
3217}
3218
3219impl wkt::message::Message for Cluster {
3220    fn typename() -> &'static str {
3221        "type.googleapis.com/google.cloud.dataproc.v1.Cluster"
3222    }
3223}
3224
3225/// The cluster config.
3226#[derive(Clone, Default, PartialEq)]
3227#[non_exhaustive]
3228pub struct ClusterConfig {
3229    /// Optional. The type of the cluster.
3230    pub cluster_type: crate::model::cluster_config::ClusterType,
3231
3232    /// Optional. The cluster tier.
3233    pub cluster_tier: crate::model::cluster_config::ClusterTier,
3234
3235    /// Optional. A Cloud Storage bucket used to stage job
3236    /// dependencies, config files, and job driver console output.
3237    /// If you do not specify a staging bucket, Cloud
3238    /// Dataproc will determine a Cloud Storage location (US,
3239    /// ASIA, or EU) for your cluster's staging bucket according to the
3240    /// Compute Engine zone where your cluster is deployed, and then create
3241    /// and manage this project-level, per-location bucket (see
3242    /// [Dataproc staging and temp
3243    /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3244    /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3245    /// a Cloud Storage bucket.**
3246    pub config_bucket: std::string::String,
3247
3248    /// Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs
3249    /// data, such as Spark and MapReduce history files. If you do not specify a
3250    /// temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or
3251    /// EU) for your cluster's temp bucket according to the Compute Engine zone
3252    /// where your cluster is deployed, and then create and manage this
3253    /// project-level, per-location bucket. The default bucket has a TTL of 90
3254    /// days, but you can use any TTL (or none) if you specify a bucket (see
3255    /// [Dataproc staging and temp
3256    /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
3257    /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
3258    /// a Cloud Storage bucket.**
3259    pub temp_bucket: std::string::String,
3260
3261    /// Optional. The shared Compute Engine config settings for
3262    /// all instances in a cluster.
3263    pub gce_cluster_config: std::option::Option<crate::model::GceClusterConfig>,
3264
3265    /// Optional. The Compute Engine config settings for
3266    /// the cluster's master instance.
3267    pub master_config: std::option::Option<crate::model::InstanceGroupConfig>,
3268
3269    /// Optional. The Compute Engine config settings for
3270    /// the cluster's worker instances.
3271    pub worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3272
3273    /// Optional. The Compute Engine config settings for
3274    /// a cluster's secondary worker instances
3275    pub secondary_worker_config: std::option::Option<crate::model::InstanceGroupConfig>,
3276
3277    /// Optional. The config settings for cluster software.
3278    pub software_config: std::option::Option<crate::model::SoftwareConfig>,
3279
3280    /// Optional. Commands to execute on each node after config is
3281    /// completed. By default, executables are run on master and all worker nodes.
3282    /// You can test a node's `role` metadata to run an executable on
3283    /// a master or worker node, as shown below using `curl` (you can also use
3284    /// `wget`):
3285    ///
3286    /// ```norust
3287    /// ROLE=$(curl -H Metadata-Flavor:Google
3288    /// http://metadata/computeMetadata/v1/instance/attributes/dataproc-role)
3289    /// if [[ "${ROLE}" == 'Master' ]]; then
3290    ///   ... master specific actions ...
3291    /// else
3292    ///   ... worker specific actions ...
3293    /// fi
3294    /// ```
3295    pub initialization_actions: std::vec::Vec<crate::model::NodeInitializationAction>,
3296
3297    /// Optional. Encryption settings for the cluster.
3298    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
3299
3300    /// Optional. Autoscaling config for the policy associated with the cluster.
3301    /// Cluster does not autoscale if this field is unset.
3302    pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
3303
3304    /// Optional. Security settings for the cluster.
3305    pub security_config: std::option::Option<crate::model::SecurityConfig>,
3306
3307    /// Optional. Lifecycle setting for the cluster.
3308    pub lifecycle_config: std::option::Option<crate::model::LifecycleConfig>,
3309
3310    /// Optional. Port/endpoint configuration for this cluster
3311    pub endpoint_config: std::option::Option<crate::model::EndpointConfig>,
3312
3313    /// Optional. Metastore configuration.
3314    pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
3315
3316    /// Optional. The config for Dataproc metrics.
3317    pub dataproc_metric_config: std::option::Option<crate::model::DataprocMetricConfig>,
3318
3319    /// Optional. The node group settings.
3320    pub auxiliary_node_groups: std::vec::Vec<crate::model::AuxiliaryNodeGroup>,
3321
3322    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3323}
3324
3325impl ClusterConfig {
3326    pub fn new() -> Self {
3327        std::default::Default::default()
3328    }
3329
3330    /// Sets the value of [cluster_type][crate::model::ClusterConfig::cluster_type].
3331    ///
3332    /// # Example
3333    /// ```ignore,no_run
3334    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3335    /// use google_cloud_dataproc_v1::model::cluster_config::ClusterType;
3336    /// let x0 = ClusterConfig::new().set_cluster_type(ClusterType::Standard);
3337    /// let x1 = ClusterConfig::new().set_cluster_type(ClusterType::SingleNode);
3338    /// let x2 = ClusterConfig::new().set_cluster_type(ClusterType::ZeroScale);
3339    /// ```
3340    pub fn set_cluster_type<T: std::convert::Into<crate::model::cluster_config::ClusterType>>(
3341        mut self,
3342        v: T,
3343    ) -> Self {
3344        self.cluster_type = v.into();
3345        self
3346    }
3347
3348    /// Sets the value of [cluster_tier][crate::model::ClusterConfig::cluster_tier].
3349    ///
3350    /// # Example
3351    /// ```ignore,no_run
3352    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3353    /// use google_cloud_dataproc_v1::model::cluster_config::ClusterTier;
3354    /// let x0 = ClusterConfig::new().set_cluster_tier(ClusterTier::Standard);
3355    /// let x1 = ClusterConfig::new().set_cluster_tier(ClusterTier::Premium);
3356    /// ```
3357    pub fn set_cluster_tier<T: std::convert::Into<crate::model::cluster_config::ClusterTier>>(
3358        mut self,
3359        v: T,
3360    ) -> Self {
3361        self.cluster_tier = v.into();
3362        self
3363    }
3364
3365    /// Sets the value of [config_bucket][crate::model::ClusterConfig::config_bucket].
3366    ///
3367    /// # Example
3368    /// ```ignore,no_run
3369    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3370    /// let x = ClusterConfig::new().set_config_bucket("example");
3371    /// ```
3372    pub fn set_config_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3373        self.config_bucket = v.into();
3374        self
3375    }
3376
3377    /// Sets the value of [temp_bucket][crate::model::ClusterConfig::temp_bucket].
3378    ///
3379    /// # Example
3380    /// ```ignore,no_run
3381    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3382    /// let x = ClusterConfig::new().set_temp_bucket("example");
3383    /// ```
3384    pub fn set_temp_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3385        self.temp_bucket = v.into();
3386        self
3387    }
3388
3389    /// Sets the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3390    ///
3391    /// # Example
3392    /// ```ignore,no_run
3393    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3394    /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3395    /// let x = ClusterConfig::new().set_gce_cluster_config(GceClusterConfig::default()/* use setters */);
3396    /// ```
3397    pub fn set_gce_cluster_config<T>(mut self, v: T) -> Self
3398    where
3399        T: std::convert::Into<crate::model::GceClusterConfig>,
3400    {
3401        self.gce_cluster_config = std::option::Option::Some(v.into());
3402        self
3403    }
3404
3405    /// Sets or clears the value of [gce_cluster_config][crate::model::ClusterConfig::gce_cluster_config].
3406    ///
3407    /// # Example
3408    /// ```ignore,no_run
3409    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3410    /// use google_cloud_dataproc_v1::model::GceClusterConfig;
3411    /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(Some(GceClusterConfig::default()/* use setters */));
3412    /// let x = ClusterConfig::new().set_or_clear_gce_cluster_config(None::<GceClusterConfig>);
3413    /// ```
3414    pub fn set_or_clear_gce_cluster_config<T>(mut self, v: std::option::Option<T>) -> Self
3415    where
3416        T: std::convert::Into<crate::model::GceClusterConfig>,
3417    {
3418        self.gce_cluster_config = v.map(|x| x.into());
3419        self
3420    }
3421
3422    /// Sets the value of [master_config][crate::model::ClusterConfig::master_config].
3423    ///
3424    /// # Example
3425    /// ```ignore,no_run
3426    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3427    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3428    /// let x = ClusterConfig::new().set_master_config(InstanceGroupConfig::default()/* use setters */);
3429    /// ```
3430    pub fn set_master_config<T>(mut self, v: T) -> Self
3431    where
3432        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3433    {
3434        self.master_config = std::option::Option::Some(v.into());
3435        self
3436    }
3437
3438    /// Sets or clears the value of [master_config][crate::model::ClusterConfig::master_config].
3439    ///
3440    /// # Example
3441    /// ```ignore,no_run
3442    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3443    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3444    /// let x = ClusterConfig::new().set_or_clear_master_config(Some(InstanceGroupConfig::default()/* use setters */));
3445    /// let x = ClusterConfig::new().set_or_clear_master_config(None::<InstanceGroupConfig>);
3446    /// ```
3447    pub fn set_or_clear_master_config<T>(mut self, v: std::option::Option<T>) -> Self
3448    where
3449        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3450    {
3451        self.master_config = v.map(|x| x.into());
3452        self
3453    }
3454
3455    /// Sets the value of [worker_config][crate::model::ClusterConfig::worker_config].
3456    ///
3457    /// # Example
3458    /// ```ignore,no_run
3459    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3460    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3461    /// let x = ClusterConfig::new().set_worker_config(InstanceGroupConfig::default()/* use setters */);
3462    /// ```
3463    pub fn set_worker_config<T>(mut self, v: T) -> Self
3464    where
3465        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3466    {
3467        self.worker_config = std::option::Option::Some(v.into());
3468        self
3469    }
3470
3471    /// Sets or clears the value of [worker_config][crate::model::ClusterConfig::worker_config].
3472    ///
3473    /// # Example
3474    /// ```ignore,no_run
3475    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3476    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3477    /// let x = ClusterConfig::new().set_or_clear_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3478    /// let x = ClusterConfig::new().set_or_clear_worker_config(None::<InstanceGroupConfig>);
3479    /// ```
3480    pub fn set_or_clear_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3481    where
3482        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3483    {
3484        self.worker_config = v.map(|x| x.into());
3485        self
3486    }
3487
3488    /// Sets the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3489    ///
3490    /// # Example
3491    /// ```ignore,no_run
3492    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3493    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3494    /// let x = ClusterConfig::new().set_secondary_worker_config(InstanceGroupConfig::default()/* use setters */);
3495    /// ```
3496    pub fn set_secondary_worker_config<T>(mut self, v: T) -> Self
3497    where
3498        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3499    {
3500        self.secondary_worker_config = std::option::Option::Some(v.into());
3501        self
3502    }
3503
3504    /// Sets or clears the value of [secondary_worker_config][crate::model::ClusterConfig::secondary_worker_config].
3505    ///
3506    /// # Example
3507    /// ```ignore,no_run
3508    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3509    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
3510    /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(Some(InstanceGroupConfig::default()/* use setters */));
3511    /// let x = ClusterConfig::new().set_or_clear_secondary_worker_config(None::<InstanceGroupConfig>);
3512    /// ```
3513    pub fn set_or_clear_secondary_worker_config<T>(mut self, v: std::option::Option<T>) -> Self
3514    where
3515        T: std::convert::Into<crate::model::InstanceGroupConfig>,
3516    {
3517        self.secondary_worker_config = v.map(|x| x.into());
3518        self
3519    }
3520
3521    /// Sets the value of [software_config][crate::model::ClusterConfig::software_config].
3522    ///
3523    /// # Example
3524    /// ```ignore,no_run
3525    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3526    /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3527    /// let x = ClusterConfig::new().set_software_config(SoftwareConfig::default()/* use setters */);
3528    /// ```
3529    pub fn set_software_config<T>(mut self, v: T) -> Self
3530    where
3531        T: std::convert::Into<crate::model::SoftwareConfig>,
3532    {
3533        self.software_config = std::option::Option::Some(v.into());
3534        self
3535    }
3536
3537    /// Sets or clears the value of [software_config][crate::model::ClusterConfig::software_config].
3538    ///
3539    /// # Example
3540    /// ```ignore,no_run
3541    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3542    /// use google_cloud_dataproc_v1::model::SoftwareConfig;
3543    /// let x = ClusterConfig::new().set_or_clear_software_config(Some(SoftwareConfig::default()/* use setters */));
3544    /// let x = ClusterConfig::new().set_or_clear_software_config(None::<SoftwareConfig>);
3545    /// ```
3546    pub fn set_or_clear_software_config<T>(mut self, v: std::option::Option<T>) -> Self
3547    where
3548        T: std::convert::Into<crate::model::SoftwareConfig>,
3549    {
3550        self.software_config = v.map(|x| x.into());
3551        self
3552    }
3553
3554    /// Sets the value of [initialization_actions][crate::model::ClusterConfig::initialization_actions].
3555    ///
3556    /// # Example
3557    /// ```ignore,no_run
3558    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3559    /// use google_cloud_dataproc_v1::model::NodeInitializationAction;
3560    /// let x = ClusterConfig::new()
3561    ///     .set_initialization_actions([
3562    ///         NodeInitializationAction::default()/* use setters */,
3563    ///         NodeInitializationAction::default()/* use (different) setters */,
3564    ///     ]);
3565    /// ```
3566    pub fn set_initialization_actions<T, V>(mut self, v: T) -> Self
3567    where
3568        T: std::iter::IntoIterator<Item = V>,
3569        V: std::convert::Into<crate::model::NodeInitializationAction>,
3570    {
3571        use std::iter::Iterator;
3572        self.initialization_actions = v.into_iter().map(|i| i.into()).collect();
3573        self
3574    }
3575
3576    /// Sets the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3577    ///
3578    /// # Example
3579    /// ```ignore,no_run
3580    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3581    /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3582    /// let x = ClusterConfig::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
3583    /// ```
3584    pub fn set_encryption_config<T>(mut self, v: T) -> Self
3585    where
3586        T: std::convert::Into<crate::model::EncryptionConfig>,
3587    {
3588        self.encryption_config = std::option::Option::Some(v.into());
3589        self
3590    }
3591
3592    /// Sets or clears the value of [encryption_config][crate::model::ClusterConfig::encryption_config].
3593    ///
3594    /// # Example
3595    /// ```ignore,no_run
3596    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3597    /// use google_cloud_dataproc_v1::model::EncryptionConfig;
3598    /// let x = ClusterConfig::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
3599    /// let x = ClusterConfig::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
3600    /// ```
3601    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3602    where
3603        T: std::convert::Into<crate::model::EncryptionConfig>,
3604    {
3605        self.encryption_config = v.map(|x| x.into());
3606        self
3607    }
3608
3609    /// Sets the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3610    ///
3611    /// # Example
3612    /// ```ignore,no_run
3613    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3614    /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3615    /// let x = ClusterConfig::new().set_autoscaling_config(AutoscalingConfig::default()/* use setters */);
3616    /// ```
3617    pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
3618    where
3619        T: std::convert::Into<crate::model::AutoscalingConfig>,
3620    {
3621        self.autoscaling_config = std::option::Option::Some(v.into());
3622        self
3623    }
3624
3625    /// Sets or clears the value of [autoscaling_config][crate::model::ClusterConfig::autoscaling_config].
3626    ///
3627    /// # Example
3628    /// ```ignore,no_run
3629    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3630    /// use google_cloud_dataproc_v1::model::AutoscalingConfig;
3631    /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(Some(AutoscalingConfig::default()/* use setters */));
3632    /// let x = ClusterConfig::new().set_or_clear_autoscaling_config(None::<AutoscalingConfig>);
3633    /// ```
3634    pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
3635    where
3636        T: std::convert::Into<crate::model::AutoscalingConfig>,
3637    {
3638        self.autoscaling_config = v.map(|x| x.into());
3639        self
3640    }
3641
3642    /// Sets the value of [security_config][crate::model::ClusterConfig::security_config].
3643    ///
3644    /// # Example
3645    /// ```ignore,no_run
3646    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3647    /// use google_cloud_dataproc_v1::model::SecurityConfig;
3648    /// let x = ClusterConfig::new().set_security_config(SecurityConfig::default()/* use setters */);
3649    /// ```
3650    pub fn set_security_config<T>(mut self, v: T) -> Self
3651    where
3652        T: std::convert::Into<crate::model::SecurityConfig>,
3653    {
3654        self.security_config = std::option::Option::Some(v.into());
3655        self
3656    }
3657
3658    /// Sets or clears the value of [security_config][crate::model::ClusterConfig::security_config].
3659    ///
3660    /// # Example
3661    /// ```ignore,no_run
3662    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3663    /// use google_cloud_dataproc_v1::model::SecurityConfig;
3664    /// let x = ClusterConfig::new().set_or_clear_security_config(Some(SecurityConfig::default()/* use setters */));
3665    /// let x = ClusterConfig::new().set_or_clear_security_config(None::<SecurityConfig>);
3666    /// ```
3667    pub fn set_or_clear_security_config<T>(mut self, v: std::option::Option<T>) -> Self
3668    where
3669        T: std::convert::Into<crate::model::SecurityConfig>,
3670    {
3671        self.security_config = v.map(|x| x.into());
3672        self
3673    }
3674
3675    /// Sets the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3676    ///
3677    /// # Example
3678    /// ```ignore,no_run
3679    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3680    /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3681    /// let x = ClusterConfig::new().set_lifecycle_config(LifecycleConfig::default()/* use setters */);
3682    /// ```
3683    pub fn set_lifecycle_config<T>(mut self, v: T) -> Self
3684    where
3685        T: std::convert::Into<crate::model::LifecycleConfig>,
3686    {
3687        self.lifecycle_config = std::option::Option::Some(v.into());
3688        self
3689    }
3690
3691    /// Sets or clears the value of [lifecycle_config][crate::model::ClusterConfig::lifecycle_config].
3692    ///
3693    /// # Example
3694    /// ```ignore,no_run
3695    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3696    /// use google_cloud_dataproc_v1::model::LifecycleConfig;
3697    /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(Some(LifecycleConfig::default()/* use setters */));
3698    /// let x = ClusterConfig::new().set_or_clear_lifecycle_config(None::<LifecycleConfig>);
3699    /// ```
3700    pub fn set_or_clear_lifecycle_config<T>(mut self, v: std::option::Option<T>) -> Self
3701    where
3702        T: std::convert::Into<crate::model::LifecycleConfig>,
3703    {
3704        self.lifecycle_config = v.map(|x| x.into());
3705        self
3706    }
3707
3708    /// Sets the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3709    ///
3710    /// # Example
3711    /// ```ignore,no_run
3712    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3713    /// use google_cloud_dataproc_v1::model::EndpointConfig;
3714    /// let x = ClusterConfig::new().set_endpoint_config(EndpointConfig::default()/* use setters */);
3715    /// ```
3716    pub fn set_endpoint_config<T>(mut self, v: T) -> Self
3717    where
3718        T: std::convert::Into<crate::model::EndpointConfig>,
3719    {
3720        self.endpoint_config = std::option::Option::Some(v.into());
3721        self
3722    }
3723
3724    /// Sets or clears the value of [endpoint_config][crate::model::ClusterConfig::endpoint_config].
3725    ///
3726    /// # Example
3727    /// ```ignore,no_run
3728    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3729    /// use google_cloud_dataproc_v1::model::EndpointConfig;
3730    /// let x = ClusterConfig::new().set_or_clear_endpoint_config(Some(EndpointConfig::default()/* use setters */));
3731    /// let x = ClusterConfig::new().set_or_clear_endpoint_config(None::<EndpointConfig>);
3732    /// ```
3733    pub fn set_or_clear_endpoint_config<T>(mut self, v: std::option::Option<T>) -> Self
3734    where
3735        T: std::convert::Into<crate::model::EndpointConfig>,
3736    {
3737        self.endpoint_config = v.map(|x| x.into());
3738        self
3739    }
3740
3741    /// Sets the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3742    ///
3743    /// # Example
3744    /// ```ignore,no_run
3745    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3746    /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3747    /// let x = ClusterConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
3748    /// ```
3749    pub fn set_metastore_config<T>(mut self, v: T) -> Self
3750    where
3751        T: std::convert::Into<crate::model::MetastoreConfig>,
3752    {
3753        self.metastore_config = std::option::Option::Some(v.into());
3754        self
3755    }
3756
3757    /// Sets or clears the value of [metastore_config][crate::model::ClusterConfig::metastore_config].
3758    ///
3759    /// # Example
3760    /// ```ignore,no_run
3761    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3762    /// use google_cloud_dataproc_v1::model::MetastoreConfig;
3763    /// let x = ClusterConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
3764    /// let x = ClusterConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
3765    /// ```
3766    pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
3767    where
3768        T: std::convert::Into<crate::model::MetastoreConfig>,
3769    {
3770        self.metastore_config = v.map(|x| x.into());
3771        self
3772    }
3773
3774    /// Sets the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3775    ///
3776    /// # Example
3777    /// ```ignore,no_run
3778    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3779    /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3780    /// let x = ClusterConfig::new().set_dataproc_metric_config(DataprocMetricConfig::default()/* use setters */);
3781    /// ```
3782    pub fn set_dataproc_metric_config<T>(mut self, v: T) -> Self
3783    where
3784        T: std::convert::Into<crate::model::DataprocMetricConfig>,
3785    {
3786        self.dataproc_metric_config = std::option::Option::Some(v.into());
3787        self
3788    }
3789
3790    /// Sets or clears the value of [dataproc_metric_config][crate::model::ClusterConfig::dataproc_metric_config].
3791    ///
3792    /// # Example
3793    /// ```ignore,no_run
3794    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3795    /// use google_cloud_dataproc_v1::model::DataprocMetricConfig;
3796    /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(Some(DataprocMetricConfig::default()/* use setters */));
3797    /// let x = ClusterConfig::new().set_or_clear_dataproc_metric_config(None::<DataprocMetricConfig>);
3798    /// ```
3799    pub fn set_or_clear_dataproc_metric_config<T>(mut self, v: std::option::Option<T>) -> Self
3800    where
3801        T: std::convert::Into<crate::model::DataprocMetricConfig>,
3802    {
3803        self.dataproc_metric_config = v.map(|x| x.into());
3804        self
3805    }
3806
3807    /// Sets the value of [auxiliary_node_groups][crate::model::ClusterConfig::auxiliary_node_groups].
3808    ///
3809    /// # Example
3810    /// ```ignore,no_run
3811    /// # use google_cloud_dataproc_v1::model::ClusterConfig;
3812    /// use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
3813    /// let x = ClusterConfig::new()
3814    ///     .set_auxiliary_node_groups([
3815    ///         AuxiliaryNodeGroup::default()/* use setters */,
3816    ///         AuxiliaryNodeGroup::default()/* use (different) setters */,
3817    ///     ]);
3818    /// ```
3819    pub fn set_auxiliary_node_groups<T, V>(mut self, v: T) -> Self
3820    where
3821        T: std::iter::IntoIterator<Item = V>,
3822        V: std::convert::Into<crate::model::AuxiliaryNodeGroup>,
3823    {
3824        use std::iter::Iterator;
3825        self.auxiliary_node_groups = v.into_iter().map(|i| i.into()).collect();
3826        self
3827    }
3828}
3829
3830impl wkt::message::Message for ClusterConfig {
3831    fn typename() -> &'static str {
3832        "type.googleapis.com/google.cloud.dataproc.v1.ClusterConfig"
3833    }
3834}
3835
3836/// Defines additional types related to [ClusterConfig].
3837pub mod cluster_config {
3838    #[allow(unused_imports)]
3839    use super::*;
3840
3841    /// The type of the cluster.
3842    ///
3843    /// # Working with unknown values
3844    ///
3845    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3846    /// additional enum variants at any time. Adding new variants is not considered
3847    /// a breaking change. Applications should write their code in anticipation of:
3848    ///
3849    /// - New values appearing in future releases of the client library, **and**
3850    /// - New values received dynamically, without application changes.
3851    ///
3852    /// Please consult the [Working with enums] section in the user guide for some
3853    /// guidelines.
3854    ///
3855    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3856    #[derive(Clone, Debug, PartialEq)]
3857    #[non_exhaustive]
3858    pub enum ClusterType {
3859        /// Not set.
3860        Unspecified,
3861        /// Standard dataproc cluster with a minimum of two primary workers.
3862        Standard,
3863        /// <https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/single-node-clusters>
3864        SingleNode,
3865        /// Clusters that can use only secondary workers and be scaled down to zero
3866        /// secondary worker nodes.
3867        ZeroScale,
3868        /// If set, the enum was initialized with an unknown value.
3869        ///
3870        /// Applications can examine the value using [ClusterType::value] or
3871        /// [ClusterType::name].
3872        UnknownValue(cluster_type::UnknownValue),
3873    }
3874
3875    #[doc(hidden)]
3876    pub mod cluster_type {
3877        #[allow(unused_imports)]
3878        use super::*;
3879        #[derive(Clone, Debug, PartialEq)]
3880        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3881    }
3882
3883    impl ClusterType {
3884        /// Gets the enum value.
3885        ///
3886        /// Returns `None` if the enum contains an unknown value deserialized from
3887        /// the string representation of enums.
3888        pub fn value(&self) -> std::option::Option<i32> {
3889            match self {
3890                Self::Unspecified => std::option::Option::Some(0),
3891                Self::Standard => std::option::Option::Some(1),
3892                Self::SingleNode => std::option::Option::Some(2),
3893                Self::ZeroScale => std::option::Option::Some(3),
3894                Self::UnknownValue(u) => u.0.value(),
3895            }
3896        }
3897
3898        /// Gets the enum value as a string.
3899        ///
3900        /// Returns `None` if the enum contains an unknown value deserialized from
3901        /// the integer representation of enums.
3902        pub fn name(&self) -> std::option::Option<&str> {
3903            match self {
3904                Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
3905                Self::Standard => std::option::Option::Some("STANDARD"),
3906                Self::SingleNode => std::option::Option::Some("SINGLE_NODE"),
3907                Self::ZeroScale => std::option::Option::Some("ZERO_SCALE"),
3908                Self::UnknownValue(u) => u.0.name(),
3909            }
3910        }
3911    }
3912
3913    impl std::default::Default for ClusterType {
3914        fn default() -> Self {
3915            use std::convert::From;
3916            Self::from(0)
3917        }
3918    }
3919
3920    impl std::fmt::Display for ClusterType {
3921        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3922            wkt::internal::display_enum(f, self.name(), self.value())
3923        }
3924    }
3925
3926    impl std::convert::From<i32> for ClusterType {
3927        fn from(value: i32) -> Self {
3928            match value {
3929                0 => Self::Unspecified,
3930                1 => Self::Standard,
3931                2 => Self::SingleNode,
3932                3 => Self::ZeroScale,
3933                _ => Self::UnknownValue(cluster_type::UnknownValue(
3934                    wkt::internal::UnknownEnumValue::Integer(value),
3935                )),
3936            }
3937        }
3938    }
3939
3940    impl std::convert::From<&str> for ClusterType {
3941        fn from(value: &str) -> Self {
3942            use std::string::ToString;
3943            match value {
3944                "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
3945                "STANDARD" => Self::Standard,
3946                "SINGLE_NODE" => Self::SingleNode,
3947                "ZERO_SCALE" => Self::ZeroScale,
3948                _ => Self::UnknownValue(cluster_type::UnknownValue(
3949                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3950                )),
3951            }
3952        }
3953    }
3954
3955    impl serde::ser::Serialize for ClusterType {
3956        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3957        where
3958            S: serde::Serializer,
3959        {
3960            match self {
3961                Self::Unspecified => serializer.serialize_i32(0),
3962                Self::Standard => serializer.serialize_i32(1),
3963                Self::SingleNode => serializer.serialize_i32(2),
3964                Self::ZeroScale => serializer.serialize_i32(3),
3965                Self::UnknownValue(u) => u.0.serialize(serializer),
3966            }
3967        }
3968    }
3969
3970    impl<'de> serde::de::Deserialize<'de> for ClusterType {
3971        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3972        where
3973            D: serde::Deserializer<'de>,
3974        {
3975            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
3976                ".google.cloud.dataproc.v1.ClusterConfig.ClusterType",
3977            ))
3978        }
3979    }
3980
3981    /// The cluster tier.
3982    ///
3983    /// # Working with unknown values
3984    ///
3985    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3986    /// additional enum variants at any time. Adding new variants is not considered
3987    /// a breaking change. Applications should write their code in anticipation of:
3988    ///
3989    /// - New values appearing in future releases of the client library, **and**
3990    /// - New values received dynamically, without application changes.
3991    ///
3992    /// Please consult the [Working with enums] section in the user guide for some
3993    /// guidelines.
3994    ///
3995    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3996    #[derive(Clone, Debug, PartialEq)]
3997    #[non_exhaustive]
3998    pub enum ClusterTier {
3999        /// Not set. Works the same as CLUSTER_TIER_STANDARD.
4000        Unspecified,
4001        /// Standard Dataproc cluster.
4002        Standard,
4003        /// Premium Dataproc cluster.
4004        Premium,
4005        /// If set, the enum was initialized with an unknown value.
4006        ///
4007        /// Applications can examine the value using [ClusterTier::value] or
4008        /// [ClusterTier::name].
4009        UnknownValue(cluster_tier::UnknownValue),
4010    }
4011
4012    #[doc(hidden)]
4013    pub mod cluster_tier {
4014        #[allow(unused_imports)]
4015        use super::*;
4016        #[derive(Clone, Debug, PartialEq)]
4017        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4018    }
4019
4020    impl ClusterTier {
4021        /// Gets the enum value.
4022        ///
4023        /// Returns `None` if the enum contains an unknown value deserialized from
4024        /// the string representation of enums.
4025        pub fn value(&self) -> std::option::Option<i32> {
4026            match self {
4027                Self::Unspecified => std::option::Option::Some(0),
4028                Self::Standard => std::option::Option::Some(1),
4029                Self::Premium => std::option::Option::Some(2),
4030                Self::UnknownValue(u) => u.0.value(),
4031            }
4032        }
4033
4034        /// Gets the enum value as a string.
4035        ///
4036        /// Returns `None` if the enum contains an unknown value deserialized from
4037        /// the integer representation of enums.
4038        pub fn name(&self) -> std::option::Option<&str> {
4039            match self {
4040                Self::Unspecified => std::option::Option::Some("CLUSTER_TIER_UNSPECIFIED"),
4041                Self::Standard => std::option::Option::Some("CLUSTER_TIER_STANDARD"),
4042                Self::Premium => std::option::Option::Some("CLUSTER_TIER_PREMIUM"),
4043                Self::UnknownValue(u) => u.0.name(),
4044            }
4045        }
4046    }
4047
4048    impl std::default::Default for ClusterTier {
4049        fn default() -> Self {
4050            use std::convert::From;
4051            Self::from(0)
4052        }
4053    }
4054
4055    impl std::fmt::Display for ClusterTier {
4056        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4057            wkt::internal::display_enum(f, self.name(), self.value())
4058        }
4059    }
4060
4061    impl std::convert::From<i32> for ClusterTier {
4062        fn from(value: i32) -> Self {
4063            match value {
4064                0 => Self::Unspecified,
4065                1 => Self::Standard,
4066                2 => Self::Premium,
4067                _ => Self::UnknownValue(cluster_tier::UnknownValue(
4068                    wkt::internal::UnknownEnumValue::Integer(value),
4069                )),
4070            }
4071        }
4072    }
4073
4074    impl std::convert::From<&str> for ClusterTier {
4075        fn from(value: &str) -> Self {
4076            use std::string::ToString;
4077            match value {
4078                "CLUSTER_TIER_UNSPECIFIED" => Self::Unspecified,
4079                "CLUSTER_TIER_STANDARD" => Self::Standard,
4080                "CLUSTER_TIER_PREMIUM" => Self::Premium,
4081                _ => Self::UnknownValue(cluster_tier::UnknownValue(
4082                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4083                )),
4084            }
4085        }
4086    }
4087
4088    impl serde::ser::Serialize for ClusterTier {
4089        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4090        where
4091            S: serde::Serializer,
4092        {
4093            match self {
4094                Self::Unspecified => serializer.serialize_i32(0),
4095                Self::Standard => serializer.serialize_i32(1),
4096                Self::Premium => serializer.serialize_i32(2),
4097                Self::UnknownValue(u) => u.0.serialize(serializer),
4098            }
4099        }
4100    }
4101
4102    impl<'de> serde::de::Deserialize<'de> for ClusterTier {
4103        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4104        where
4105            D: serde::Deserializer<'de>,
4106        {
4107            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterTier>::new(
4108                ".google.cloud.dataproc.v1.ClusterConfig.ClusterTier",
4109            ))
4110        }
4111    }
4112}
4113
4114/// The Dataproc cluster config for a cluster that does not directly control the
4115/// underlying compute resources, such as a [Dataproc-on-GKE
4116/// cluster](https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
4117#[derive(Clone, Default, PartialEq)]
4118#[non_exhaustive]
4119pub struct VirtualClusterConfig {
4120    /// Optional. A Cloud Storage bucket used to stage job
4121    /// dependencies, config files, and job driver console output.
4122    /// If you do not specify a staging bucket, Cloud
4123    /// Dataproc will determine a Cloud Storage location (US,
4124    /// ASIA, or EU) for your cluster's staging bucket according to the
4125    /// Compute Engine zone where your cluster is deployed, and then create
4126    /// and manage this project-level, per-location bucket (see
4127    /// [Dataproc staging and temp
4128    /// buckets](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)).
4129    /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
4130    /// a Cloud Storage bucket.**
4131    pub staging_bucket: std::string::String,
4132
4133    /// Optional. Configuration of auxiliary services used by this cluster.
4134    pub auxiliary_services_config: std::option::Option<crate::model::AuxiliaryServicesConfig>,
4135
4136    pub infrastructure_config:
4137        std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4138
4139    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4140}
4141
4142impl VirtualClusterConfig {
4143    pub fn new() -> Self {
4144        std::default::Default::default()
4145    }
4146
4147    /// Sets the value of [staging_bucket][crate::model::VirtualClusterConfig::staging_bucket].
4148    ///
4149    /// # Example
4150    /// ```ignore,no_run
4151    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4152    /// let x = VirtualClusterConfig::new().set_staging_bucket("example");
4153    /// ```
4154    pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4155        self.staging_bucket = v.into();
4156        self
4157    }
4158
4159    /// Sets the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4160    ///
4161    /// # Example
4162    /// ```ignore,no_run
4163    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4164    /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4165    /// let x = VirtualClusterConfig::new().set_auxiliary_services_config(AuxiliaryServicesConfig::default()/* use setters */);
4166    /// ```
4167    pub fn set_auxiliary_services_config<T>(mut self, v: T) -> Self
4168    where
4169        T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4170    {
4171        self.auxiliary_services_config = std::option::Option::Some(v.into());
4172        self
4173    }
4174
4175    /// Sets or clears the value of [auxiliary_services_config][crate::model::VirtualClusterConfig::auxiliary_services_config].
4176    ///
4177    /// # Example
4178    /// ```ignore,no_run
4179    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4180    /// use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4181    /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(Some(AuxiliaryServicesConfig::default()/* use setters */));
4182    /// let x = VirtualClusterConfig::new().set_or_clear_auxiliary_services_config(None::<AuxiliaryServicesConfig>);
4183    /// ```
4184    pub fn set_or_clear_auxiliary_services_config<T>(mut self, v: std::option::Option<T>) -> Self
4185    where
4186        T: std::convert::Into<crate::model::AuxiliaryServicesConfig>,
4187    {
4188        self.auxiliary_services_config = v.map(|x| x.into());
4189        self
4190    }
4191
4192    /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config].
4193    ///
4194    /// Note that all the setters affecting `infrastructure_config` are mutually
4195    /// exclusive.
4196    ///
4197    /// # Example
4198    /// ```ignore,no_run
4199    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4200    /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4201    /// let x = VirtualClusterConfig::new().set_infrastructure_config(Some(
4202    ///     google_cloud_dataproc_v1::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(KubernetesClusterConfig::default().into())));
4203    /// ```
4204    pub fn set_infrastructure_config<
4205        T: std::convert::Into<
4206                std::option::Option<crate::model::virtual_cluster_config::InfrastructureConfig>,
4207            >,
4208    >(
4209        mut self,
4210        v: T,
4211    ) -> Self {
4212        self.infrastructure_config = v.into();
4213        self
4214    }
4215
4216    /// The value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4217    /// if it holds a `KubernetesClusterConfig`, `None` if the field is not set or
4218    /// holds a different branch.
4219    pub fn kubernetes_cluster_config(
4220        &self,
4221    ) -> std::option::Option<&std::boxed::Box<crate::model::KubernetesClusterConfig>> {
4222        #[allow(unreachable_patterns)]
4223        self.infrastructure_config.as_ref().and_then(|v| match v {
4224            crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4225                v,
4226            ) => std::option::Option::Some(v),
4227            _ => std::option::Option::None,
4228        })
4229    }
4230
4231    /// Sets the value of [infrastructure_config][crate::model::VirtualClusterConfig::infrastructure_config]
4232    /// to hold a `KubernetesClusterConfig`.
4233    ///
4234    /// Note that all the setters affecting `infrastructure_config` are
4235    /// mutually exclusive.
4236    ///
4237    /// # Example
4238    /// ```ignore,no_run
4239    /// # use google_cloud_dataproc_v1::model::VirtualClusterConfig;
4240    /// use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
4241    /// let x = VirtualClusterConfig::new().set_kubernetes_cluster_config(KubernetesClusterConfig::default()/* use setters */);
4242    /// assert!(x.kubernetes_cluster_config().is_some());
4243    /// ```
4244    pub fn set_kubernetes_cluster_config<
4245        T: std::convert::Into<std::boxed::Box<crate::model::KubernetesClusterConfig>>,
4246    >(
4247        mut self,
4248        v: T,
4249    ) -> Self {
4250        self.infrastructure_config = std::option::Option::Some(
4251            crate::model::virtual_cluster_config::InfrastructureConfig::KubernetesClusterConfig(
4252                v.into(),
4253            ),
4254        );
4255        self
4256    }
4257}
4258
4259impl wkt::message::Message for VirtualClusterConfig {
4260    fn typename() -> &'static str {
4261        "type.googleapis.com/google.cloud.dataproc.v1.VirtualClusterConfig"
4262    }
4263}
4264
4265/// Defines additional types related to [VirtualClusterConfig].
4266pub mod virtual_cluster_config {
4267    #[allow(unused_imports)]
4268    use super::*;
4269
4270    #[derive(Clone, Debug, PartialEq)]
4271    #[non_exhaustive]
4272    pub enum InfrastructureConfig {
4273        /// Required. The configuration for running the Dataproc cluster on
4274        /// Kubernetes.
4275        KubernetesClusterConfig(std::boxed::Box<crate::model::KubernetesClusterConfig>),
4276    }
4277}
4278
4279/// Auxiliary services configuration for a Cluster.
4280#[derive(Clone, Default, PartialEq)]
4281#[non_exhaustive]
4282pub struct AuxiliaryServicesConfig {
4283    /// Optional. The Hive Metastore configuration for this workload.
4284    pub metastore_config: std::option::Option<crate::model::MetastoreConfig>,
4285
4286    /// Optional. The Spark History Server configuration for the workload.
4287    pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
4288
4289    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4290}
4291
4292impl AuxiliaryServicesConfig {
4293    pub fn new() -> Self {
4294        std::default::Default::default()
4295    }
4296
4297    /// Sets the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4298    ///
4299    /// # Example
4300    /// ```ignore,no_run
4301    /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4302    /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4303    /// let x = AuxiliaryServicesConfig::new().set_metastore_config(MetastoreConfig::default()/* use setters */);
4304    /// ```
4305    pub fn set_metastore_config<T>(mut self, v: T) -> Self
4306    where
4307        T: std::convert::Into<crate::model::MetastoreConfig>,
4308    {
4309        self.metastore_config = std::option::Option::Some(v.into());
4310        self
4311    }
4312
4313    /// Sets or clears the value of [metastore_config][crate::model::AuxiliaryServicesConfig::metastore_config].
4314    ///
4315    /// # Example
4316    /// ```ignore,no_run
4317    /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4318    /// use google_cloud_dataproc_v1::model::MetastoreConfig;
4319    /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(Some(MetastoreConfig::default()/* use setters */));
4320    /// let x = AuxiliaryServicesConfig::new().set_or_clear_metastore_config(None::<MetastoreConfig>);
4321    /// ```
4322    pub fn set_or_clear_metastore_config<T>(mut self, v: std::option::Option<T>) -> Self
4323    where
4324        T: std::convert::Into<crate::model::MetastoreConfig>,
4325    {
4326        self.metastore_config = v.map(|x| x.into());
4327        self
4328    }
4329
4330    /// Sets the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4331    ///
4332    /// # Example
4333    /// ```ignore,no_run
4334    /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4335    /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4336    /// let x = AuxiliaryServicesConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
4337    /// ```
4338    pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
4339    where
4340        T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4341    {
4342        self.spark_history_server_config = std::option::Option::Some(v.into());
4343        self
4344    }
4345
4346    /// Sets or clears the value of [spark_history_server_config][crate::model::AuxiliaryServicesConfig::spark_history_server_config].
4347    ///
4348    /// # Example
4349    /// ```ignore,no_run
4350    /// # use google_cloud_dataproc_v1::model::AuxiliaryServicesConfig;
4351    /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
4352    /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
4353    /// let x = AuxiliaryServicesConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
4354    /// ```
4355    pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
4356    where
4357        T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
4358    {
4359        self.spark_history_server_config = v.map(|x| x.into());
4360        self
4361    }
4362}
4363
4364impl wkt::message::Message for AuxiliaryServicesConfig {
4365    fn typename() -> &'static str {
4366        "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryServicesConfig"
4367    }
4368}
4369
4370/// Endpoint config for this cluster
4371#[derive(Clone, Default, PartialEq)]
4372#[non_exhaustive]
4373pub struct EndpointConfig {
4374    /// Output only. The map of port descriptions to URLs. Will only be populated
4375    /// if enable_http_port_access is true.
4376    pub http_ports: std::collections::HashMap<std::string::String, std::string::String>,
4377
4378    /// Optional. If true, enable http access to specific ports on the cluster
4379    /// from external sources. Defaults to false.
4380    pub enable_http_port_access: bool,
4381
4382    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4383}
4384
4385impl EndpointConfig {
4386    pub fn new() -> Self {
4387        std::default::Default::default()
4388    }
4389
4390    /// Sets the value of [http_ports][crate::model::EndpointConfig::http_ports].
4391    ///
4392    /// # Example
4393    /// ```ignore,no_run
4394    /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4395    /// let x = EndpointConfig::new().set_http_ports([
4396    ///     ("key0", "abc"),
4397    ///     ("key1", "xyz"),
4398    /// ]);
4399    /// ```
4400    pub fn set_http_ports<T, K, V>(mut self, v: T) -> Self
4401    where
4402        T: std::iter::IntoIterator<Item = (K, V)>,
4403        K: std::convert::Into<std::string::String>,
4404        V: std::convert::Into<std::string::String>,
4405    {
4406        use std::iter::Iterator;
4407        self.http_ports = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4408        self
4409    }
4410
4411    /// Sets the value of [enable_http_port_access][crate::model::EndpointConfig::enable_http_port_access].
4412    ///
4413    /// # Example
4414    /// ```ignore,no_run
4415    /// # use google_cloud_dataproc_v1::model::EndpointConfig;
4416    /// let x = EndpointConfig::new().set_enable_http_port_access(true);
4417    /// ```
4418    pub fn set_enable_http_port_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4419        self.enable_http_port_access = v.into();
4420        self
4421    }
4422}
4423
4424impl wkt::message::Message for EndpointConfig {
4425    fn typename() -> &'static str {
4426        "type.googleapis.com/google.cloud.dataproc.v1.EndpointConfig"
4427    }
4428}
4429
4430/// Autoscaling Policy config associated with the cluster.
4431#[derive(Clone, Default, PartialEq)]
4432#[non_exhaustive]
4433pub struct AutoscalingConfig {
4434    /// Optional. The autoscaling policy used by the cluster.
4435    ///
4436    /// Only resource names including projectid and location (region) are valid.
4437    /// Examples:
4438    ///
4439    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4440    /// * `projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]`
4441    ///
4442    /// Note that the policy must be in the same project and Dataproc region.
4443    pub policy_uri: std::string::String,
4444
4445    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4446}
4447
4448impl AutoscalingConfig {
4449    pub fn new() -> Self {
4450        std::default::Default::default()
4451    }
4452
4453    /// Sets the value of [policy_uri][crate::model::AutoscalingConfig::policy_uri].
4454    ///
4455    /// # Example
4456    /// ```ignore,no_run
4457    /// # use google_cloud_dataproc_v1::model::AutoscalingConfig;
4458    /// let x = AutoscalingConfig::new().set_policy_uri("example");
4459    /// ```
4460    pub fn set_policy_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4461        self.policy_uri = v.into();
4462        self
4463    }
4464}
4465
4466impl wkt::message::Message for AutoscalingConfig {
4467    fn typename() -> &'static str {
4468        "type.googleapis.com/google.cloud.dataproc.v1.AutoscalingConfig"
4469    }
4470}
4471
4472/// Encryption settings for the cluster.
4473#[derive(Clone, Default, PartialEq)]
4474#[non_exhaustive]
4475pub struct EncryptionConfig {
4476    /// Optional. The Cloud KMS key resource name to use for persistent disk
4477    /// encryption for all instances in the cluster. See [Use CMEK with cluster
4478    /// data]
4479    /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4480    /// for more information.
4481    pub gce_pd_kms_key_name: std::string::String,
4482
4483    /// Optional. The Cloud KMS key resource name to use for cluster persistent
4484    /// disk and job argument encryption. See [Use CMEK with cluster data]
4485    /// (<https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data>)
4486    /// for more information.
4487    ///
4488    /// When this key resource name is provided, the following job arguments of
4489    /// the following job types submitted to the cluster are encrypted using CMEK:
4490    ///
4491    /// * [FlinkJob
4492    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
4493    /// * [HadoopJob
4494    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
4495    /// * [SparkJob
4496    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
4497    /// * [SparkRJob
4498    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
4499    /// * [PySparkJob
4500    ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
4501    /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
4502    ///   scriptVariables and queryList.queries
4503    /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
4504    ///   scriptVariables and queryList.queries
4505    /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
4506    ///   scriptVariables and queryList.queries
4507    /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
4508    ///   scriptVariables and queryList.queries
4509    pub kms_key: std::string::String,
4510
4511    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4512}
4513
4514impl EncryptionConfig {
4515    pub fn new() -> Self {
4516        std::default::Default::default()
4517    }
4518
4519    /// Sets the value of [gce_pd_kms_key_name][crate::model::EncryptionConfig::gce_pd_kms_key_name].
4520    ///
4521    /// # Example
4522    /// ```ignore,no_run
4523    /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4524    /// let x = EncryptionConfig::new().set_gce_pd_kms_key_name("example");
4525    /// ```
4526    pub fn set_gce_pd_kms_key_name<T: std::convert::Into<std::string::String>>(
4527        mut self,
4528        v: T,
4529    ) -> Self {
4530        self.gce_pd_kms_key_name = v.into();
4531        self
4532    }
4533
4534    /// Sets the value of [kms_key][crate::model::EncryptionConfig::kms_key].
4535    ///
4536    /// # Example
4537    /// ```ignore,no_run
4538    /// # use google_cloud_dataproc_v1::model::EncryptionConfig;
4539    /// let x = EncryptionConfig::new().set_kms_key("example");
4540    /// ```
4541    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4542        self.kms_key = v.into();
4543        self
4544    }
4545}
4546
4547impl wkt::message::Message for EncryptionConfig {
4548    fn typename() -> &'static str {
4549        "type.googleapis.com/google.cloud.dataproc.v1.EncryptionConfig"
4550    }
4551}
4552
4553/// Common config settings for resources of Compute Engine cluster
4554/// instances, applicable to all instances in the cluster.
4555#[derive(Clone, Default, PartialEq)]
4556#[non_exhaustive]
4557pub struct GceClusterConfig {
4558    /// Optional. The Compute Engine zone where the Dataproc cluster will be
4559    /// located. If omitted, the service will pick a zone in the cluster's Compute
4560    /// Engine region. On a get request, zone will always be present.
4561    ///
4562    /// A full URL, partial URI, or short name are valid. Examples:
4563    ///
4564    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]`
4565    /// * `projects/[project_id]/zones/[zone]`
4566    /// * `[zone]`
4567    pub zone_uri: std::string::String,
4568
4569    /// Optional. The Compute Engine network to be used for machine
4570    /// communications. Cannot be specified with subnetwork_uri. If neither
4571    /// `network_uri` nor `subnetwork_uri` is specified, the "default" network of
4572    /// the project is used, if it exists. Cannot be a "Custom Subnet Network" (see
4573    /// [Using Subnetworks](https://cloud.google.com/compute/docs/subnetworks) for
4574    /// more information).
4575    ///
4576    /// A full URL, partial URI, or short name are valid. Examples:
4577    ///
4578    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/networks/default`
4579    /// * `projects/[project_id]/global/networks/default`
4580    /// * `default`
4581    pub network_uri: std::string::String,
4582
4583    /// Optional. The Compute Engine subnetwork to be used for machine
4584    /// communications. Cannot be specified with network_uri.
4585    ///
4586    /// A full URL, partial URI, or short name are valid. Examples:
4587    ///
4588    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/regions/[region]/subnetworks/sub0`
4589    /// * `projects/[project_id]/regions/[region]/subnetworks/sub0`
4590    /// * `sub0`
4591    pub subnetwork_uri: std::string::String,
4592
4593    /// Optional. This setting applies to subnetwork-enabled networks. It is set to
4594    /// `true` by default in clusters created with image versions 2.2.x.
4595    ///
4596    /// When set to `true`:
4597    ///
4598    /// * All cluster VMs have internal IP addresses.
4599    /// * [Google Private Access]
4600    ///   (<https://cloud.google.com/vpc/docs/private-google-access>)
4601    ///   must be enabled to access Dataproc and other Google Cloud APIs.
4602    /// * Off-cluster dependencies must be configured to be accessible
4603    ///   without external IP addresses.
4604    ///
4605    /// When set to `false`:
4606    ///
4607    /// * Cluster VMs are not restricted to internal IP addresses.
4608    /// * Ephemeral external IP addresses are assigned to each cluster VM.
4609    pub internal_ip_only: std::option::Option<bool>,
4610
4611    /// Optional. The type of IPv6 access for a cluster.
4612    pub private_ipv6_google_access: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess,
4613
4614    /// Optional. The [Dataproc service
4615    /// account](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc)
4616    /// (also see [VM Data Plane
4617    /// identity](https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity))
4618    /// used by Dataproc cluster VM instances to access Google Cloud Platform
4619    /// services.
4620    ///
4621    /// If not specified, the
4622    /// [Compute Engine default service
4623    /// account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
4624    /// is used.
4625    pub service_account: std::string::String,
4626
4627    /// Optional. The URIs of service account scopes to be included in
4628    /// Compute Engine instances. The following base set of scopes is always
4629    /// included:
4630    ///
4631    /// * <https://www.googleapis.com/auth/cloud.useraccounts.readonly>
4632    /// * <https://www.googleapis.com/auth/devstorage.read_write>
4633    /// * <https://www.googleapis.com/auth/logging.write>
4634    ///
4635    /// If no scopes are specified, the following defaults are also provided:
4636    ///
4637    /// * <https://www.googleapis.com/auth/bigquery>
4638    /// * <https://www.googleapis.com/auth/bigtable.admin.table>
4639    /// * <https://www.googleapis.com/auth/bigtable.data>
4640    /// * <https://www.googleapis.com/auth/devstorage.full_control>
4641    pub service_account_scopes: std::vec::Vec<std::string::String>,
4642
4643    /// The Compute Engine network tags to add to all instances (see [Tagging
4644    /// instances](https://cloud.google.com/vpc/docs/add-remove-network-tags)).
4645    pub tags: std::vec::Vec<std::string::String>,
4646
4647    /// Optional. The Compute Engine metadata entries to add to all instances (see
4648    /// [Project and instance
4649    /// metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
4650    pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
4651
4652    /// Optional. Reservation Affinity for consuming Zonal reservation.
4653    pub reservation_affinity: std::option::Option<crate::model::ReservationAffinity>,
4654
4655    /// Optional. Node Group Affinity for sole-tenant clusters.
4656    pub node_group_affinity: std::option::Option<crate::model::NodeGroupAffinity>,
4657
4658    /// Optional. Shielded Instance Config for clusters using [Compute Engine
4659    /// Shielded
4660    /// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
4661    pub shielded_instance_config: std::option::Option<crate::model::ShieldedInstanceConfig>,
4662
4663    /// Optional. Confidential Instance Config for clusters using [Confidential
4664    /// VMs](https://cloud.google.com/compute/confidential-vm/docs).
4665    pub confidential_instance_config: std::option::Option<crate::model::ConfidentialInstanceConfig>,
4666
4667    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4668}
4669
4670impl GceClusterConfig {
4671    pub fn new() -> Self {
4672        std::default::Default::default()
4673    }
4674
4675    /// Sets the value of [zone_uri][crate::model::GceClusterConfig::zone_uri].
4676    ///
4677    /// # Example
4678    /// ```ignore,no_run
4679    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4680    /// let x = GceClusterConfig::new().set_zone_uri("example");
4681    /// ```
4682    pub fn set_zone_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4683        self.zone_uri = v.into();
4684        self
4685    }
4686
4687    /// Sets the value of [network_uri][crate::model::GceClusterConfig::network_uri].
4688    ///
4689    /// # Example
4690    /// ```ignore,no_run
4691    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4692    /// let x = GceClusterConfig::new().set_network_uri("example");
4693    /// ```
4694    pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4695        self.network_uri = v.into();
4696        self
4697    }
4698
4699    /// Sets the value of [subnetwork_uri][crate::model::GceClusterConfig::subnetwork_uri].
4700    ///
4701    /// # Example
4702    /// ```ignore,no_run
4703    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4704    /// let x = GceClusterConfig::new().set_subnetwork_uri("example");
4705    /// ```
4706    pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4707        self.subnetwork_uri = v.into();
4708        self
4709    }
4710
4711    /// Sets the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4712    ///
4713    /// # Example
4714    /// ```ignore,no_run
4715    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4716    /// let x = GceClusterConfig::new().set_internal_ip_only(true);
4717    /// ```
4718    pub fn set_internal_ip_only<T>(mut self, v: T) -> Self
4719    where
4720        T: std::convert::Into<bool>,
4721    {
4722        self.internal_ip_only = std::option::Option::Some(v.into());
4723        self
4724    }
4725
4726    /// Sets or clears the value of [internal_ip_only][crate::model::GceClusterConfig::internal_ip_only].
4727    ///
4728    /// # Example
4729    /// ```ignore,no_run
4730    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4731    /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(Some(false));
4732    /// let x = GceClusterConfig::new().set_or_clear_internal_ip_only(None::<bool>);
4733    /// ```
4734    pub fn set_or_clear_internal_ip_only<T>(mut self, v: std::option::Option<T>) -> Self
4735    where
4736        T: std::convert::Into<bool>,
4737    {
4738        self.internal_ip_only = v.map(|x| x.into());
4739        self
4740    }
4741
4742    /// Sets the value of [private_ipv6_google_access][crate::model::GceClusterConfig::private_ipv6_google_access].
4743    ///
4744    /// # Example
4745    /// ```ignore,no_run
4746    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4747    /// use google_cloud_dataproc_v1::model::gce_cluster_config::PrivateIpv6GoogleAccess;
4748    /// let x0 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::InheritFromSubnetwork);
4749    /// let x1 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Outbound);
4750    /// let x2 = GceClusterConfig::new().set_private_ipv6_google_access(PrivateIpv6GoogleAccess::Bidirectional);
4751    /// ```
4752    pub fn set_private_ipv6_google_access<
4753        T: std::convert::Into<crate::model::gce_cluster_config::PrivateIpv6GoogleAccess>,
4754    >(
4755        mut self,
4756        v: T,
4757    ) -> Self {
4758        self.private_ipv6_google_access = v.into();
4759        self
4760    }
4761
4762    /// Sets the value of [service_account][crate::model::GceClusterConfig::service_account].
4763    ///
4764    /// # Example
4765    /// ```ignore,no_run
4766    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4767    /// let x = GceClusterConfig::new().set_service_account("example");
4768    /// ```
4769    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4770        self.service_account = v.into();
4771        self
4772    }
4773
4774    /// Sets the value of [service_account_scopes][crate::model::GceClusterConfig::service_account_scopes].
4775    ///
4776    /// # Example
4777    /// ```ignore,no_run
4778    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4779    /// let x = GceClusterConfig::new().set_service_account_scopes(["a", "b", "c"]);
4780    /// ```
4781    pub fn set_service_account_scopes<T, V>(mut self, v: T) -> Self
4782    where
4783        T: std::iter::IntoIterator<Item = V>,
4784        V: std::convert::Into<std::string::String>,
4785    {
4786        use std::iter::Iterator;
4787        self.service_account_scopes = v.into_iter().map(|i| i.into()).collect();
4788        self
4789    }
4790
4791    /// Sets the value of [tags][crate::model::GceClusterConfig::tags].
4792    ///
4793    /// # Example
4794    /// ```ignore,no_run
4795    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4796    /// let x = GceClusterConfig::new().set_tags(["a", "b", "c"]);
4797    /// ```
4798    pub fn set_tags<T, V>(mut self, v: T) -> Self
4799    where
4800        T: std::iter::IntoIterator<Item = V>,
4801        V: std::convert::Into<std::string::String>,
4802    {
4803        use std::iter::Iterator;
4804        self.tags = v.into_iter().map(|i| i.into()).collect();
4805        self
4806    }
4807
4808    /// Sets the value of [metadata][crate::model::GceClusterConfig::metadata].
4809    ///
4810    /// # Example
4811    /// ```ignore,no_run
4812    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4813    /// let x = GceClusterConfig::new().set_metadata([
4814    ///     ("key0", "abc"),
4815    ///     ("key1", "xyz"),
4816    /// ]);
4817    /// ```
4818    pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
4819    where
4820        T: std::iter::IntoIterator<Item = (K, V)>,
4821        K: std::convert::Into<std::string::String>,
4822        V: std::convert::Into<std::string::String>,
4823    {
4824        use std::iter::Iterator;
4825        self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4826        self
4827    }
4828
4829    /// Sets the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
4830    ///
4831    /// # Example
4832    /// ```ignore,no_run
4833    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4834    /// use google_cloud_dataproc_v1::model::ReservationAffinity;
4835    /// let x = GceClusterConfig::new().set_reservation_affinity(ReservationAffinity::default()/* use setters */);
4836    /// ```
4837    pub fn set_reservation_affinity<T>(mut self, v: T) -> Self
4838    where
4839        T: std::convert::Into<crate::model::ReservationAffinity>,
4840    {
4841        self.reservation_affinity = std::option::Option::Some(v.into());
4842        self
4843    }
4844
4845    /// Sets or clears the value of [reservation_affinity][crate::model::GceClusterConfig::reservation_affinity].
4846    ///
4847    /// # Example
4848    /// ```ignore,no_run
4849    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4850    /// use google_cloud_dataproc_v1::model::ReservationAffinity;
4851    /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(Some(ReservationAffinity::default()/* use setters */));
4852    /// let x = GceClusterConfig::new().set_or_clear_reservation_affinity(None::<ReservationAffinity>);
4853    /// ```
4854    pub fn set_or_clear_reservation_affinity<T>(mut self, v: std::option::Option<T>) -> Self
4855    where
4856        T: std::convert::Into<crate::model::ReservationAffinity>,
4857    {
4858        self.reservation_affinity = v.map(|x| x.into());
4859        self
4860    }
4861
4862    /// Sets the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
4863    ///
4864    /// # Example
4865    /// ```ignore,no_run
4866    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4867    /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4868    /// let x = GceClusterConfig::new().set_node_group_affinity(NodeGroupAffinity::default()/* use setters */);
4869    /// ```
4870    pub fn set_node_group_affinity<T>(mut self, v: T) -> Self
4871    where
4872        T: std::convert::Into<crate::model::NodeGroupAffinity>,
4873    {
4874        self.node_group_affinity = std::option::Option::Some(v.into());
4875        self
4876    }
4877
4878    /// Sets or clears the value of [node_group_affinity][crate::model::GceClusterConfig::node_group_affinity].
4879    ///
4880    /// # Example
4881    /// ```ignore,no_run
4882    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4883    /// use google_cloud_dataproc_v1::model::NodeGroupAffinity;
4884    /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(Some(NodeGroupAffinity::default()/* use setters */));
4885    /// let x = GceClusterConfig::new().set_or_clear_node_group_affinity(None::<NodeGroupAffinity>);
4886    /// ```
4887    pub fn set_or_clear_node_group_affinity<T>(mut self, v: std::option::Option<T>) -> Self
4888    where
4889        T: std::convert::Into<crate::model::NodeGroupAffinity>,
4890    {
4891        self.node_group_affinity = v.map(|x| x.into());
4892        self
4893    }
4894
4895    /// Sets the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
4896    ///
4897    /// # Example
4898    /// ```ignore,no_run
4899    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4900    /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4901    /// let x = GceClusterConfig::new().set_shielded_instance_config(ShieldedInstanceConfig::default()/* use setters */);
4902    /// ```
4903    pub fn set_shielded_instance_config<T>(mut self, v: T) -> Self
4904    where
4905        T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
4906    {
4907        self.shielded_instance_config = std::option::Option::Some(v.into());
4908        self
4909    }
4910
4911    /// Sets or clears the value of [shielded_instance_config][crate::model::GceClusterConfig::shielded_instance_config].
4912    ///
4913    /// # Example
4914    /// ```ignore,no_run
4915    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4916    /// use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
4917    /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(Some(ShieldedInstanceConfig::default()/* use setters */));
4918    /// let x = GceClusterConfig::new().set_or_clear_shielded_instance_config(None::<ShieldedInstanceConfig>);
4919    /// ```
4920    pub fn set_or_clear_shielded_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4921    where
4922        T: std::convert::Into<crate::model::ShieldedInstanceConfig>,
4923    {
4924        self.shielded_instance_config = v.map(|x| x.into());
4925        self
4926    }
4927
4928    /// Sets the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
4929    ///
4930    /// # Example
4931    /// ```ignore,no_run
4932    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4933    /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
4934    /// let x = GceClusterConfig::new().set_confidential_instance_config(ConfidentialInstanceConfig::default()/* use setters */);
4935    /// ```
4936    pub fn set_confidential_instance_config<T>(mut self, v: T) -> Self
4937    where
4938        T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
4939    {
4940        self.confidential_instance_config = std::option::Option::Some(v.into());
4941        self
4942    }
4943
4944    /// Sets or clears the value of [confidential_instance_config][crate::model::GceClusterConfig::confidential_instance_config].
4945    ///
4946    /// # Example
4947    /// ```ignore,no_run
4948    /// # use google_cloud_dataproc_v1::model::GceClusterConfig;
4949    /// use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
4950    /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(Some(ConfidentialInstanceConfig::default()/* use setters */));
4951    /// let x = GceClusterConfig::new().set_or_clear_confidential_instance_config(None::<ConfidentialInstanceConfig>);
4952    /// ```
4953    pub fn set_or_clear_confidential_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4954    where
4955        T: std::convert::Into<crate::model::ConfidentialInstanceConfig>,
4956    {
4957        self.confidential_instance_config = v.map(|x| x.into());
4958        self
4959    }
4960}
4961
4962impl wkt::message::Message for GceClusterConfig {
4963    fn typename() -> &'static str {
4964        "type.googleapis.com/google.cloud.dataproc.v1.GceClusterConfig"
4965    }
4966}
4967
4968/// Defines additional types related to [GceClusterConfig].
4969pub mod gce_cluster_config {
4970    #[allow(unused_imports)]
4971    use super::*;
4972
4973    /// `PrivateIpv6GoogleAccess` controls whether and how Dataproc cluster nodes
4974    /// can communicate with Google Services through gRPC over IPv6.
4975    /// These values are directly mapped to corresponding values in the
4976    /// [Compute Engine Instance
4977    /// fields](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
4978    ///
4979    /// # Working with unknown values
4980    ///
4981    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4982    /// additional enum variants at any time. Adding new variants is not considered
4983    /// a breaking change. Applications should write their code in anticipation of:
4984    ///
4985    /// - New values appearing in future releases of the client library, **and**
4986    /// - New values received dynamically, without application changes.
4987    ///
4988    /// Please consult the [Working with enums] section in the user guide for some
4989    /// guidelines.
4990    ///
4991    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4992    #[derive(Clone, Debug, PartialEq)]
4993    #[non_exhaustive]
4994    pub enum PrivateIpv6GoogleAccess {
4995        /// If unspecified, Compute Engine default behavior will apply, which
4996        /// is the same as
4997        /// [INHERIT_FROM_SUBNETWORK][google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK].
4998        ///
4999        /// [google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess.INHERIT_FROM_SUBNETWORK]: crate::model::gce_cluster_config::PrivateIpv6GoogleAccess::InheritFromSubnetwork
5000        Unspecified,
5001        /// Private access to and from Google Services configuration
5002        /// inherited from the subnetwork configuration. This is the
5003        /// default Compute Engine behavior.
5004        InheritFromSubnetwork,
5005        /// Enables outbound private IPv6 access to Google Services from the Dataproc
5006        /// cluster.
5007        Outbound,
5008        /// Enables bidirectional private IPv6 access between Google Services and the
5009        /// Dataproc cluster.
5010        Bidirectional,
5011        /// If set, the enum was initialized with an unknown value.
5012        ///
5013        /// Applications can examine the value using [PrivateIpv6GoogleAccess::value] or
5014        /// [PrivateIpv6GoogleAccess::name].
5015        UnknownValue(private_ipv_6_google_access::UnknownValue),
5016    }
5017
5018    #[doc(hidden)]
5019    pub mod private_ipv_6_google_access {
5020        #[allow(unused_imports)]
5021        use super::*;
5022        #[derive(Clone, Debug, PartialEq)]
5023        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5024    }
5025
5026    impl PrivateIpv6GoogleAccess {
5027        /// Gets the enum value.
5028        ///
5029        /// Returns `None` if the enum contains an unknown value deserialized from
5030        /// the string representation of enums.
5031        pub fn value(&self) -> std::option::Option<i32> {
5032            match self {
5033                Self::Unspecified => std::option::Option::Some(0),
5034                Self::InheritFromSubnetwork => std::option::Option::Some(1),
5035                Self::Outbound => std::option::Option::Some(2),
5036                Self::Bidirectional => std::option::Option::Some(3),
5037                Self::UnknownValue(u) => u.0.value(),
5038            }
5039        }
5040
5041        /// Gets the enum value as a string.
5042        ///
5043        /// Returns `None` if the enum contains an unknown value deserialized from
5044        /// the integer representation of enums.
5045        pub fn name(&self) -> std::option::Option<&str> {
5046            match self {
5047                Self::Unspecified => {
5048                    std::option::Option::Some("PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED")
5049                }
5050                Self::InheritFromSubnetwork => std::option::Option::Some("INHERIT_FROM_SUBNETWORK"),
5051                Self::Outbound => std::option::Option::Some("OUTBOUND"),
5052                Self::Bidirectional => std::option::Option::Some("BIDIRECTIONAL"),
5053                Self::UnknownValue(u) => u.0.name(),
5054            }
5055        }
5056    }
5057
5058    impl std::default::Default for PrivateIpv6GoogleAccess {
5059        fn default() -> Self {
5060            use std::convert::From;
5061            Self::from(0)
5062        }
5063    }
5064
5065    impl std::fmt::Display for PrivateIpv6GoogleAccess {
5066        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5067            wkt::internal::display_enum(f, self.name(), self.value())
5068        }
5069    }
5070
5071    impl std::convert::From<i32> for PrivateIpv6GoogleAccess {
5072        fn from(value: i32) -> Self {
5073            match value {
5074                0 => Self::Unspecified,
5075                1 => Self::InheritFromSubnetwork,
5076                2 => Self::Outbound,
5077                3 => Self::Bidirectional,
5078                _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5079                    wkt::internal::UnknownEnumValue::Integer(value),
5080                )),
5081            }
5082        }
5083    }
5084
5085    impl std::convert::From<&str> for PrivateIpv6GoogleAccess {
5086        fn from(value: &str) -> Self {
5087            use std::string::ToString;
5088            match value {
5089                "PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED" => Self::Unspecified,
5090                "INHERIT_FROM_SUBNETWORK" => Self::InheritFromSubnetwork,
5091                "OUTBOUND" => Self::Outbound,
5092                "BIDIRECTIONAL" => Self::Bidirectional,
5093                _ => Self::UnknownValue(private_ipv_6_google_access::UnknownValue(
5094                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5095                )),
5096            }
5097        }
5098    }
5099
5100    impl serde::ser::Serialize for PrivateIpv6GoogleAccess {
5101        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5102        where
5103            S: serde::Serializer,
5104        {
5105            match self {
5106                Self::Unspecified => serializer.serialize_i32(0),
5107                Self::InheritFromSubnetwork => serializer.serialize_i32(1),
5108                Self::Outbound => serializer.serialize_i32(2),
5109                Self::Bidirectional => serializer.serialize_i32(3),
5110                Self::UnknownValue(u) => u.0.serialize(serializer),
5111            }
5112        }
5113    }
5114
5115    impl<'de> serde::de::Deserialize<'de> for PrivateIpv6GoogleAccess {
5116        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5117        where
5118            D: serde::Deserializer<'de>,
5119        {
5120            deserializer.deserialize_any(
5121                wkt::internal::EnumVisitor::<PrivateIpv6GoogleAccess>::new(
5122                    ".google.cloud.dataproc.v1.GceClusterConfig.PrivateIpv6GoogleAccess",
5123                ),
5124            )
5125        }
5126    }
5127}
5128
5129/// Node Group Affinity for clusters using sole-tenant node groups.
5130/// **The Dataproc `NodeGroupAffinity` resource is not related to the
5131/// Dataproc [NodeGroup][google.cloud.dataproc.v1.NodeGroup] resource.**
5132///
5133/// [google.cloud.dataproc.v1.NodeGroup]: crate::model::NodeGroup
5134#[derive(Clone, Default, PartialEq)]
5135#[non_exhaustive]
5136pub struct NodeGroupAffinity {
5137    /// Required. The URI of a
5138    /// sole-tenant [node group
5139    /// resource](https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups)
5140    /// that the cluster will be created on.
5141    ///
5142    /// A full URL, partial URI, or node group name are valid. Examples:
5143    ///
5144    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/nodeGroups/node-group-1`
5145    /// * `projects/[project_id]/zones/[zone]/nodeGroups/node-group-1`
5146    /// * `node-group-1`
5147    pub node_group_uri: std::string::String,
5148
5149    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5150}
5151
5152impl NodeGroupAffinity {
5153    pub fn new() -> Self {
5154        std::default::Default::default()
5155    }
5156
5157    /// Sets the value of [node_group_uri][crate::model::NodeGroupAffinity::node_group_uri].
5158    ///
5159    /// # Example
5160    /// ```ignore,no_run
5161    /// # use google_cloud_dataproc_v1::model::NodeGroupAffinity;
5162    /// let x = NodeGroupAffinity::new().set_node_group_uri("example");
5163    /// ```
5164    pub fn set_node_group_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5165        self.node_group_uri = v.into();
5166        self
5167    }
5168}
5169
5170impl wkt::message::Message for NodeGroupAffinity {
5171    fn typename() -> &'static str {
5172        "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupAffinity"
5173    }
5174}
5175
5176/// Shielded Instance Config for clusters using [Compute Engine Shielded
5177/// VMs](https://cloud.google.com/security/shielded-cloud/shielded-vm).
5178#[derive(Clone, Default, PartialEq)]
5179#[non_exhaustive]
5180pub struct ShieldedInstanceConfig {
5181    /// Optional. Defines whether instances have Secure Boot enabled.
5182    pub enable_secure_boot: std::option::Option<bool>,
5183
5184    /// Optional. Defines whether instances have the vTPM enabled.
5185    pub enable_vtpm: std::option::Option<bool>,
5186
5187    /// Optional. Defines whether instances have integrity monitoring enabled.
5188    pub enable_integrity_monitoring: std::option::Option<bool>,
5189
5190    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5191}
5192
5193impl ShieldedInstanceConfig {
5194    pub fn new() -> Self {
5195        std::default::Default::default()
5196    }
5197
5198    /// Sets the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5199    ///
5200    /// # Example
5201    /// ```ignore,no_run
5202    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5203    /// let x = ShieldedInstanceConfig::new().set_enable_secure_boot(true);
5204    /// ```
5205    pub fn set_enable_secure_boot<T>(mut self, v: T) -> Self
5206    where
5207        T: std::convert::Into<bool>,
5208    {
5209        self.enable_secure_boot = std::option::Option::Some(v.into());
5210        self
5211    }
5212
5213    /// Sets or clears the value of [enable_secure_boot][crate::model::ShieldedInstanceConfig::enable_secure_boot].
5214    ///
5215    /// # Example
5216    /// ```ignore,no_run
5217    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5218    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(Some(false));
5219    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_secure_boot(None::<bool>);
5220    /// ```
5221    pub fn set_or_clear_enable_secure_boot<T>(mut self, v: std::option::Option<T>) -> Self
5222    where
5223        T: std::convert::Into<bool>,
5224    {
5225        self.enable_secure_boot = v.map(|x| x.into());
5226        self
5227    }
5228
5229    /// Sets the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5230    ///
5231    /// # Example
5232    /// ```ignore,no_run
5233    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5234    /// let x = ShieldedInstanceConfig::new().set_enable_vtpm(true);
5235    /// ```
5236    pub fn set_enable_vtpm<T>(mut self, v: T) -> Self
5237    where
5238        T: std::convert::Into<bool>,
5239    {
5240        self.enable_vtpm = std::option::Option::Some(v.into());
5241        self
5242    }
5243
5244    /// Sets or clears the value of [enable_vtpm][crate::model::ShieldedInstanceConfig::enable_vtpm].
5245    ///
5246    /// # Example
5247    /// ```ignore,no_run
5248    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5249    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(Some(false));
5250    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_vtpm(None::<bool>);
5251    /// ```
5252    pub fn set_or_clear_enable_vtpm<T>(mut self, v: std::option::Option<T>) -> Self
5253    where
5254        T: std::convert::Into<bool>,
5255    {
5256        self.enable_vtpm = v.map(|x| x.into());
5257        self
5258    }
5259
5260    /// Sets the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5261    ///
5262    /// # Example
5263    /// ```ignore,no_run
5264    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5265    /// let x = ShieldedInstanceConfig::new().set_enable_integrity_monitoring(true);
5266    /// ```
5267    pub fn set_enable_integrity_monitoring<T>(mut self, v: T) -> Self
5268    where
5269        T: std::convert::Into<bool>,
5270    {
5271        self.enable_integrity_monitoring = std::option::Option::Some(v.into());
5272        self
5273    }
5274
5275    /// Sets or clears the value of [enable_integrity_monitoring][crate::model::ShieldedInstanceConfig::enable_integrity_monitoring].
5276    ///
5277    /// # Example
5278    /// ```ignore,no_run
5279    /// # use google_cloud_dataproc_v1::model::ShieldedInstanceConfig;
5280    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(Some(false));
5281    /// let x = ShieldedInstanceConfig::new().set_or_clear_enable_integrity_monitoring(None::<bool>);
5282    /// ```
5283    pub fn set_or_clear_enable_integrity_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
5284    where
5285        T: std::convert::Into<bool>,
5286    {
5287        self.enable_integrity_monitoring = v.map(|x| x.into());
5288        self
5289    }
5290}
5291
5292impl wkt::message::Message for ShieldedInstanceConfig {
5293    fn typename() -> &'static str {
5294        "type.googleapis.com/google.cloud.dataproc.v1.ShieldedInstanceConfig"
5295    }
5296}
5297
5298/// Confidential Instance Config for clusters using [Confidential
5299/// VMs](https://cloud.google.com/compute/confidential-vm/docs)
5300#[derive(Clone, Default, PartialEq)]
5301#[non_exhaustive]
5302pub struct ConfidentialInstanceConfig {
5303    /// Optional. Defines whether the instance should have confidential compute
5304    /// enabled.
5305    pub enable_confidential_compute: bool,
5306
5307    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5308}
5309
5310impl ConfidentialInstanceConfig {
5311    pub fn new() -> Self {
5312        std::default::Default::default()
5313    }
5314
5315    /// Sets the value of [enable_confidential_compute][crate::model::ConfidentialInstanceConfig::enable_confidential_compute].
5316    ///
5317    /// # Example
5318    /// ```ignore,no_run
5319    /// # use google_cloud_dataproc_v1::model::ConfidentialInstanceConfig;
5320    /// let x = ConfidentialInstanceConfig::new().set_enable_confidential_compute(true);
5321    /// ```
5322    pub fn set_enable_confidential_compute<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5323        self.enable_confidential_compute = v.into();
5324        self
5325    }
5326}
5327
5328impl wkt::message::Message for ConfidentialInstanceConfig {
5329    fn typename() -> &'static str {
5330        "type.googleapis.com/google.cloud.dataproc.v1.ConfidentialInstanceConfig"
5331    }
5332}
5333
5334/// The config settings for Compute Engine resources in
5335/// an instance group, such as a master or worker group.
5336#[derive(Clone, Default, PartialEq)]
5337#[non_exhaustive]
5338pub struct InstanceGroupConfig {
5339    /// Optional. The number of VM instances in the instance group.
5340    /// For [HA
5341    /// cluster](/dataproc/docs/concepts/configuring-clusters/high-availability)
5342    /// [master_config](#FIELDS.master_config) groups, **must be set to 3**.
5343    /// For standard cluster [master_config](#FIELDS.master_config) groups,
5344    /// **must be set to 1**.
5345    pub num_instances: i32,
5346
5347    /// Output only. The list of instance names. Dataproc derives the names
5348    /// from `cluster_name`, `num_instances`, and the instance group.
5349    pub instance_names: std::vec::Vec<std::string::String>,
5350
5351    /// Output only. List of references to Compute Engine instances.
5352    pub instance_references: std::vec::Vec<crate::model::InstanceReference>,
5353
5354    /// Optional. The Compute Engine image resource used for cluster instances.
5355    ///
5356    /// The URI can represent an image or image family.
5357    ///
5358    /// Image examples:
5359    ///
5360    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/[image-id]`
5361    /// * `projects/[project_id]/global/images/[image-id]`
5362    /// * `image-id`
5363    ///
5364    /// Image family examples. Dataproc will use the most recent
5365    /// image from the family:
5366    ///
5367    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/global/images/family/[custom-image-family-name]`
5368    /// * `projects/[project_id]/global/images/family/[custom-image-family-name]`
5369    ///
5370    /// If the URI is unspecified, it will be inferred from
5371    /// `SoftwareConfig.image_version` or the system default.
5372    pub image_uri: std::string::String,
5373
5374    /// Optional. The Compute Engine machine type used for cluster instances.
5375    ///
5376    /// A full URL, partial URI, or short name are valid. Examples:
5377    ///
5378    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5379    /// * `projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2`
5380    /// * `n1-standard-2`
5381    ///
5382    /// **Auto Zone Exception**: If you are using the Dataproc
5383    /// [Auto Zone
5384    /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
5385    /// feature, you must use the short name of the machine type
5386    /// resource, for example, `n1-standard-2`.
5387    pub machine_type_uri: std::string::String,
5388
5389    /// Optional. Disk option config settings.
5390    pub disk_config: std::option::Option<crate::model::DiskConfig>,
5391
5392    /// Output only. Specifies that this instance group contains preemptible
5393    /// instances.
5394    pub is_preemptible: bool,
5395
5396    /// Optional. Specifies the preemptibility of the instance group.
5397    ///
5398    /// The default value for master and worker groups is
5399    /// `NON_PREEMPTIBLE`. This default cannot be changed.
5400    ///
5401    /// The default value for secondary instances is
5402    /// `PREEMPTIBLE`.
5403    pub preemptibility: crate::model::instance_group_config::Preemptibility,
5404
5405    /// Output only. The config for Compute Engine Instance Group
5406    /// Manager that manages this group.
5407    /// This is only used for preemptible instance groups.
5408    pub managed_group_config: std::option::Option<crate::model::ManagedGroupConfig>,
5409
5410    /// Optional. The Compute Engine accelerator configuration for these
5411    /// instances.
5412    pub accelerators: std::vec::Vec<crate::model::AcceleratorConfig>,
5413
5414    /// Optional. Specifies the minimum cpu platform for the Instance Group.
5415    /// See [Dataproc -> Minimum CPU
5416    /// Platform](https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu).
5417    pub min_cpu_platform: std::string::String,
5418
5419    /// Optional. The minimum number of primary worker instances to create.
5420    /// If `min_num_instances` is set, cluster creation will succeed if
5421    /// the number of primary workers created is at least equal to the
5422    /// `min_num_instances` number.
5423    ///
5424    /// Example: Cluster creation request with `num_instances` = `5` and
5425    /// `min_num_instances` = `3`:
5426    ///
5427    /// * If 4 VMs are created and 1 instance fails,
5428    ///   the failed VM is deleted. The cluster is
5429    ///   resized to 4 instances and placed in a `RUNNING` state.
5430    /// * If 2 instances are created and 3 instances fail,
5431    ///   the cluster in placed in an `ERROR` state. The failed VMs
5432    ///   are not deleted.
5433    pub min_num_instances: i32,
5434
5435    /// Optional. Instance flexibility Policy allowing a mixture of VM shapes and
5436    /// provisioning models.
5437    pub instance_flexibility_policy: std::option::Option<crate::model::InstanceFlexibilityPolicy>,
5438
5439    /// Optional. Configuration to handle the startup of instances during cluster
5440    /// create and update process.
5441    pub startup_config: std::option::Option<crate::model::StartupConfig>,
5442
5443    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5444}
5445
5446impl InstanceGroupConfig {
5447    pub fn new() -> Self {
5448        std::default::Default::default()
5449    }
5450
5451    /// Sets the value of [num_instances][crate::model::InstanceGroupConfig::num_instances].
5452    ///
5453    /// # Example
5454    /// ```ignore,no_run
5455    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5456    /// let x = InstanceGroupConfig::new().set_num_instances(42);
5457    /// ```
5458    pub fn set_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5459        self.num_instances = v.into();
5460        self
5461    }
5462
5463    /// Sets the value of [instance_names][crate::model::InstanceGroupConfig::instance_names].
5464    ///
5465    /// # Example
5466    /// ```ignore,no_run
5467    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5468    /// let x = InstanceGroupConfig::new().set_instance_names(["a", "b", "c"]);
5469    /// ```
5470    pub fn set_instance_names<T, V>(mut self, v: T) -> Self
5471    where
5472        T: std::iter::IntoIterator<Item = V>,
5473        V: std::convert::Into<std::string::String>,
5474    {
5475        use std::iter::Iterator;
5476        self.instance_names = v.into_iter().map(|i| i.into()).collect();
5477        self
5478    }
5479
5480    /// Sets the value of [instance_references][crate::model::InstanceGroupConfig::instance_references].
5481    ///
5482    /// # Example
5483    /// ```ignore,no_run
5484    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5485    /// use google_cloud_dataproc_v1::model::InstanceReference;
5486    /// let x = InstanceGroupConfig::new()
5487    ///     .set_instance_references([
5488    ///         InstanceReference::default()/* use setters */,
5489    ///         InstanceReference::default()/* use (different) setters */,
5490    ///     ]);
5491    /// ```
5492    pub fn set_instance_references<T, V>(mut self, v: T) -> Self
5493    where
5494        T: std::iter::IntoIterator<Item = V>,
5495        V: std::convert::Into<crate::model::InstanceReference>,
5496    {
5497        use std::iter::Iterator;
5498        self.instance_references = v.into_iter().map(|i| i.into()).collect();
5499        self
5500    }
5501
5502    /// Sets the value of [image_uri][crate::model::InstanceGroupConfig::image_uri].
5503    ///
5504    /// # Example
5505    /// ```ignore,no_run
5506    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5507    /// let x = InstanceGroupConfig::new().set_image_uri("example");
5508    /// ```
5509    pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5510        self.image_uri = v.into();
5511        self
5512    }
5513
5514    /// Sets the value of [machine_type_uri][crate::model::InstanceGroupConfig::machine_type_uri].
5515    ///
5516    /// # Example
5517    /// ```ignore,no_run
5518    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5519    /// let x = InstanceGroupConfig::new().set_machine_type_uri("example");
5520    /// ```
5521    pub fn set_machine_type_uri<T: std::convert::Into<std::string::String>>(
5522        mut self,
5523        v: T,
5524    ) -> Self {
5525        self.machine_type_uri = v.into();
5526        self
5527    }
5528
5529    /// Sets the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5530    ///
5531    /// # Example
5532    /// ```ignore,no_run
5533    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5534    /// use google_cloud_dataproc_v1::model::DiskConfig;
5535    /// let x = InstanceGroupConfig::new().set_disk_config(DiskConfig::default()/* use setters */);
5536    /// ```
5537    pub fn set_disk_config<T>(mut self, v: T) -> Self
5538    where
5539        T: std::convert::Into<crate::model::DiskConfig>,
5540    {
5541        self.disk_config = std::option::Option::Some(v.into());
5542        self
5543    }
5544
5545    /// Sets or clears the value of [disk_config][crate::model::InstanceGroupConfig::disk_config].
5546    ///
5547    /// # Example
5548    /// ```ignore,no_run
5549    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5550    /// use google_cloud_dataproc_v1::model::DiskConfig;
5551    /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(Some(DiskConfig::default()/* use setters */));
5552    /// let x = InstanceGroupConfig::new().set_or_clear_disk_config(None::<DiskConfig>);
5553    /// ```
5554    pub fn set_or_clear_disk_config<T>(mut self, v: std::option::Option<T>) -> Self
5555    where
5556        T: std::convert::Into<crate::model::DiskConfig>,
5557    {
5558        self.disk_config = v.map(|x| x.into());
5559        self
5560    }
5561
5562    /// Sets the value of [is_preemptible][crate::model::InstanceGroupConfig::is_preemptible].
5563    ///
5564    /// # Example
5565    /// ```ignore,no_run
5566    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5567    /// let x = InstanceGroupConfig::new().set_is_preemptible(true);
5568    /// ```
5569    pub fn set_is_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5570        self.is_preemptible = v.into();
5571        self
5572    }
5573
5574    /// Sets the value of [preemptibility][crate::model::InstanceGroupConfig::preemptibility].
5575    ///
5576    /// # Example
5577    /// ```ignore,no_run
5578    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5579    /// use google_cloud_dataproc_v1::model::instance_group_config::Preemptibility;
5580    /// let x0 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::NonPreemptible);
5581    /// let x1 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Preemptible);
5582    /// let x2 = InstanceGroupConfig::new().set_preemptibility(Preemptibility::Spot);
5583    /// ```
5584    pub fn set_preemptibility<
5585        T: std::convert::Into<crate::model::instance_group_config::Preemptibility>,
5586    >(
5587        mut self,
5588        v: T,
5589    ) -> Self {
5590        self.preemptibility = v.into();
5591        self
5592    }
5593
5594    /// Sets the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5595    ///
5596    /// # Example
5597    /// ```ignore,no_run
5598    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5599    /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5600    /// let x = InstanceGroupConfig::new().set_managed_group_config(ManagedGroupConfig::default()/* use setters */);
5601    /// ```
5602    pub fn set_managed_group_config<T>(mut self, v: T) -> Self
5603    where
5604        T: std::convert::Into<crate::model::ManagedGroupConfig>,
5605    {
5606        self.managed_group_config = std::option::Option::Some(v.into());
5607        self
5608    }
5609
5610    /// Sets or clears the value of [managed_group_config][crate::model::InstanceGroupConfig::managed_group_config].
5611    ///
5612    /// # Example
5613    /// ```ignore,no_run
5614    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5615    /// use google_cloud_dataproc_v1::model::ManagedGroupConfig;
5616    /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(Some(ManagedGroupConfig::default()/* use setters */));
5617    /// let x = InstanceGroupConfig::new().set_or_clear_managed_group_config(None::<ManagedGroupConfig>);
5618    /// ```
5619    pub fn set_or_clear_managed_group_config<T>(mut self, v: std::option::Option<T>) -> Self
5620    where
5621        T: std::convert::Into<crate::model::ManagedGroupConfig>,
5622    {
5623        self.managed_group_config = v.map(|x| x.into());
5624        self
5625    }
5626
5627    /// Sets the value of [accelerators][crate::model::InstanceGroupConfig::accelerators].
5628    ///
5629    /// # Example
5630    /// ```ignore,no_run
5631    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5632    /// use google_cloud_dataproc_v1::model::AcceleratorConfig;
5633    /// let x = InstanceGroupConfig::new()
5634    ///     .set_accelerators([
5635    ///         AcceleratorConfig::default()/* use setters */,
5636    ///         AcceleratorConfig::default()/* use (different) setters */,
5637    ///     ]);
5638    /// ```
5639    pub fn set_accelerators<T, V>(mut self, v: T) -> Self
5640    where
5641        T: std::iter::IntoIterator<Item = V>,
5642        V: std::convert::Into<crate::model::AcceleratorConfig>,
5643    {
5644        use std::iter::Iterator;
5645        self.accelerators = v.into_iter().map(|i| i.into()).collect();
5646        self
5647    }
5648
5649    /// Sets the value of [min_cpu_platform][crate::model::InstanceGroupConfig::min_cpu_platform].
5650    ///
5651    /// # Example
5652    /// ```ignore,no_run
5653    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5654    /// let x = InstanceGroupConfig::new().set_min_cpu_platform("example");
5655    /// ```
5656    pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
5657        mut self,
5658        v: T,
5659    ) -> Self {
5660        self.min_cpu_platform = v.into();
5661        self
5662    }
5663
5664    /// Sets the value of [min_num_instances][crate::model::InstanceGroupConfig::min_num_instances].
5665    ///
5666    /// # Example
5667    /// ```ignore,no_run
5668    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5669    /// let x = InstanceGroupConfig::new().set_min_num_instances(42);
5670    /// ```
5671    pub fn set_min_num_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5672        self.min_num_instances = v.into();
5673        self
5674    }
5675
5676    /// Sets the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5677    ///
5678    /// # Example
5679    /// ```ignore,no_run
5680    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5681    /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5682    /// let x = InstanceGroupConfig::new().set_instance_flexibility_policy(InstanceFlexibilityPolicy::default()/* use setters */);
5683    /// ```
5684    pub fn set_instance_flexibility_policy<T>(mut self, v: T) -> Self
5685    where
5686        T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5687    {
5688        self.instance_flexibility_policy = std::option::Option::Some(v.into());
5689        self
5690    }
5691
5692    /// Sets or clears the value of [instance_flexibility_policy][crate::model::InstanceGroupConfig::instance_flexibility_policy].
5693    ///
5694    /// # Example
5695    /// ```ignore,no_run
5696    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5697    /// use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
5698    /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(Some(InstanceFlexibilityPolicy::default()/* use setters */));
5699    /// let x = InstanceGroupConfig::new().set_or_clear_instance_flexibility_policy(None::<InstanceFlexibilityPolicy>);
5700    /// ```
5701    pub fn set_or_clear_instance_flexibility_policy<T>(mut self, v: std::option::Option<T>) -> Self
5702    where
5703        T: std::convert::Into<crate::model::InstanceFlexibilityPolicy>,
5704    {
5705        self.instance_flexibility_policy = v.map(|x| x.into());
5706        self
5707    }
5708
5709    /// Sets the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5710    ///
5711    /// # Example
5712    /// ```ignore,no_run
5713    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5714    /// use google_cloud_dataproc_v1::model::StartupConfig;
5715    /// let x = InstanceGroupConfig::new().set_startup_config(StartupConfig::default()/* use setters */);
5716    /// ```
5717    pub fn set_startup_config<T>(mut self, v: T) -> Self
5718    where
5719        T: std::convert::Into<crate::model::StartupConfig>,
5720    {
5721        self.startup_config = std::option::Option::Some(v.into());
5722        self
5723    }
5724
5725    /// Sets or clears the value of [startup_config][crate::model::InstanceGroupConfig::startup_config].
5726    ///
5727    /// # Example
5728    /// ```ignore,no_run
5729    /// # use google_cloud_dataproc_v1::model::InstanceGroupConfig;
5730    /// use google_cloud_dataproc_v1::model::StartupConfig;
5731    /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(Some(StartupConfig::default()/* use setters */));
5732    /// let x = InstanceGroupConfig::new().set_or_clear_startup_config(None::<StartupConfig>);
5733    /// ```
5734    pub fn set_or_clear_startup_config<T>(mut self, v: std::option::Option<T>) -> Self
5735    where
5736        T: std::convert::Into<crate::model::StartupConfig>,
5737    {
5738        self.startup_config = v.map(|x| x.into());
5739        self
5740    }
5741}
5742
5743impl wkt::message::Message for InstanceGroupConfig {
5744    fn typename() -> &'static str {
5745        "type.googleapis.com/google.cloud.dataproc.v1.InstanceGroupConfig"
5746    }
5747}
5748
5749/// Defines additional types related to [InstanceGroupConfig].
5750pub mod instance_group_config {
5751    #[allow(unused_imports)]
5752    use super::*;
5753
5754    /// Controls the use of preemptible instances within the group.
5755    ///
5756    /// # Working with unknown values
5757    ///
5758    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5759    /// additional enum variants at any time. Adding new variants is not considered
5760    /// a breaking change. Applications should write their code in anticipation of:
5761    ///
5762    /// - New values appearing in future releases of the client library, **and**
5763    /// - New values received dynamically, without application changes.
5764    ///
5765    /// Please consult the [Working with enums] section in the user guide for some
5766    /// guidelines.
5767    ///
5768    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5769    #[derive(Clone, Debug, PartialEq)]
5770    #[non_exhaustive]
5771    pub enum Preemptibility {
5772        /// Preemptibility is unspecified, the system will choose the
5773        /// appropriate setting for each instance group.
5774        Unspecified,
5775        /// Instances are non-preemptible.
5776        ///
5777        /// This option is allowed for all instance groups and is the only valid
5778        /// value for Master and Worker instance groups.
5779        NonPreemptible,
5780        /// Instances are [preemptible]
5781        /// (<https://cloud.google.com/compute/docs/instances/preemptible>).
5782        ///
5783        /// This option is allowed only for [secondary worker]
5784        /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5785        /// groups.
5786        Preemptible,
5787        /// Instances are [Spot VMs]
5788        /// (<https://cloud.google.com/compute/docs/instances/spot>).
5789        ///
5790        /// This option is allowed only for [secondary worker]
5791        /// (<https://cloud.google.com/dataproc/docs/concepts/compute/secondary-vms>)
5792        /// groups. Spot VMs are the latest version of [preemptible VMs]
5793        /// (<https://cloud.google.com/compute/docs/instances/preemptible>), and
5794        /// provide additional features.
5795        Spot,
5796        /// If set, the enum was initialized with an unknown value.
5797        ///
5798        /// Applications can examine the value using [Preemptibility::value] or
5799        /// [Preemptibility::name].
5800        UnknownValue(preemptibility::UnknownValue),
5801    }
5802
5803    #[doc(hidden)]
5804    pub mod preemptibility {
5805        #[allow(unused_imports)]
5806        use super::*;
5807        #[derive(Clone, Debug, PartialEq)]
5808        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5809    }
5810
5811    impl Preemptibility {
5812        /// Gets the enum value.
5813        ///
5814        /// Returns `None` if the enum contains an unknown value deserialized from
5815        /// the string representation of enums.
5816        pub fn value(&self) -> std::option::Option<i32> {
5817            match self {
5818                Self::Unspecified => std::option::Option::Some(0),
5819                Self::NonPreemptible => std::option::Option::Some(1),
5820                Self::Preemptible => std::option::Option::Some(2),
5821                Self::Spot => std::option::Option::Some(3),
5822                Self::UnknownValue(u) => u.0.value(),
5823            }
5824        }
5825
5826        /// Gets the enum value as a string.
5827        ///
5828        /// Returns `None` if the enum contains an unknown value deserialized from
5829        /// the integer representation of enums.
5830        pub fn name(&self) -> std::option::Option<&str> {
5831            match self {
5832                Self::Unspecified => std::option::Option::Some("PREEMPTIBILITY_UNSPECIFIED"),
5833                Self::NonPreemptible => std::option::Option::Some("NON_PREEMPTIBLE"),
5834                Self::Preemptible => std::option::Option::Some("PREEMPTIBLE"),
5835                Self::Spot => std::option::Option::Some("SPOT"),
5836                Self::UnknownValue(u) => u.0.name(),
5837            }
5838        }
5839    }
5840
5841    impl std::default::Default for Preemptibility {
5842        fn default() -> Self {
5843            use std::convert::From;
5844            Self::from(0)
5845        }
5846    }
5847
5848    impl std::fmt::Display for Preemptibility {
5849        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5850            wkt::internal::display_enum(f, self.name(), self.value())
5851        }
5852    }
5853
5854    impl std::convert::From<i32> for Preemptibility {
5855        fn from(value: i32) -> Self {
5856            match value {
5857                0 => Self::Unspecified,
5858                1 => Self::NonPreemptible,
5859                2 => Self::Preemptible,
5860                3 => Self::Spot,
5861                _ => Self::UnknownValue(preemptibility::UnknownValue(
5862                    wkt::internal::UnknownEnumValue::Integer(value),
5863                )),
5864            }
5865        }
5866    }
5867
5868    impl std::convert::From<&str> for Preemptibility {
5869        fn from(value: &str) -> Self {
5870            use std::string::ToString;
5871            match value {
5872                "PREEMPTIBILITY_UNSPECIFIED" => Self::Unspecified,
5873                "NON_PREEMPTIBLE" => Self::NonPreemptible,
5874                "PREEMPTIBLE" => Self::Preemptible,
5875                "SPOT" => Self::Spot,
5876                _ => Self::UnknownValue(preemptibility::UnknownValue(
5877                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5878                )),
5879            }
5880        }
5881    }
5882
5883    impl serde::ser::Serialize for Preemptibility {
5884        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5885        where
5886            S: serde::Serializer,
5887        {
5888            match self {
5889                Self::Unspecified => serializer.serialize_i32(0),
5890                Self::NonPreemptible => serializer.serialize_i32(1),
5891                Self::Preemptible => serializer.serialize_i32(2),
5892                Self::Spot => serializer.serialize_i32(3),
5893                Self::UnknownValue(u) => u.0.serialize(serializer),
5894            }
5895        }
5896    }
5897
5898    impl<'de> serde::de::Deserialize<'de> for Preemptibility {
5899        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5900        where
5901            D: serde::Deserializer<'de>,
5902        {
5903            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Preemptibility>::new(
5904                ".google.cloud.dataproc.v1.InstanceGroupConfig.Preemptibility",
5905            ))
5906        }
5907    }
5908}
5909
5910/// Configuration to handle the startup of instances during cluster create and
5911/// update process.
5912#[derive(Clone, Default, PartialEq)]
5913#[non_exhaustive]
5914pub struct StartupConfig {
5915    /// Optional. The config setting to enable cluster creation/ updation to be
5916    /// successful only after required_registration_fraction of instances are up
5917    /// and running. This configuration is applicable to only secondary workers for
5918    /// now. The cluster will fail if required_registration_fraction of instances
5919    /// are not available. This will include instance creation, agent registration,
5920    /// and service registration (if enabled).
5921    pub required_registration_fraction: std::option::Option<f64>,
5922
5923    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5924}
5925
5926impl StartupConfig {
5927    pub fn new() -> Self {
5928        std::default::Default::default()
5929    }
5930
5931    /// Sets the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
5932    ///
5933    /// # Example
5934    /// ```ignore,no_run
5935    /// # use google_cloud_dataproc_v1::model::StartupConfig;
5936    /// let x = StartupConfig::new().set_required_registration_fraction(42.0);
5937    /// ```
5938    pub fn set_required_registration_fraction<T>(mut self, v: T) -> Self
5939    where
5940        T: std::convert::Into<f64>,
5941    {
5942        self.required_registration_fraction = std::option::Option::Some(v.into());
5943        self
5944    }
5945
5946    /// Sets or clears the value of [required_registration_fraction][crate::model::StartupConfig::required_registration_fraction].
5947    ///
5948    /// # Example
5949    /// ```ignore,no_run
5950    /// # use google_cloud_dataproc_v1::model::StartupConfig;
5951    /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(Some(42.0));
5952    /// let x = StartupConfig::new().set_or_clear_required_registration_fraction(None::<f32>);
5953    /// ```
5954    pub fn set_or_clear_required_registration_fraction<T>(
5955        mut self,
5956        v: std::option::Option<T>,
5957    ) -> Self
5958    where
5959        T: std::convert::Into<f64>,
5960    {
5961        self.required_registration_fraction = v.map(|x| x.into());
5962        self
5963    }
5964}
5965
5966impl wkt::message::Message for StartupConfig {
5967    fn typename() -> &'static str {
5968        "type.googleapis.com/google.cloud.dataproc.v1.StartupConfig"
5969    }
5970}
5971
5972/// A reference to a Compute Engine instance.
5973#[derive(Clone, Default, PartialEq)]
5974#[non_exhaustive]
5975pub struct InstanceReference {
5976    /// The user-friendly name of the Compute Engine instance.
5977    pub instance_name: std::string::String,
5978
5979    /// The unique identifier of the Compute Engine instance.
5980    pub instance_id: std::string::String,
5981
5982    /// The public RSA key used for sharing data with this instance.
5983    pub public_key: std::string::String,
5984
5985    /// The public ECIES key used for sharing data with this instance.
5986    pub public_ecies_key: std::string::String,
5987
5988    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5989}
5990
5991impl InstanceReference {
5992    pub fn new() -> Self {
5993        std::default::Default::default()
5994    }
5995
5996    /// Sets the value of [instance_name][crate::model::InstanceReference::instance_name].
5997    ///
5998    /// # Example
5999    /// ```ignore,no_run
6000    /// # use google_cloud_dataproc_v1::model::InstanceReference;
6001    /// let x = InstanceReference::new().set_instance_name("example");
6002    /// ```
6003    pub fn set_instance_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6004        self.instance_name = v.into();
6005        self
6006    }
6007
6008    /// Sets the value of [instance_id][crate::model::InstanceReference::instance_id].
6009    ///
6010    /// # Example
6011    /// ```ignore,no_run
6012    /// # use google_cloud_dataproc_v1::model::InstanceReference;
6013    /// let x = InstanceReference::new().set_instance_id("example");
6014    /// ```
6015    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6016        self.instance_id = v.into();
6017        self
6018    }
6019
6020    /// Sets the value of [public_key][crate::model::InstanceReference::public_key].
6021    ///
6022    /// # Example
6023    /// ```ignore,no_run
6024    /// # use google_cloud_dataproc_v1::model::InstanceReference;
6025    /// let x = InstanceReference::new().set_public_key("example");
6026    /// ```
6027    pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6028        self.public_key = v.into();
6029        self
6030    }
6031
6032    /// Sets the value of [public_ecies_key][crate::model::InstanceReference::public_ecies_key].
6033    ///
6034    /// # Example
6035    /// ```ignore,no_run
6036    /// # use google_cloud_dataproc_v1::model::InstanceReference;
6037    /// let x = InstanceReference::new().set_public_ecies_key("example");
6038    /// ```
6039    pub fn set_public_ecies_key<T: std::convert::Into<std::string::String>>(
6040        mut self,
6041        v: T,
6042    ) -> Self {
6043        self.public_ecies_key = v.into();
6044        self
6045    }
6046}
6047
6048impl wkt::message::Message for InstanceReference {
6049    fn typename() -> &'static str {
6050        "type.googleapis.com/google.cloud.dataproc.v1.InstanceReference"
6051    }
6052}
6053
6054/// Specifies the resources used to actively manage an instance group.
6055#[derive(Clone, Default, PartialEq)]
6056#[non_exhaustive]
6057pub struct ManagedGroupConfig {
6058    /// Output only. The name of the Instance Template used for the Managed
6059    /// Instance Group.
6060    pub instance_template_name: std::string::String,
6061
6062    /// Output only. The name of the Instance Group Manager for this group.
6063    pub instance_group_manager_name: std::string::String,
6064
6065    /// Output only. The partial URI to the instance group manager for this group.
6066    /// E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm.
6067    pub instance_group_manager_uri: std::string::String,
6068
6069    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6070}
6071
6072impl ManagedGroupConfig {
6073    pub fn new() -> Self {
6074        std::default::Default::default()
6075    }
6076
6077    /// Sets the value of [instance_template_name][crate::model::ManagedGroupConfig::instance_template_name].
6078    ///
6079    /// # Example
6080    /// ```ignore,no_run
6081    /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6082    /// let x = ManagedGroupConfig::new().set_instance_template_name("example");
6083    /// ```
6084    pub fn set_instance_template_name<T: std::convert::Into<std::string::String>>(
6085        mut self,
6086        v: T,
6087    ) -> Self {
6088        self.instance_template_name = v.into();
6089        self
6090    }
6091
6092    /// Sets the value of [instance_group_manager_name][crate::model::ManagedGroupConfig::instance_group_manager_name].
6093    ///
6094    /// # Example
6095    /// ```ignore,no_run
6096    /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6097    /// let x = ManagedGroupConfig::new().set_instance_group_manager_name("example");
6098    /// ```
6099    pub fn set_instance_group_manager_name<T: std::convert::Into<std::string::String>>(
6100        mut self,
6101        v: T,
6102    ) -> Self {
6103        self.instance_group_manager_name = v.into();
6104        self
6105    }
6106
6107    /// Sets the value of [instance_group_manager_uri][crate::model::ManagedGroupConfig::instance_group_manager_uri].
6108    ///
6109    /// # Example
6110    /// ```ignore,no_run
6111    /// # use google_cloud_dataproc_v1::model::ManagedGroupConfig;
6112    /// let x = ManagedGroupConfig::new().set_instance_group_manager_uri("example");
6113    /// ```
6114    pub fn set_instance_group_manager_uri<T: std::convert::Into<std::string::String>>(
6115        mut self,
6116        v: T,
6117    ) -> Self {
6118        self.instance_group_manager_uri = v.into();
6119        self
6120    }
6121}
6122
6123impl wkt::message::Message for ManagedGroupConfig {
6124    fn typename() -> &'static str {
6125        "type.googleapis.com/google.cloud.dataproc.v1.ManagedGroupConfig"
6126    }
6127}
6128
6129/// Instance flexibility Policy allowing a mixture of VM shapes and provisioning
6130/// models.
6131#[derive(Clone, Default, PartialEq)]
6132#[non_exhaustive]
6133pub struct InstanceFlexibilityPolicy {
6134    /// Optional. Defines how the Group selects the provisioning model to ensure
6135    /// required reliability.
6136    pub provisioning_model_mix:
6137        std::option::Option<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6138
6139    /// Optional. List of instance selection options that the group will use when
6140    /// creating new VMs.
6141    pub instance_selection_list:
6142        std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelection>,
6143
6144    /// Output only. A list of instance selection results in the group.
6145    pub instance_selection_results:
6146        std::vec::Vec<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6147
6148    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6149}
6150
6151impl InstanceFlexibilityPolicy {
6152    pub fn new() -> Self {
6153        std::default::Default::default()
6154    }
6155
6156    /// Sets the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6157    ///
6158    /// # Example
6159    /// ```ignore,no_run
6160    /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6161    /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6162    /// let x = InstanceFlexibilityPolicy::new().set_provisioning_model_mix(ProvisioningModelMix::default()/* use setters */);
6163    /// ```
6164    pub fn set_provisioning_model_mix<T>(mut self, v: T) -> Self
6165    where
6166        T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6167    {
6168        self.provisioning_model_mix = std::option::Option::Some(v.into());
6169        self
6170    }
6171
6172    /// Sets or clears the value of [provisioning_model_mix][crate::model::InstanceFlexibilityPolicy::provisioning_model_mix].
6173    ///
6174    /// # Example
6175    /// ```ignore,no_run
6176    /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6177    /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6178    /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(Some(ProvisioningModelMix::default()/* use setters */));
6179    /// let x = InstanceFlexibilityPolicy::new().set_or_clear_provisioning_model_mix(None::<ProvisioningModelMix>);
6180    /// ```
6181    pub fn set_or_clear_provisioning_model_mix<T>(mut self, v: std::option::Option<T>) -> Self
6182    where
6183        T: std::convert::Into<crate::model::instance_flexibility_policy::ProvisioningModelMix>,
6184    {
6185        self.provisioning_model_mix = v.map(|x| x.into());
6186        self
6187    }
6188
6189    /// Sets the value of [instance_selection_list][crate::model::InstanceFlexibilityPolicy::instance_selection_list].
6190    ///
6191    /// # Example
6192    /// ```ignore,no_run
6193    /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6194    /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6195    /// let x = InstanceFlexibilityPolicy::new()
6196    ///     .set_instance_selection_list([
6197    ///         InstanceSelection::default()/* use setters */,
6198    ///         InstanceSelection::default()/* use (different) setters */,
6199    ///     ]);
6200    /// ```
6201    pub fn set_instance_selection_list<T, V>(mut self, v: T) -> Self
6202    where
6203        T: std::iter::IntoIterator<Item = V>,
6204        V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelection>,
6205    {
6206        use std::iter::Iterator;
6207        self.instance_selection_list = v.into_iter().map(|i| i.into()).collect();
6208        self
6209    }
6210
6211    /// Sets the value of [instance_selection_results][crate::model::InstanceFlexibilityPolicy::instance_selection_results].
6212    ///
6213    /// # Example
6214    /// ```ignore,no_run
6215    /// # use google_cloud_dataproc_v1::model::InstanceFlexibilityPolicy;
6216    /// use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6217    /// let x = InstanceFlexibilityPolicy::new()
6218    ///     .set_instance_selection_results([
6219    ///         InstanceSelectionResult::default()/* use setters */,
6220    ///         InstanceSelectionResult::default()/* use (different) setters */,
6221    ///     ]);
6222    /// ```
6223    pub fn set_instance_selection_results<T, V>(mut self, v: T) -> Self
6224    where
6225        T: std::iter::IntoIterator<Item = V>,
6226        V: std::convert::Into<crate::model::instance_flexibility_policy::InstanceSelectionResult>,
6227    {
6228        use std::iter::Iterator;
6229        self.instance_selection_results = v.into_iter().map(|i| i.into()).collect();
6230        self
6231    }
6232}
6233
6234impl wkt::message::Message for InstanceFlexibilityPolicy {
6235    fn typename() -> &'static str {
6236        "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy"
6237    }
6238}
6239
6240/// Defines additional types related to [InstanceFlexibilityPolicy].
6241pub mod instance_flexibility_policy {
6242    #[allow(unused_imports)]
6243    use super::*;
6244
6245    /// Defines how Dataproc should create VMs with a mixture of provisioning
6246    /// models.
6247    #[derive(Clone, Default, PartialEq)]
6248    #[non_exhaustive]
6249    pub struct ProvisioningModelMix {
6250        /// Optional. The base capacity that will always use Standard VMs to avoid
6251        /// risk of more preemption than the minimum capacity you need. Dataproc will
6252        /// create only standard VMs until it reaches standard_capacity_base, then it
6253        /// will start using standard_capacity_percent_above_base to mix Spot with
6254        /// Standard VMs. eg. If 15 instances are requested and
6255        /// standard_capacity_base is 5, Dataproc will create 5 standard VMs and then
6256        /// start mixing spot and standard VMs for remaining 10 instances.
6257        pub standard_capacity_base: std::option::Option<i32>,
6258
6259        /// Optional. The percentage of target capacity that should use Standard VM.
6260        /// The remaining percentage will use Spot VMs. The percentage applies only
6261        /// to the capacity above standard_capacity_base. eg. If 15 instances are
6262        /// requested and standard_capacity_base is 5 and
6263        /// standard_capacity_percent_above_base is 30, Dataproc will create 5
6264        /// standard VMs and then start mixing spot and standard VMs for remaining 10
6265        /// instances. The mix will be 30% standard and 70% spot.
6266        pub standard_capacity_percent_above_base: std::option::Option<i32>,
6267
6268        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6269    }
6270
6271    impl ProvisioningModelMix {
6272        pub fn new() -> Self {
6273            std::default::Default::default()
6274        }
6275
6276        /// Sets the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6277        ///
6278        /// # Example
6279        /// ```ignore,no_run
6280        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6281        /// let x = ProvisioningModelMix::new().set_standard_capacity_base(42);
6282        /// ```
6283        pub fn set_standard_capacity_base<T>(mut self, v: T) -> Self
6284        where
6285            T: std::convert::Into<i32>,
6286        {
6287            self.standard_capacity_base = std::option::Option::Some(v.into());
6288            self
6289        }
6290
6291        /// Sets or clears the value of [standard_capacity_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_base].
6292        ///
6293        /// # Example
6294        /// ```ignore,no_run
6295        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6296        /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(Some(42));
6297        /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_base(None::<i32>);
6298        /// ```
6299        pub fn set_or_clear_standard_capacity_base<T>(mut self, v: std::option::Option<T>) -> Self
6300        where
6301            T: std::convert::Into<i32>,
6302        {
6303            self.standard_capacity_base = v.map(|x| x.into());
6304            self
6305        }
6306
6307        /// Sets the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6308        ///
6309        /// # Example
6310        /// ```ignore,no_run
6311        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6312        /// let x = ProvisioningModelMix::new().set_standard_capacity_percent_above_base(42);
6313        /// ```
6314        pub fn set_standard_capacity_percent_above_base<T>(mut self, v: T) -> Self
6315        where
6316            T: std::convert::Into<i32>,
6317        {
6318            self.standard_capacity_percent_above_base = std::option::Option::Some(v.into());
6319            self
6320        }
6321
6322        /// Sets or clears the value of [standard_capacity_percent_above_base][crate::model::instance_flexibility_policy::ProvisioningModelMix::standard_capacity_percent_above_base].
6323        ///
6324        /// # Example
6325        /// ```ignore,no_run
6326        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::ProvisioningModelMix;
6327        /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(Some(42));
6328        /// let x = ProvisioningModelMix::new().set_or_clear_standard_capacity_percent_above_base(None::<i32>);
6329        /// ```
6330        pub fn set_or_clear_standard_capacity_percent_above_base<T>(
6331            mut self,
6332            v: std::option::Option<T>,
6333        ) -> Self
6334        where
6335            T: std::convert::Into<i32>,
6336        {
6337            self.standard_capacity_percent_above_base = v.map(|x| x.into());
6338            self
6339        }
6340    }
6341
6342    impl wkt::message::Message for ProvisioningModelMix {
6343        fn typename() -> &'static str {
6344            "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.ProvisioningModelMix"
6345        }
6346    }
6347
6348    /// Defines machines types and a rank to which the machines types belong.
6349    #[derive(Clone, Default, PartialEq)]
6350    #[non_exhaustive]
6351    pub struct InstanceSelection {
6352        /// Optional. Full machine-type names, e.g. "n1-standard-16".
6353        pub machine_types: std::vec::Vec<std::string::String>,
6354
6355        /// Optional. Preference of this instance selection. Lower number means
6356        /// higher preference. Dataproc will first try to create a VM based on the
6357        /// machine-type with priority rank and fallback to next rank based on
6358        /// availability. Machine types and instance selections with the same
6359        /// priority have the same preference.
6360        pub rank: i32,
6361
6362        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6363    }
6364
6365    impl InstanceSelection {
6366        pub fn new() -> Self {
6367            std::default::Default::default()
6368        }
6369
6370        /// Sets the value of [machine_types][crate::model::instance_flexibility_policy::InstanceSelection::machine_types].
6371        ///
6372        /// # Example
6373        /// ```ignore,no_run
6374        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6375        /// let x = InstanceSelection::new().set_machine_types(["a", "b", "c"]);
6376        /// ```
6377        pub fn set_machine_types<T, V>(mut self, v: T) -> Self
6378        where
6379            T: std::iter::IntoIterator<Item = V>,
6380            V: std::convert::Into<std::string::String>,
6381        {
6382            use std::iter::Iterator;
6383            self.machine_types = v.into_iter().map(|i| i.into()).collect();
6384            self
6385        }
6386
6387        /// Sets the value of [rank][crate::model::instance_flexibility_policy::InstanceSelection::rank].
6388        ///
6389        /// # Example
6390        /// ```ignore,no_run
6391        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelection;
6392        /// let x = InstanceSelection::new().set_rank(42);
6393        /// ```
6394        pub fn set_rank<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6395            self.rank = v.into();
6396            self
6397        }
6398    }
6399
6400    impl wkt::message::Message for InstanceSelection {
6401        fn typename() -> &'static str {
6402            "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelection"
6403        }
6404    }
6405
6406    /// Defines a mapping from machine types to the number of VMs that are created
6407    /// with each machine type.
6408    #[derive(Clone, Default, PartialEq)]
6409    #[non_exhaustive]
6410    pub struct InstanceSelectionResult {
6411        /// Output only. Full machine-type names, e.g. "n1-standard-16".
6412        pub machine_type: std::option::Option<std::string::String>,
6413
6414        /// Output only. Number of VM provisioned with the machine_type.
6415        pub vm_count: std::option::Option<i32>,
6416
6417        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6418    }
6419
6420    impl InstanceSelectionResult {
6421        pub fn new() -> Self {
6422            std::default::Default::default()
6423        }
6424
6425        /// Sets the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6426        ///
6427        /// # Example
6428        /// ```ignore,no_run
6429        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6430        /// let x = InstanceSelectionResult::new().set_machine_type("example");
6431        /// ```
6432        pub fn set_machine_type<T>(mut self, v: T) -> Self
6433        where
6434            T: std::convert::Into<std::string::String>,
6435        {
6436            self.machine_type = std::option::Option::Some(v.into());
6437            self
6438        }
6439
6440        /// Sets or clears the value of [machine_type][crate::model::instance_flexibility_policy::InstanceSelectionResult::machine_type].
6441        ///
6442        /// # Example
6443        /// ```ignore,no_run
6444        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6445        /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(Some("example"));
6446        /// let x = InstanceSelectionResult::new().set_or_clear_machine_type(None::<String>);
6447        /// ```
6448        pub fn set_or_clear_machine_type<T>(mut self, v: std::option::Option<T>) -> Self
6449        where
6450            T: std::convert::Into<std::string::String>,
6451        {
6452            self.machine_type = v.map(|x| x.into());
6453            self
6454        }
6455
6456        /// Sets the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6457        ///
6458        /// # Example
6459        /// ```ignore,no_run
6460        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6461        /// let x = InstanceSelectionResult::new().set_vm_count(42);
6462        /// ```
6463        pub fn set_vm_count<T>(mut self, v: T) -> Self
6464        where
6465            T: std::convert::Into<i32>,
6466        {
6467            self.vm_count = std::option::Option::Some(v.into());
6468            self
6469        }
6470
6471        /// Sets or clears the value of [vm_count][crate::model::instance_flexibility_policy::InstanceSelectionResult::vm_count].
6472        ///
6473        /// # Example
6474        /// ```ignore,no_run
6475        /// # use google_cloud_dataproc_v1::model::instance_flexibility_policy::InstanceSelectionResult;
6476        /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(Some(42));
6477        /// let x = InstanceSelectionResult::new().set_or_clear_vm_count(None::<i32>);
6478        /// ```
6479        pub fn set_or_clear_vm_count<T>(mut self, v: std::option::Option<T>) -> Self
6480        where
6481            T: std::convert::Into<i32>,
6482        {
6483            self.vm_count = v.map(|x| x.into());
6484            self
6485        }
6486    }
6487
6488    impl wkt::message::Message for InstanceSelectionResult {
6489        fn typename() -> &'static str {
6490            "type.googleapis.com/google.cloud.dataproc.v1.InstanceFlexibilityPolicy.InstanceSelectionResult"
6491        }
6492    }
6493}
6494
6495/// Specifies the type and number of accelerator cards attached to the instances
6496/// of an instance. See [GPUs on Compute
6497/// Engine](https://cloud.google.com/compute/docs/gpus/).
6498#[derive(Clone, Default, PartialEq)]
6499#[non_exhaustive]
6500pub struct AcceleratorConfig {
6501    /// Full URL, partial URI, or short name of the accelerator type resource to
6502    /// expose to this instance. See
6503    /// [Compute Engine
6504    /// AcceleratorTypes](https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes).
6505    ///
6506    /// Examples:
6507    ///
6508    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6509    /// * `projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4`
6510    /// * `nvidia-tesla-t4`
6511    ///
6512    /// **Auto Zone Exception**: If you are using the Dataproc
6513    /// [Auto Zone
6514    /// Placement](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement)
6515    /// feature, you must use the short name of the accelerator type
6516    /// resource, for example, `nvidia-tesla-t4`.
6517    pub accelerator_type_uri: std::string::String,
6518
6519    /// The number of the accelerator cards of this type exposed to this instance.
6520    pub accelerator_count: i32,
6521
6522    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6523}
6524
6525impl AcceleratorConfig {
6526    pub fn new() -> Self {
6527        std::default::Default::default()
6528    }
6529
6530    /// Sets the value of [accelerator_type_uri][crate::model::AcceleratorConfig::accelerator_type_uri].
6531    ///
6532    /// # Example
6533    /// ```ignore,no_run
6534    /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6535    /// let x = AcceleratorConfig::new().set_accelerator_type_uri("example");
6536    /// ```
6537    pub fn set_accelerator_type_uri<T: std::convert::Into<std::string::String>>(
6538        mut self,
6539        v: T,
6540    ) -> Self {
6541        self.accelerator_type_uri = v.into();
6542        self
6543    }
6544
6545    /// Sets the value of [accelerator_count][crate::model::AcceleratorConfig::accelerator_count].
6546    ///
6547    /// # Example
6548    /// ```ignore,no_run
6549    /// # use google_cloud_dataproc_v1::model::AcceleratorConfig;
6550    /// let x = AcceleratorConfig::new().set_accelerator_count(42);
6551    /// ```
6552    pub fn set_accelerator_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6553        self.accelerator_count = v.into();
6554        self
6555    }
6556}
6557
6558impl wkt::message::Message for AcceleratorConfig {
6559    fn typename() -> &'static str {
6560        "type.googleapis.com/google.cloud.dataproc.v1.AcceleratorConfig"
6561    }
6562}
6563
6564/// Specifies the config of disk options for a group of VM instances.
6565#[derive(Clone, Default, PartialEq)]
6566#[non_exhaustive]
6567pub struct DiskConfig {
6568    /// Optional. Type of the boot disk (default is "pd-standard").
6569    /// Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive),
6570    /// "pd-ssd" (Persistent Disk Solid State Drive),
6571    /// or "pd-standard" (Persistent Disk Hard Disk Drive).
6572    /// See [Disk types](https://cloud.google.com/compute/docs/disks#disk-types).
6573    pub boot_disk_type: std::string::String,
6574
6575    /// Optional. Size in GB of the boot disk (default is 500GB).
6576    pub boot_disk_size_gb: i32,
6577
6578    /// Optional. Number of attached SSDs, from 0 to 8 (default is 0).
6579    /// If SSDs are not attached, the boot disk is used to store runtime logs and
6580    /// [HDFS](https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data.
6581    /// If one or more SSDs are attached, this runtime bulk
6582    /// data is spread across them, and the boot disk contains only basic
6583    /// config and installed binaries.
6584    ///
6585    /// Note: Local SSD options may vary by machine type and number of vCPUs
6586    /// selected.
6587    pub num_local_ssds: i32,
6588
6589    /// Optional. Interface type of local SSDs (default is "scsi").
6590    /// Valid values: "scsi" (Small Computer System Interface),
6591    /// "nvme" (Non-Volatile Memory Express).
6592    /// See [local SSD
6593    /// performance](https://cloud.google.com/compute/docs/disks/local-ssd#performance).
6594    pub local_ssd_interface: std::string::String,
6595
6596    /// Optional. Indicates how many IOPS to provision for the disk. This sets the
6597    /// number of I/O operations per second that the disk can handle. Note: This
6598    /// field is only supported if boot_disk_type is hyperdisk-balanced.
6599    pub boot_disk_provisioned_iops: std::option::Option<i64>,
6600
6601    /// Optional. Indicates how much throughput to provision for the disk. This
6602    /// sets the number of throughput mb per second that the disk can handle.
6603    /// Values must be greater than or equal to 1. Note: This field is only
6604    /// supported if boot_disk_type is hyperdisk-balanced.
6605    pub boot_disk_provisioned_throughput: std::option::Option<i64>,
6606
6607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6608}
6609
6610impl DiskConfig {
6611    pub fn new() -> Self {
6612        std::default::Default::default()
6613    }
6614
6615    /// Sets the value of [boot_disk_type][crate::model::DiskConfig::boot_disk_type].
6616    ///
6617    /// # Example
6618    /// ```ignore,no_run
6619    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6620    /// let x = DiskConfig::new().set_boot_disk_type("example");
6621    /// ```
6622    pub fn set_boot_disk_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6623        self.boot_disk_type = v.into();
6624        self
6625    }
6626
6627    /// Sets the value of [boot_disk_size_gb][crate::model::DiskConfig::boot_disk_size_gb].
6628    ///
6629    /// # Example
6630    /// ```ignore,no_run
6631    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6632    /// let x = DiskConfig::new().set_boot_disk_size_gb(42);
6633    /// ```
6634    pub fn set_boot_disk_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6635        self.boot_disk_size_gb = v.into();
6636        self
6637    }
6638
6639    /// Sets the value of [num_local_ssds][crate::model::DiskConfig::num_local_ssds].
6640    ///
6641    /// # Example
6642    /// ```ignore,no_run
6643    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6644    /// let x = DiskConfig::new().set_num_local_ssds(42);
6645    /// ```
6646    pub fn set_num_local_ssds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6647        self.num_local_ssds = v.into();
6648        self
6649    }
6650
6651    /// Sets the value of [local_ssd_interface][crate::model::DiskConfig::local_ssd_interface].
6652    ///
6653    /// # Example
6654    /// ```ignore,no_run
6655    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6656    /// let x = DiskConfig::new().set_local_ssd_interface("example");
6657    /// ```
6658    pub fn set_local_ssd_interface<T: std::convert::Into<std::string::String>>(
6659        mut self,
6660        v: T,
6661    ) -> Self {
6662        self.local_ssd_interface = v.into();
6663        self
6664    }
6665
6666    /// Sets the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6667    ///
6668    /// # Example
6669    /// ```ignore,no_run
6670    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6671    /// let x = DiskConfig::new().set_boot_disk_provisioned_iops(42);
6672    /// ```
6673    pub fn set_boot_disk_provisioned_iops<T>(mut self, v: T) -> Self
6674    where
6675        T: std::convert::Into<i64>,
6676    {
6677        self.boot_disk_provisioned_iops = std::option::Option::Some(v.into());
6678        self
6679    }
6680
6681    /// Sets or clears the value of [boot_disk_provisioned_iops][crate::model::DiskConfig::boot_disk_provisioned_iops].
6682    ///
6683    /// # Example
6684    /// ```ignore,no_run
6685    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6686    /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(Some(42));
6687    /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_iops(None::<i32>);
6688    /// ```
6689    pub fn set_or_clear_boot_disk_provisioned_iops<T>(mut self, v: std::option::Option<T>) -> Self
6690    where
6691        T: std::convert::Into<i64>,
6692    {
6693        self.boot_disk_provisioned_iops = v.map(|x| x.into());
6694        self
6695    }
6696
6697    /// Sets the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6698    ///
6699    /// # Example
6700    /// ```ignore,no_run
6701    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6702    /// let x = DiskConfig::new().set_boot_disk_provisioned_throughput(42);
6703    /// ```
6704    pub fn set_boot_disk_provisioned_throughput<T>(mut self, v: T) -> Self
6705    where
6706        T: std::convert::Into<i64>,
6707    {
6708        self.boot_disk_provisioned_throughput = std::option::Option::Some(v.into());
6709        self
6710    }
6711
6712    /// Sets or clears the value of [boot_disk_provisioned_throughput][crate::model::DiskConfig::boot_disk_provisioned_throughput].
6713    ///
6714    /// # Example
6715    /// ```ignore,no_run
6716    /// # use google_cloud_dataproc_v1::model::DiskConfig;
6717    /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(Some(42));
6718    /// let x = DiskConfig::new().set_or_clear_boot_disk_provisioned_throughput(None::<i32>);
6719    /// ```
6720    pub fn set_or_clear_boot_disk_provisioned_throughput<T>(
6721        mut self,
6722        v: std::option::Option<T>,
6723    ) -> Self
6724    where
6725        T: std::convert::Into<i64>,
6726    {
6727        self.boot_disk_provisioned_throughput = v.map(|x| x.into());
6728        self
6729    }
6730}
6731
6732impl wkt::message::Message for DiskConfig {
6733    fn typename() -> &'static str {
6734        "type.googleapis.com/google.cloud.dataproc.v1.DiskConfig"
6735    }
6736}
6737
6738/// Node group identification and configuration information.
6739#[derive(Clone, Default, PartialEq)]
6740#[non_exhaustive]
6741pub struct AuxiliaryNodeGroup {
6742    /// Required. Node group configuration.
6743    pub node_group: std::option::Option<crate::model::NodeGroup>,
6744
6745    /// Optional. A node group ID. Generated if not specified.
6746    ///
6747    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
6748    /// underscores (_), and hyphens (-). Cannot begin or end with underscore
6749    /// or hyphen. Must consist of from 3 to 33 characters.
6750    pub node_group_id: std::string::String,
6751
6752    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6753}
6754
6755impl AuxiliaryNodeGroup {
6756    pub fn new() -> Self {
6757        std::default::Default::default()
6758    }
6759
6760    /// Sets the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6761    ///
6762    /// # Example
6763    /// ```ignore,no_run
6764    /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6765    /// use google_cloud_dataproc_v1::model::NodeGroup;
6766    /// let x = AuxiliaryNodeGroup::new().set_node_group(NodeGroup::default()/* use setters */);
6767    /// ```
6768    pub fn set_node_group<T>(mut self, v: T) -> Self
6769    where
6770        T: std::convert::Into<crate::model::NodeGroup>,
6771    {
6772        self.node_group = std::option::Option::Some(v.into());
6773        self
6774    }
6775
6776    /// Sets or clears the value of [node_group][crate::model::AuxiliaryNodeGroup::node_group].
6777    ///
6778    /// # Example
6779    /// ```ignore,no_run
6780    /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6781    /// use google_cloud_dataproc_v1::model::NodeGroup;
6782    /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
6783    /// let x = AuxiliaryNodeGroup::new().set_or_clear_node_group(None::<NodeGroup>);
6784    /// ```
6785    pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
6786    where
6787        T: std::convert::Into<crate::model::NodeGroup>,
6788    {
6789        self.node_group = v.map(|x| x.into());
6790        self
6791    }
6792
6793    /// Sets the value of [node_group_id][crate::model::AuxiliaryNodeGroup::node_group_id].
6794    ///
6795    /// # Example
6796    /// ```ignore,no_run
6797    /// # use google_cloud_dataproc_v1::model::AuxiliaryNodeGroup;
6798    /// let x = AuxiliaryNodeGroup::new().set_node_group_id("example");
6799    /// ```
6800    pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6801        self.node_group_id = v.into();
6802        self
6803    }
6804}
6805
6806impl wkt::message::Message for AuxiliaryNodeGroup {
6807    fn typename() -> &'static str {
6808        "type.googleapis.com/google.cloud.dataproc.v1.AuxiliaryNodeGroup"
6809    }
6810}
6811
6812/// Dataproc Node Group.
6813/// **The Dataproc `NodeGroup` resource is not related to the
6814/// Dataproc [NodeGroupAffinity][google.cloud.dataproc.v1.NodeGroupAffinity]
6815/// resource.**
6816///
6817/// [google.cloud.dataproc.v1.NodeGroupAffinity]: crate::model::NodeGroupAffinity
6818#[derive(Clone, Default, PartialEq)]
6819#[non_exhaustive]
6820pub struct NodeGroup {
6821    /// The Node group [resource name](https://aip.dev/122).
6822    pub name: std::string::String,
6823
6824    /// Required. Node group roles.
6825    pub roles: std::vec::Vec<crate::model::node_group::Role>,
6826
6827    /// Optional. The node group instance group configuration.
6828    pub node_group_config: std::option::Option<crate::model::InstanceGroupConfig>,
6829
6830    /// Optional. Node group labels.
6831    ///
6832    /// * Label **keys** must consist of from 1 to 63 characters and conform to
6833    ///   [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
6834    /// * Label **values** can be empty. If specified, they must consist of from
6835    ///   1 to 63 characters and conform to [RFC 1035]
6836    ///   (<https://www.ietf.org/rfc/rfc1035.txt>).
6837    /// * The node group must have no more than 32 labels.
6838    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6839
6840    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6841}
6842
6843impl NodeGroup {
6844    pub fn new() -> Self {
6845        std::default::Default::default()
6846    }
6847
6848    /// Sets the value of [name][crate::model::NodeGroup::name].
6849    ///
6850    /// # Example
6851    /// ```ignore,no_run
6852    /// # use google_cloud_dataproc_v1::model::NodeGroup;
6853    /// let x = NodeGroup::new().set_name("example");
6854    /// ```
6855    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6856        self.name = v.into();
6857        self
6858    }
6859
6860    /// Sets the value of [roles][crate::model::NodeGroup::roles].
6861    ///
6862    /// # Example
6863    /// ```ignore,no_run
6864    /// # use google_cloud_dataproc_v1::model::NodeGroup;
6865    /// use google_cloud_dataproc_v1::model::node_group::Role;
6866    /// let x = NodeGroup::new().set_roles([
6867    ///     Role::Driver,
6868    /// ]);
6869    /// ```
6870    pub fn set_roles<T, V>(mut self, v: T) -> Self
6871    where
6872        T: std::iter::IntoIterator<Item = V>,
6873        V: std::convert::Into<crate::model::node_group::Role>,
6874    {
6875        use std::iter::Iterator;
6876        self.roles = v.into_iter().map(|i| i.into()).collect();
6877        self
6878    }
6879
6880    /// Sets the value of [node_group_config][crate::model::NodeGroup::node_group_config].
6881    ///
6882    /// # Example
6883    /// ```ignore,no_run
6884    /// # use google_cloud_dataproc_v1::model::NodeGroup;
6885    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6886    /// let x = NodeGroup::new().set_node_group_config(InstanceGroupConfig::default()/* use setters */);
6887    /// ```
6888    pub fn set_node_group_config<T>(mut self, v: T) -> Self
6889    where
6890        T: std::convert::Into<crate::model::InstanceGroupConfig>,
6891    {
6892        self.node_group_config = std::option::Option::Some(v.into());
6893        self
6894    }
6895
6896    /// Sets or clears the value of [node_group_config][crate::model::NodeGroup::node_group_config].
6897    ///
6898    /// # Example
6899    /// ```ignore,no_run
6900    /// # use google_cloud_dataproc_v1::model::NodeGroup;
6901    /// use google_cloud_dataproc_v1::model::InstanceGroupConfig;
6902    /// let x = NodeGroup::new().set_or_clear_node_group_config(Some(InstanceGroupConfig::default()/* use setters */));
6903    /// let x = NodeGroup::new().set_or_clear_node_group_config(None::<InstanceGroupConfig>);
6904    /// ```
6905    pub fn set_or_clear_node_group_config<T>(mut self, v: std::option::Option<T>) -> Self
6906    where
6907        T: std::convert::Into<crate::model::InstanceGroupConfig>,
6908    {
6909        self.node_group_config = v.map(|x| x.into());
6910        self
6911    }
6912
6913    /// Sets the value of [labels][crate::model::NodeGroup::labels].
6914    ///
6915    /// # Example
6916    /// ```ignore,no_run
6917    /// # use google_cloud_dataproc_v1::model::NodeGroup;
6918    /// let x = NodeGroup::new().set_labels([
6919    ///     ("key0", "abc"),
6920    ///     ("key1", "xyz"),
6921    /// ]);
6922    /// ```
6923    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6924    where
6925        T: std::iter::IntoIterator<Item = (K, V)>,
6926        K: std::convert::Into<std::string::String>,
6927        V: std::convert::Into<std::string::String>,
6928    {
6929        use std::iter::Iterator;
6930        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6931        self
6932    }
6933}
6934
6935impl wkt::message::Message for NodeGroup {
6936    fn typename() -> &'static str {
6937        "type.googleapis.com/google.cloud.dataproc.v1.NodeGroup"
6938    }
6939}
6940
6941/// Defines additional types related to [NodeGroup].
6942pub mod node_group {
6943    #[allow(unused_imports)]
6944    use super::*;
6945
6946    /// Node pool roles.
6947    ///
6948    /// # Working with unknown values
6949    ///
6950    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6951    /// additional enum variants at any time. Adding new variants is not considered
6952    /// a breaking change. Applications should write their code in anticipation of:
6953    ///
6954    /// - New values appearing in future releases of the client library, **and**
6955    /// - New values received dynamically, without application changes.
6956    ///
6957    /// Please consult the [Working with enums] section in the user guide for some
6958    /// guidelines.
6959    ///
6960    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6961    #[derive(Clone, Debug, PartialEq)]
6962    #[non_exhaustive]
6963    pub enum Role {
6964        /// Required unspecified role.
6965        Unspecified,
6966        /// Job drivers run on the node pool.
6967        Driver,
6968        /// If set, the enum was initialized with an unknown value.
6969        ///
6970        /// Applications can examine the value using [Role::value] or
6971        /// [Role::name].
6972        UnknownValue(role::UnknownValue),
6973    }
6974
6975    #[doc(hidden)]
6976    pub mod role {
6977        #[allow(unused_imports)]
6978        use super::*;
6979        #[derive(Clone, Debug, PartialEq)]
6980        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6981    }
6982
6983    impl Role {
6984        /// Gets the enum value.
6985        ///
6986        /// Returns `None` if the enum contains an unknown value deserialized from
6987        /// the string representation of enums.
6988        pub fn value(&self) -> std::option::Option<i32> {
6989            match self {
6990                Self::Unspecified => std::option::Option::Some(0),
6991                Self::Driver => std::option::Option::Some(1),
6992                Self::UnknownValue(u) => u.0.value(),
6993            }
6994        }
6995
6996        /// Gets the enum value as a string.
6997        ///
6998        /// Returns `None` if the enum contains an unknown value deserialized from
6999        /// the integer representation of enums.
7000        pub fn name(&self) -> std::option::Option<&str> {
7001            match self {
7002                Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
7003                Self::Driver => std::option::Option::Some("DRIVER"),
7004                Self::UnknownValue(u) => u.0.name(),
7005            }
7006        }
7007    }
7008
7009    impl std::default::Default for Role {
7010        fn default() -> Self {
7011            use std::convert::From;
7012            Self::from(0)
7013        }
7014    }
7015
7016    impl std::fmt::Display for Role {
7017        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7018            wkt::internal::display_enum(f, self.name(), self.value())
7019        }
7020    }
7021
7022    impl std::convert::From<i32> for Role {
7023        fn from(value: i32) -> Self {
7024            match value {
7025                0 => Self::Unspecified,
7026                1 => Self::Driver,
7027                _ => Self::UnknownValue(role::UnknownValue(
7028                    wkt::internal::UnknownEnumValue::Integer(value),
7029                )),
7030            }
7031        }
7032    }
7033
7034    impl std::convert::From<&str> for Role {
7035        fn from(value: &str) -> Self {
7036            use std::string::ToString;
7037            match value {
7038                "ROLE_UNSPECIFIED" => Self::Unspecified,
7039                "DRIVER" => Self::Driver,
7040                _ => Self::UnknownValue(role::UnknownValue(
7041                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7042                )),
7043            }
7044        }
7045    }
7046
7047    impl serde::ser::Serialize for Role {
7048        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7049        where
7050            S: serde::Serializer,
7051        {
7052            match self {
7053                Self::Unspecified => serializer.serialize_i32(0),
7054                Self::Driver => serializer.serialize_i32(1),
7055                Self::UnknownValue(u) => u.0.serialize(serializer),
7056            }
7057        }
7058    }
7059
7060    impl<'de> serde::de::Deserialize<'de> for Role {
7061        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7062        where
7063            D: serde::Deserializer<'de>,
7064        {
7065            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
7066                ".google.cloud.dataproc.v1.NodeGroup.Role",
7067            ))
7068        }
7069    }
7070}
7071
7072/// Specifies an executable to run on a fully configured node and a
7073/// timeout period for executable completion.
7074#[derive(Clone, Default, PartialEq)]
7075#[non_exhaustive]
7076pub struct NodeInitializationAction {
7077    /// Required. Cloud Storage URI of executable file.
7078    pub executable_file: std::string::String,
7079
7080    /// Optional. Amount of time executable has to complete. Default is
7081    /// 10 minutes (see JSON representation of
7082    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7083    ///
7084    /// Cluster creation fails with an explanatory error message (the
7085    /// name of the executable that caused the error and the exceeded timeout
7086    /// period) if the executable is not completed at end of the timeout period.
7087    pub execution_timeout: std::option::Option<wkt::Duration>,
7088
7089    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7090}
7091
7092impl NodeInitializationAction {
7093    pub fn new() -> Self {
7094        std::default::Default::default()
7095    }
7096
7097    /// Sets the value of [executable_file][crate::model::NodeInitializationAction::executable_file].
7098    ///
7099    /// # Example
7100    /// ```ignore,no_run
7101    /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7102    /// let x = NodeInitializationAction::new().set_executable_file("example");
7103    /// ```
7104    pub fn set_executable_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7105        self.executable_file = v.into();
7106        self
7107    }
7108
7109    /// Sets the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
7110    ///
7111    /// # Example
7112    /// ```ignore,no_run
7113    /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7114    /// use wkt::Duration;
7115    /// let x = NodeInitializationAction::new().set_execution_timeout(Duration::default()/* use setters */);
7116    /// ```
7117    pub fn set_execution_timeout<T>(mut self, v: T) -> Self
7118    where
7119        T: std::convert::Into<wkt::Duration>,
7120    {
7121        self.execution_timeout = std::option::Option::Some(v.into());
7122        self
7123    }
7124
7125    /// Sets or clears the value of [execution_timeout][crate::model::NodeInitializationAction::execution_timeout].
7126    ///
7127    /// # Example
7128    /// ```ignore,no_run
7129    /// # use google_cloud_dataproc_v1::model::NodeInitializationAction;
7130    /// use wkt::Duration;
7131    /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(Some(Duration::default()/* use setters */));
7132    /// let x = NodeInitializationAction::new().set_or_clear_execution_timeout(None::<Duration>);
7133    /// ```
7134    pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7135    where
7136        T: std::convert::Into<wkt::Duration>,
7137    {
7138        self.execution_timeout = v.map(|x| x.into());
7139        self
7140    }
7141}
7142
7143impl wkt::message::Message for NodeInitializationAction {
7144    fn typename() -> &'static str {
7145        "type.googleapis.com/google.cloud.dataproc.v1.NodeInitializationAction"
7146    }
7147}
7148
7149/// The status of a cluster and its instances.
7150#[derive(Clone, Default, PartialEq)]
7151#[non_exhaustive]
7152pub struct ClusterStatus {
7153    /// Output only. The cluster's state.
7154    pub state: crate::model::cluster_status::State,
7155
7156    /// Optional. Output only. Details of cluster's state.
7157    pub detail: std::string::String,
7158
7159    /// Output only. Time when this state was entered (see JSON representation of
7160    /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
7161    pub state_start_time: std::option::Option<wkt::Timestamp>,
7162
7163    /// Output only. Additional state information that includes
7164    /// status reported by the agent.
7165    pub substate: crate::model::cluster_status::Substate,
7166
7167    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7168}
7169
7170impl ClusterStatus {
7171    pub fn new() -> Self {
7172        std::default::Default::default()
7173    }
7174
7175    /// Sets the value of [state][crate::model::ClusterStatus::state].
7176    ///
7177    /// # Example
7178    /// ```ignore,no_run
7179    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7180    /// use google_cloud_dataproc_v1::model::cluster_status::State;
7181    /// let x0 = ClusterStatus::new().set_state(State::Creating);
7182    /// let x1 = ClusterStatus::new().set_state(State::Running);
7183    /// let x2 = ClusterStatus::new().set_state(State::Error);
7184    /// ```
7185    pub fn set_state<T: std::convert::Into<crate::model::cluster_status::State>>(
7186        mut self,
7187        v: T,
7188    ) -> Self {
7189        self.state = v.into();
7190        self
7191    }
7192
7193    /// Sets the value of [detail][crate::model::ClusterStatus::detail].
7194    ///
7195    /// # Example
7196    /// ```ignore,no_run
7197    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7198    /// let x = ClusterStatus::new().set_detail("example");
7199    /// ```
7200    pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7201        self.detail = v.into();
7202        self
7203    }
7204
7205    /// Sets the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
7206    ///
7207    /// # Example
7208    /// ```ignore,no_run
7209    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7210    /// use wkt::Timestamp;
7211    /// let x = ClusterStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
7212    /// ```
7213    pub fn set_state_start_time<T>(mut self, v: T) -> Self
7214    where
7215        T: std::convert::Into<wkt::Timestamp>,
7216    {
7217        self.state_start_time = std::option::Option::Some(v.into());
7218        self
7219    }
7220
7221    /// Sets or clears the value of [state_start_time][crate::model::ClusterStatus::state_start_time].
7222    ///
7223    /// # Example
7224    /// ```ignore,no_run
7225    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7226    /// use wkt::Timestamp;
7227    /// let x = ClusterStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
7228    /// let x = ClusterStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
7229    /// ```
7230    pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7231    where
7232        T: std::convert::Into<wkt::Timestamp>,
7233    {
7234        self.state_start_time = v.map(|x| x.into());
7235        self
7236    }
7237
7238    /// Sets the value of [substate][crate::model::ClusterStatus::substate].
7239    ///
7240    /// # Example
7241    /// ```ignore,no_run
7242    /// # use google_cloud_dataproc_v1::model::ClusterStatus;
7243    /// use google_cloud_dataproc_v1::model::cluster_status::Substate;
7244    /// let x0 = ClusterStatus::new().set_substate(Substate::Unhealthy);
7245    /// let x1 = ClusterStatus::new().set_substate(Substate::StaleStatus);
7246    /// ```
7247    pub fn set_substate<T: std::convert::Into<crate::model::cluster_status::Substate>>(
7248        mut self,
7249        v: T,
7250    ) -> Self {
7251        self.substate = v.into();
7252        self
7253    }
7254}
7255
7256impl wkt::message::Message for ClusterStatus {
7257    fn typename() -> &'static str {
7258        "type.googleapis.com/google.cloud.dataproc.v1.ClusterStatus"
7259    }
7260}
7261
7262/// Defines additional types related to [ClusterStatus].
7263pub mod cluster_status {
7264    #[allow(unused_imports)]
7265    use super::*;
7266
7267    /// The cluster state.
7268    ///
7269    /// # Working with unknown values
7270    ///
7271    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7272    /// additional enum variants at any time. Adding new variants is not considered
7273    /// a breaking change. Applications should write their code in anticipation of:
7274    ///
7275    /// - New values appearing in future releases of the client library, **and**
7276    /// - New values received dynamically, without application changes.
7277    ///
7278    /// Please consult the [Working with enums] section in the user guide for some
7279    /// guidelines.
7280    ///
7281    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7282    #[derive(Clone, Debug, PartialEq)]
7283    #[non_exhaustive]
7284    pub enum State {
7285        /// The cluster state is unknown.
7286        Unknown,
7287        /// The cluster is being created and set up. It is not ready for use.
7288        Creating,
7289        /// The cluster is currently running and healthy. It is ready for use.
7290        ///
7291        /// **Note:** The cluster state changes from "creating" to "running" status
7292        /// after the master node(s), first two primary worker nodes (and the last
7293        /// primary worker node if primary workers > 2) are running.
7294        Running,
7295        /// The cluster encountered an error. It is not ready for use.
7296        Error,
7297        /// The cluster has encountered an error while being updated. Jobs can
7298        /// be submitted to the cluster, but the cluster cannot be updated.
7299        ErrorDueToUpdate,
7300        /// The cluster is being deleted. It cannot be used.
7301        Deleting,
7302        /// The cluster is being updated. It continues to accept and process jobs.
7303        Updating,
7304        /// The cluster is being stopped. It cannot be used.
7305        Stopping,
7306        /// The cluster is currently stopped. It is not ready for use.
7307        Stopped,
7308        /// The cluster is being started. It is not ready for use.
7309        Starting,
7310        /// The cluster is being repaired. It is not ready for use.
7311        Repairing,
7312        /// If set, the enum was initialized with an unknown value.
7313        ///
7314        /// Applications can examine the value using [State::value] or
7315        /// [State::name].
7316        UnknownValue(state::UnknownValue),
7317    }
7318
7319    #[doc(hidden)]
7320    pub mod state {
7321        #[allow(unused_imports)]
7322        use super::*;
7323        #[derive(Clone, Debug, PartialEq)]
7324        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7325    }
7326
7327    impl State {
7328        /// Gets the enum value.
7329        ///
7330        /// Returns `None` if the enum contains an unknown value deserialized from
7331        /// the string representation of enums.
7332        pub fn value(&self) -> std::option::Option<i32> {
7333            match self {
7334                Self::Unknown => std::option::Option::Some(0),
7335                Self::Creating => std::option::Option::Some(1),
7336                Self::Running => std::option::Option::Some(2),
7337                Self::Error => std::option::Option::Some(3),
7338                Self::ErrorDueToUpdate => std::option::Option::Some(9),
7339                Self::Deleting => std::option::Option::Some(4),
7340                Self::Updating => std::option::Option::Some(5),
7341                Self::Stopping => std::option::Option::Some(6),
7342                Self::Stopped => std::option::Option::Some(7),
7343                Self::Starting => std::option::Option::Some(8),
7344                Self::Repairing => std::option::Option::Some(10),
7345                Self::UnknownValue(u) => u.0.value(),
7346            }
7347        }
7348
7349        /// Gets the enum value as a string.
7350        ///
7351        /// Returns `None` if the enum contains an unknown value deserialized from
7352        /// the integer representation of enums.
7353        pub fn name(&self) -> std::option::Option<&str> {
7354            match self {
7355                Self::Unknown => std::option::Option::Some("UNKNOWN"),
7356                Self::Creating => std::option::Option::Some("CREATING"),
7357                Self::Running => std::option::Option::Some("RUNNING"),
7358                Self::Error => std::option::Option::Some("ERROR"),
7359                Self::ErrorDueToUpdate => std::option::Option::Some("ERROR_DUE_TO_UPDATE"),
7360                Self::Deleting => std::option::Option::Some("DELETING"),
7361                Self::Updating => std::option::Option::Some("UPDATING"),
7362                Self::Stopping => std::option::Option::Some("STOPPING"),
7363                Self::Stopped => std::option::Option::Some("STOPPED"),
7364                Self::Starting => std::option::Option::Some("STARTING"),
7365                Self::Repairing => std::option::Option::Some("REPAIRING"),
7366                Self::UnknownValue(u) => u.0.name(),
7367            }
7368        }
7369    }
7370
7371    impl std::default::Default for State {
7372        fn default() -> Self {
7373            use std::convert::From;
7374            Self::from(0)
7375        }
7376    }
7377
7378    impl std::fmt::Display for State {
7379        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7380            wkt::internal::display_enum(f, self.name(), self.value())
7381        }
7382    }
7383
7384    impl std::convert::From<i32> for State {
7385        fn from(value: i32) -> Self {
7386            match value {
7387                0 => Self::Unknown,
7388                1 => Self::Creating,
7389                2 => Self::Running,
7390                3 => Self::Error,
7391                4 => Self::Deleting,
7392                5 => Self::Updating,
7393                6 => Self::Stopping,
7394                7 => Self::Stopped,
7395                8 => Self::Starting,
7396                9 => Self::ErrorDueToUpdate,
7397                10 => Self::Repairing,
7398                _ => Self::UnknownValue(state::UnknownValue(
7399                    wkt::internal::UnknownEnumValue::Integer(value),
7400                )),
7401            }
7402        }
7403    }
7404
7405    impl std::convert::From<&str> for State {
7406        fn from(value: &str) -> Self {
7407            use std::string::ToString;
7408            match value {
7409                "UNKNOWN" => Self::Unknown,
7410                "CREATING" => Self::Creating,
7411                "RUNNING" => Self::Running,
7412                "ERROR" => Self::Error,
7413                "ERROR_DUE_TO_UPDATE" => Self::ErrorDueToUpdate,
7414                "DELETING" => Self::Deleting,
7415                "UPDATING" => Self::Updating,
7416                "STOPPING" => Self::Stopping,
7417                "STOPPED" => Self::Stopped,
7418                "STARTING" => Self::Starting,
7419                "REPAIRING" => Self::Repairing,
7420                _ => Self::UnknownValue(state::UnknownValue(
7421                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7422                )),
7423            }
7424        }
7425    }
7426
7427    impl serde::ser::Serialize for State {
7428        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7429        where
7430            S: serde::Serializer,
7431        {
7432            match self {
7433                Self::Unknown => serializer.serialize_i32(0),
7434                Self::Creating => serializer.serialize_i32(1),
7435                Self::Running => serializer.serialize_i32(2),
7436                Self::Error => serializer.serialize_i32(3),
7437                Self::ErrorDueToUpdate => serializer.serialize_i32(9),
7438                Self::Deleting => serializer.serialize_i32(4),
7439                Self::Updating => serializer.serialize_i32(5),
7440                Self::Stopping => serializer.serialize_i32(6),
7441                Self::Stopped => serializer.serialize_i32(7),
7442                Self::Starting => serializer.serialize_i32(8),
7443                Self::Repairing => serializer.serialize_i32(10),
7444                Self::UnknownValue(u) => u.0.serialize(serializer),
7445            }
7446        }
7447    }
7448
7449    impl<'de> serde::de::Deserialize<'de> for State {
7450        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7451        where
7452            D: serde::Deserializer<'de>,
7453        {
7454            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7455                ".google.cloud.dataproc.v1.ClusterStatus.State",
7456            ))
7457        }
7458    }
7459
7460    /// The cluster substate.
7461    ///
7462    /// # Working with unknown values
7463    ///
7464    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7465    /// additional enum variants at any time. Adding new variants is not considered
7466    /// a breaking change. Applications should write their code in anticipation of:
7467    ///
7468    /// - New values appearing in future releases of the client library, **and**
7469    /// - New values received dynamically, without application changes.
7470    ///
7471    /// Please consult the [Working with enums] section in the user guide for some
7472    /// guidelines.
7473    ///
7474    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7475    #[derive(Clone, Debug, PartialEq)]
7476    #[non_exhaustive]
7477    pub enum Substate {
7478        /// The cluster substate is unknown.
7479        Unspecified,
7480        /// The cluster is known to be in an unhealthy state
7481        /// (for example, critical daemons are not running or HDFS capacity is
7482        /// exhausted).
7483        ///
7484        /// Applies to RUNNING state.
7485        Unhealthy,
7486        /// The agent-reported status is out of date (may occur if
7487        /// Dataproc loses communication with Agent).
7488        ///
7489        /// Applies to RUNNING state.
7490        StaleStatus,
7491        /// If set, the enum was initialized with an unknown value.
7492        ///
7493        /// Applications can examine the value using [Substate::value] or
7494        /// [Substate::name].
7495        UnknownValue(substate::UnknownValue),
7496    }
7497
7498    #[doc(hidden)]
7499    pub mod substate {
7500        #[allow(unused_imports)]
7501        use super::*;
7502        #[derive(Clone, Debug, PartialEq)]
7503        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7504    }
7505
7506    impl Substate {
7507        /// Gets the enum value.
7508        ///
7509        /// Returns `None` if the enum contains an unknown value deserialized from
7510        /// the string representation of enums.
7511        pub fn value(&self) -> std::option::Option<i32> {
7512            match self {
7513                Self::Unspecified => std::option::Option::Some(0),
7514                Self::Unhealthy => std::option::Option::Some(1),
7515                Self::StaleStatus => std::option::Option::Some(2),
7516                Self::UnknownValue(u) => u.0.value(),
7517            }
7518        }
7519
7520        /// Gets the enum value as a string.
7521        ///
7522        /// Returns `None` if the enum contains an unknown value deserialized from
7523        /// the integer representation of enums.
7524        pub fn name(&self) -> std::option::Option<&str> {
7525            match self {
7526                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
7527                Self::Unhealthy => std::option::Option::Some("UNHEALTHY"),
7528                Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
7529                Self::UnknownValue(u) => u.0.name(),
7530            }
7531        }
7532    }
7533
7534    impl std::default::Default for Substate {
7535        fn default() -> Self {
7536            use std::convert::From;
7537            Self::from(0)
7538        }
7539    }
7540
7541    impl std::fmt::Display for Substate {
7542        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7543            wkt::internal::display_enum(f, self.name(), self.value())
7544        }
7545    }
7546
7547    impl std::convert::From<i32> for Substate {
7548        fn from(value: i32) -> Self {
7549            match value {
7550                0 => Self::Unspecified,
7551                1 => Self::Unhealthy,
7552                2 => Self::StaleStatus,
7553                _ => Self::UnknownValue(substate::UnknownValue(
7554                    wkt::internal::UnknownEnumValue::Integer(value),
7555                )),
7556            }
7557        }
7558    }
7559
7560    impl std::convert::From<&str> for Substate {
7561        fn from(value: &str) -> Self {
7562            use std::string::ToString;
7563            match value {
7564                "UNSPECIFIED" => Self::Unspecified,
7565                "UNHEALTHY" => Self::Unhealthy,
7566                "STALE_STATUS" => Self::StaleStatus,
7567                _ => Self::UnknownValue(substate::UnknownValue(
7568                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7569                )),
7570            }
7571        }
7572    }
7573
7574    impl serde::ser::Serialize for Substate {
7575        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7576        where
7577            S: serde::Serializer,
7578        {
7579            match self {
7580                Self::Unspecified => serializer.serialize_i32(0),
7581                Self::Unhealthy => serializer.serialize_i32(1),
7582                Self::StaleStatus => serializer.serialize_i32(2),
7583                Self::UnknownValue(u) => u.0.serialize(serializer),
7584            }
7585        }
7586    }
7587
7588    impl<'de> serde::de::Deserialize<'de> for Substate {
7589        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7590        where
7591            D: serde::Deserializer<'de>,
7592        {
7593            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
7594                ".google.cloud.dataproc.v1.ClusterStatus.Substate",
7595            ))
7596        }
7597    }
7598}
7599
7600/// Security related configuration, including encryption, Kerberos, etc.
7601#[derive(Clone, Default, PartialEq)]
7602#[non_exhaustive]
7603pub struct SecurityConfig {
7604    /// Optional. Kerberos related configuration.
7605    pub kerberos_config: std::option::Option<crate::model::KerberosConfig>,
7606
7607    /// Optional. Identity related configuration, including service account based
7608    /// secure multi-tenancy user mappings.
7609    pub identity_config: std::option::Option<crate::model::IdentityConfig>,
7610
7611    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7612}
7613
7614impl SecurityConfig {
7615    pub fn new() -> Self {
7616        std::default::Default::default()
7617    }
7618
7619    /// Sets the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7620    ///
7621    /// # Example
7622    /// ```ignore,no_run
7623    /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7624    /// use google_cloud_dataproc_v1::model::KerberosConfig;
7625    /// let x = SecurityConfig::new().set_kerberos_config(KerberosConfig::default()/* use setters */);
7626    /// ```
7627    pub fn set_kerberos_config<T>(mut self, v: T) -> Self
7628    where
7629        T: std::convert::Into<crate::model::KerberosConfig>,
7630    {
7631        self.kerberos_config = std::option::Option::Some(v.into());
7632        self
7633    }
7634
7635    /// Sets or clears the value of [kerberos_config][crate::model::SecurityConfig::kerberos_config].
7636    ///
7637    /// # Example
7638    /// ```ignore,no_run
7639    /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7640    /// use google_cloud_dataproc_v1::model::KerberosConfig;
7641    /// let x = SecurityConfig::new().set_or_clear_kerberos_config(Some(KerberosConfig::default()/* use setters */));
7642    /// let x = SecurityConfig::new().set_or_clear_kerberos_config(None::<KerberosConfig>);
7643    /// ```
7644    pub fn set_or_clear_kerberos_config<T>(mut self, v: std::option::Option<T>) -> Self
7645    where
7646        T: std::convert::Into<crate::model::KerberosConfig>,
7647    {
7648        self.kerberos_config = v.map(|x| x.into());
7649        self
7650    }
7651
7652    /// Sets the value of [identity_config][crate::model::SecurityConfig::identity_config].
7653    ///
7654    /// # Example
7655    /// ```ignore,no_run
7656    /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7657    /// use google_cloud_dataproc_v1::model::IdentityConfig;
7658    /// let x = SecurityConfig::new().set_identity_config(IdentityConfig::default()/* use setters */);
7659    /// ```
7660    pub fn set_identity_config<T>(mut self, v: T) -> Self
7661    where
7662        T: std::convert::Into<crate::model::IdentityConfig>,
7663    {
7664        self.identity_config = std::option::Option::Some(v.into());
7665        self
7666    }
7667
7668    /// Sets or clears the value of [identity_config][crate::model::SecurityConfig::identity_config].
7669    ///
7670    /// # Example
7671    /// ```ignore,no_run
7672    /// # use google_cloud_dataproc_v1::model::SecurityConfig;
7673    /// use google_cloud_dataproc_v1::model::IdentityConfig;
7674    /// let x = SecurityConfig::new().set_or_clear_identity_config(Some(IdentityConfig::default()/* use setters */));
7675    /// let x = SecurityConfig::new().set_or_clear_identity_config(None::<IdentityConfig>);
7676    /// ```
7677    pub fn set_or_clear_identity_config<T>(mut self, v: std::option::Option<T>) -> Self
7678    where
7679        T: std::convert::Into<crate::model::IdentityConfig>,
7680    {
7681        self.identity_config = v.map(|x| x.into());
7682        self
7683    }
7684}
7685
7686impl wkt::message::Message for SecurityConfig {
7687    fn typename() -> &'static str {
7688        "type.googleapis.com/google.cloud.dataproc.v1.SecurityConfig"
7689    }
7690}
7691
7692/// Specifies Kerberos related configuration.
7693#[derive(Clone, Default, PartialEq)]
7694#[non_exhaustive]
7695pub struct KerberosConfig {
7696    /// Optional. Flag to indicate whether to Kerberize the cluster (default:
7697    /// false). Set this field to true to enable Kerberos on a cluster.
7698    pub enable_kerberos: bool,
7699
7700    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the root
7701    /// principal password.
7702    pub root_principal_password_uri: std::string::String,
7703
7704    /// Optional. The URI of the KMS key used to encrypt sensitive
7705    /// files.
7706    pub kms_key_uri: std::string::String,
7707
7708    /// Optional. The Cloud Storage URI of the keystore file used for SSL
7709    /// encryption. If not provided, Dataproc will provide a self-signed
7710    /// certificate.
7711    pub keystore_uri: std::string::String,
7712
7713    /// Optional. The Cloud Storage URI of the truststore file used for SSL
7714    /// encryption. If not provided, Dataproc will provide a self-signed
7715    /// certificate.
7716    pub truststore_uri: std::string::String,
7717
7718    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7719    /// password to the user provided keystore. For the self-signed certificate,
7720    /// this password is generated by Dataproc.
7721    pub keystore_password_uri: std::string::String,
7722
7723    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7724    /// password to the user provided key. For the self-signed certificate, this
7725    /// password is generated by Dataproc.
7726    pub key_password_uri: std::string::String,
7727
7728    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7729    /// password to the user provided truststore. For the self-signed certificate,
7730    /// this password is generated by Dataproc.
7731    pub truststore_password_uri: std::string::String,
7732
7733    /// Optional. The remote realm the Dataproc on-cluster KDC will trust, should
7734    /// the user enable cross realm trust.
7735    pub cross_realm_trust_realm: std::string::String,
7736
7737    /// Optional. The KDC (IP or hostname) for the remote trusted realm in a cross
7738    /// realm trust relationship.
7739    pub cross_realm_trust_kdc: std::string::String,
7740
7741    /// Optional. The admin server (IP or hostname) for the remote trusted realm in
7742    /// a cross realm trust relationship.
7743    pub cross_realm_trust_admin_server: std::string::String,
7744
7745    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7746    /// shared password between the on-cluster Kerberos realm and the remote
7747    /// trusted realm, in a cross realm trust relationship.
7748    pub cross_realm_trust_shared_password_uri: std::string::String,
7749
7750    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the
7751    /// master key of the KDC database.
7752    pub kdc_db_key_uri: std::string::String,
7753
7754    /// Optional. The lifetime of the ticket granting ticket, in hours.
7755    /// If not specified, or user specifies 0, then default value 10
7756    /// will be used.
7757    pub tgt_lifetime_hours: i32,
7758
7759    /// Optional. The name of the on-cluster Kerberos realm.
7760    /// If not specified, the uppercased domain of hostnames will be the realm.
7761    pub realm: std::string::String,
7762
7763    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7764}
7765
7766impl KerberosConfig {
7767    pub fn new() -> Self {
7768        std::default::Default::default()
7769    }
7770
7771    /// Sets the value of [enable_kerberos][crate::model::KerberosConfig::enable_kerberos].
7772    ///
7773    /// # Example
7774    /// ```ignore,no_run
7775    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7776    /// let x = KerberosConfig::new().set_enable_kerberos(true);
7777    /// ```
7778    pub fn set_enable_kerberos<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7779        self.enable_kerberos = v.into();
7780        self
7781    }
7782
7783    /// Sets the value of [root_principal_password_uri][crate::model::KerberosConfig::root_principal_password_uri].
7784    ///
7785    /// # Example
7786    /// ```ignore,no_run
7787    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7788    /// let x = KerberosConfig::new().set_root_principal_password_uri("example");
7789    /// ```
7790    pub fn set_root_principal_password_uri<T: std::convert::Into<std::string::String>>(
7791        mut self,
7792        v: T,
7793    ) -> Self {
7794        self.root_principal_password_uri = v.into();
7795        self
7796    }
7797
7798    /// Sets the value of [kms_key_uri][crate::model::KerberosConfig::kms_key_uri].
7799    ///
7800    /// # Example
7801    /// ```ignore,no_run
7802    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7803    /// let x = KerberosConfig::new().set_kms_key_uri("example");
7804    /// ```
7805    pub fn set_kms_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7806        self.kms_key_uri = v.into();
7807        self
7808    }
7809
7810    /// Sets the value of [keystore_uri][crate::model::KerberosConfig::keystore_uri].
7811    ///
7812    /// # Example
7813    /// ```ignore,no_run
7814    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7815    /// let x = KerberosConfig::new().set_keystore_uri("example");
7816    /// ```
7817    pub fn set_keystore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7818        self.keystore_uri = v.into();
7819        self
7820    }
7821
7822    /// Sets the value of [truststore_uri][crate::model::KerberosConfig::truststore_uri].
7823    ///
7824    /// # Example
7825    /// ```ignore,no_run
7826    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7827    /// let x = KerberosConfig::new().set_truststore_uri("example");
7828    /// ```
7829    pub fn set_truststore_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7830        self.truststore_uri = v.into();
7831        self
7832    }
7833
7834    /// Sets the value of [keystore_password_uri][crate::model::KerberosConfig::keystore_password_uri].
7835    ///
7836    /// # Example
7837    /// ```ignore,no_run
7838    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7839    /// let x = KerberosConfig::new().set_keystore_password_uri("example");
7840    /// ```
7841    pub fn set_keystore_password_uri<T: std::convert::Into<std::string::String>>(
7842        mut self,
7843        v: T,
7844    ) -> Self {
7845        self.keystore_password_uri = v.into();
7846        self
7847    }
7848
7849    /// Sets the value of [key_password_uri][crate::model::KerberosConfig::key_password_uri].
7850    ///
7851    /// # Example
7852    /// ```ignore,no_run
7853    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7854    /// let x = KerberosConfig::new().set_key_password_uri("example");
7855    /// ```
7856    pub fn set_key_password_uri<T: std::convert::Into<std::string::String>>(
7857        mut self,
7858        v: T,
7859    ) -> Self {
7860        self.key_password_uri = v.into();
7861        self
7862    }
7863
7864    /// Sets the value of [truststore_password_uri][crate::model::KerberosConfig::truststore_password_uri].
7865    ///
7866    /// # Example
7867    /// ```ignore,no_run
7868    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7869    /// let x = KerberosConfig::new().set_truststore_password_uri("example");
7870    /// ```
7871    pub fn set_truststore_password_uri<T: std::convert::Into<std::string::String>>(
7872        mut self,
7873        v: T,
7874    ) -> Self {
7875        self.truststore_password_uri = v.into();
7876        self
7877    }
7878
7879    /// Sets the value of [cross_realm_trust_realm][crate::model::KerberosConfig::cross_realm_trust_realm].
7880    ///
7881    /// # Example
7882    /// ```ignore,no_run
7883    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7884    /// let x = KerberosConfig::new().set_cross_realm_trust_realm("example");
7885    /// ```
7886    pub fn set_cross_realm_trust_realm<T: std::convert::Into<std::string::String>>(
7887        mut self,
7888        v: T,
7889    ) -> Self {
7890        self.cross_realm_trust_realm = v.into();
7891        self
7892    }
7893
7894    /// Sets the value of [cross_realm_trust_kdc][crate::model::KerberosConfig::cross_realm_trust_kdc].
7895    ///
7896    /// # Example
7897    /// ```ignore,no_run
7898    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7899    /// let x = KerberosConfig::new().set_cross_realm_trust_kdc("example");
7900    /// ```
7901    pub fn set_cross_realm_trust_kdc<T: std::convert::Into<std::string::String>>(
7902        mut self,
7903        v: T,
7904    ) -> Self {
7905        self.cross_realm_trust_kdc = v.into();
7906        self
7907    }
7908
7909    /// Sets the value of [cross_realm_trust_admin_server][crate::model::KerberosConfig::cross_realm_trust_admin_server].
7910    ///
7911    /// # Example
7912    /// ```ignore,no_run
7913    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7914    /// let x = KerberosConfig::new().set_cross_realm_trust_admin_server("example");
7915    /// ```
7916    pub fn set_cross_realm_trust_admin_server<T: std::convert::Into<std::string::String>>(
7917        mut self,
7918        v: T,
7919    ) -> Self {
7920        self.cross_realm_trust_admin_server = v.into();
7921        self
7922    }
7923
7924    /// Sets the value of [cross_realm_trust_shared_password_uri][crate::model::KerberosConfig::cross_realm_trust_shared_password_uri].
7925    ///
7926    /// # Example
7927    /// ```ignore,no_run
7928    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7929    /// let x = KerberosConfig::new().set_cross_realm_trust_shared_password_uri("example");
7930    /// ```
7931    pub fn set_cross_realm_trust_shared_password_uri<T: std::convert::Into<std::string::String>>(
7932        mut self,
7933        v: T,
7934    ) -> Self {
7935        self.cross_realm_trust_shared_password_uri = v.into();
7936        self
7937    }
7938
7939    /// Sets the value of [kdc_db_key_uri][crate::model::KerberosConfig::kdc_db_key_uri].
7940    ///
7941    /// # Example
7942    /// ```ignore,no_run
7943    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7944    /// let x = KerberosConfig::new().set_kdc_db_key_uri("example");
7945    /// ```
7946    pub fn set_kdc_db_key_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7947        self.kdc_db_key_uri = v.into();
7948        self
7949    }
7950
7951    /// Sets the value of [tgt_lifetime_hours][crate::model::KerberosConfig::tgt_lifetime_hours].
7952    ///
7953    /// # Example
7954    /// ```ignore,no_run
7955    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7956    /// let x = KerberosConfig::new().set_tgt_lifetime_hours(42);
7957    /// ```
7958    pub fn set_tgt_lifetime_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7959        self.tgt_lifetime_hours = v.into();
7960        self
7961    }
7962
7963    /// Sets the value of [realm][crate::model::KerberosConfig::realm].
7964    ///
7965    /// # Example
7966    /// ```ignore,no_run
7967    /// # use google_cloud_dataproc_v1::model::KerberosConfig;
7968    /// let x = KerberosConfig::new().set_realm("example");
7969    /// ```
7970    pub fn set_realm<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7971        self.realm = v.into();
7972        self
7973    }
7974}
7975
7976impl wkt::message::Message for KerberosConfig {
7977    fn typename() -> &'static str {
7978        "type.googleapis.com/google.cloud.dataproc.v1.KerberosConfig"
7979    }
7980}
7981
7982/// Identity related configuration, including service account based
7983/// secure multi-tenancy user mappings.
7984#[derive(Clone, Default, PartialEq)]
7985#[non_exhaustive]
7986pub struct IdentityConfig {
7987    /// Required. Map of user to service account.
7988    pub user_service_account_mapping:
7989        std::collections::HashMap<std::string::String, std::string::String>,
7990
7991    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7992}
7993
7994impl IdentityConfig {
7995    pub fn new() -> Self {
7996        std::default::Default::default()
7997    }
7998
7999    /// Sets the value of [user_service_account_mapping][crate::model::IdentityConfig::user_service_account_mapping].
8000    ///
8001    /// # Example
8002    /// ```ignore,no_run
8003    /// # use google_cloud_dataproc_v1::model::IdentityConfig;
8004    /// let x = IdentityConfig::new().set_user_service_account_mapping([
8005    ///     ("key0", "abc"),
8006    ///     ("key1", "xyz"),
8007    /// ]);
8008    /// ```
8009    pub fn set_user_service_account_mapping<T, K, V>(mut self, v: T) -> Self
8010    where
8011        T: std::iter::IntoIterator<Item = (K, V)>,
8012        K: std::convert::Into<std::string::String>,
8013        V: std::convert::Into<std::string::String>,
8014    {
8015        use std::iter::Iterator;
8016        self.user_service_account_mapping =
8017            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8018        self
8019    }
8020}
8021
8022impl wkt::message::Message for IdentityConfig {
8023    fn typename() -> &'static str {
8024        "type.googleapis.com/google.cloud.dataproc.v1.IdentityConfig"
8025    }
8026}
8027
8028/// Specifies the selection and config of software inside the cluster.
8029#[derive(Clone, Default, PartialEq)]
8030#[non_exhaustive]
8031pub struct SoftwareConfig {
8032    /// Optional. The version of software inside the cluster. It must be one of the
8033    /// supported [Dataproc
8034    /// Versions](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported-dataproc-image-versions),
8035    /// such as "1.2" (including a subminor version, such as "1.2.29"), or the
8036    /// ["preview"
8037    /// version](https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions).
8038    /// If unspecified, it defaults to the latest Debian version.
8039    pub image_version: std::string::String,
8040
8041    /// Optional. The properties to set on daemon config files.
8042    ///
8043    /// Property keys are specified in `prefix:property` format, for example
8044    /// `core:hadoop.tmp.dir`. The following are supported prefixes
8045    /// and their mappings:
8046    ///
8047    /// * capacity-scheduler: `capacity-scheduler.xml`
8048    /// * core:   `core-site.xml`
8049    /// * distcp: `distcp-default.xml`
8050    /// * hdfs:   `hdfs-site.xml`
8051    /// * hive:   `hive-site.xml`
8052    /// * mapred: `mapred-site.xml`
8053    /// * pig:    `pig.properties`
8054    /// * spark:  `spark-defaults.conf`
8055    /// * yarn:   `yarn-site.xml`
8056    ///
8057    /// For more information, see [Cluster
8058    /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
8059    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
8060
8061    /// Optional. The set of components to activate on the cluster.
8062    pub optional_components: std::vec::Vec<crate::model::Component>,
8063
8064    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8065}
8066
8067impl SoftwareConfig {
8068    pub fn new() -> Self {
8069        std::default::Default::default()
8070    }
8071
8072    /// Sets the value of [image_version][crate::model::SoftwareConfig::image_version].
8073    ///
8074    /// # Example
8075    /// ```ignore,no_run
8076    /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8077    /// let x = SoftwareConfig::new().set_image_version("example");
8078    /// ```
8079    pub fn set_image_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8080        self.image_version = v.into();
8081        self
8082    }
8083
8084    /// Sets the value of [properties][crate::model::SoftwareConfig::properties].
8085    ///
8086    /// # Example
8087    /// ```ignore,no_run
8088    /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8089    /// let x = SoftwareConfig::new().set_properties([
8090    ///     ("key0", "abc"),
8091    ///     ("key1", "xyz"),
8092    /// ]);
8093    /// ```
8094    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
8095    where
8096        T: std::iter::IntoIterator<Item = (K, V)>,
8097        K: std::convert::Into<std::string::String>,
8098        V: std::convert::Into<std::string::String>,
8099    {
8100        use std::iter::Iterator;
8101        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8102        self
8103    }
8104
8105    /// Sets the value of [optional_components][crate::model::SoftwareConfig::optional_components].
8106    ///
8107    /// # Example
8108    /// ```ignore,no_run
8109    /// # use google_cloud_dataproc_v1::model::SoftwareConfig;
8110    /// use google_cloud_dataproc_v1::model::Component;
8111    /// let x = SoftwareConfig::new().set_optional_components([
8112    ///     Component::Anaconda,
8113    ///     Component::Delta,
8114    ///     Component::Docker,
8115    /// ]);
8116    /// ```
8117    pub fn set_optional_components<T, V>(mut self, v: T) -> Self
8118    where
8119        T: std::iter::IntoIterator<Item = V>,
8120        V: std::convert::Into<crate::model::Component>,
8121    {
8122        use std::iter::Iterator;
8123        self.optional_components = v.into_iter().map(|i| i.into()).collect();
8124        self
8125    }
8126}
8127
8128impl wkt::message::Message for SoftwareConfig {
8129    fn typename() -> &'static str {
8130        "type.googleapis.com/google.cloud.dataproc.v1.SoftwareConfig"
8131    }
8132}
8133
8134/// Specifies the cluster auto-delete schedule configuration.
8135#[derive(Clone, Default, PartialEq)]
8136#[non_exhaustive]
8137pub struct LifecycleConfig {
8138    /// Optional. The duration to keep the cluster alive while idling (when no jobs
8139    /// are running). Passing this threshold will cause the cluster to be
8140    /// deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON
8141    /// representation of
8142    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8143    pub idle_delete_ttl: std::option::Option<wkt::Duration>,
8144
8145    /// Output only. The time when cluster became idle (most recent job finished)
8146    /// and became eligible for deletion due to idleness (see JSON representation
8147    /// of
8148    /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8149    pub idle_start_time: std::option::Option<wkt::Timestamp>,
8150
8151    /// Either the exact time the cluster should be deleted at or
8152    /// the cluster maximum age.
8153    pub ttl: std::option::Option<crate::model::lifecycle_config::Ttl>,
8154
8155    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8156}
8157
8158impl LifecycleConfig {
8159    pub fn new() -> Self {
8160        std::default::Default::default()
8161    }
8162
8163    /// Sets the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
8164    ///
8165    /// # Example
8166    /// ```ignore,no_run
8167    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8168    /// use wkt::Duration;
8169    /// let x = LifecycleConfig::new().set_idle_delete_ttl(Duration::default()/* use setters */);
8170    /// ```
8171    pub fn set_idle_delete_ttl<T>(mut self, v: T) -> Self
8172    where
8173        T: std::convert::Into<wkt::Duration>,
8174    {
8175        self.idle_delete_ttl = std::option::Option::Some(v.into());
8176        self
8177    }
8178
8179    /// Sets or clears the value of [idle_delete_ttl][crate::model::LifecycleConfig::idle_delete_ttl].
8180    ///
8181    /// # Example
8182    /// ```ignore,no_run
8183    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8184    /// use wkt::Duration;
8185    /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(Some(Duration::default()/* use setters */));
8186    /// let x = LifecycleConfig::new().set_or_clear_idle_delete_ttl(None::<Duration>);
8187    /// ```
8188    pub fn set_or_clear_idle_delete_ttl<T>(mut self, v: std::option::Option<T>) -> Self
8189    where
8190        T: std::convert::Into<wkt::Duration>,
8191    {
8192        self.idle_delete_ttl = v.map(|x| x.into());
8193        self
8194    }
8195
8196    /// Sets the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
8197    ///
8198    /// # Example
8199    /// ```ignore,no_run
8200    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8201    /// use wkt::Timestamp;
8202    /// let x = LifecycleConfig::new().set_idle_start_time(Timestamp::default()/* use setters */);
8203    /// ```
8204    pub fn set_idle_start_time<T>(mut self, v: T) -> Self
8205    where
8206        T: std::convert::Into<wkt::Timestamp>,
8207    {
8208        self.idle_start_time = std::option::Option::Some(v.into());
8209        self
8210    }
8211
8212    /// Sets or clears the value of [idle_start_time][crate::model::LifecycleConfig::idle_start_time].
8213    ///
8214    /// # Example
8215    /// ```ignore,no_run
8216    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8217    /// use wkt::Timestamp;
8218    /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(Some(Timestamp::default()/* use setters */));
8219    /// let x = LifecycleConfig::new().set_or_clear_idle_start_time(None::<Timestamp>);
8220    /// ```
8221    pub fn set_or_clear_idle_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8222    where
8223        T: std::convert::Into<wkt::Timestamp>,
8224    {
8225        self.idle_start_time = v.map(|x| x.into());
8226        self
8227    }
8228
8229    /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl].
8230    ///
8231    /// Note that all the setters affecting `ttl` are mutually
8232    /// exclusive.
8233    ///
8234    /// # Example
8235    /// ```ignore,no_run
8236    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8237    /// use wkt::Timestamp;
8238    /// let x = LifecycleConfig::new().set_ttl(Some(
8239    ///     google_cloud_dataproc_v1::model::lifecycle_config::Ttl::AutoDeleteTime(Timestamp::default().into())));
8240    /// ```
8241    pub fn set_ttl<
8242        T: std::convert::Into<std::option::Option<crate::model::lifecycle_config::Ttl>>,
8243    >(
8244        mut self,
8245        v: T,
8246    ) -> Self {
8247        self.ttl = v.into();
8248        self
8249    }
8250
8251    /// The value of [ttl][crate::model::LifecycleConfig::ttl]
8252    /// if it holds a `AutoDeleteTime`, `None` if the field is not set or
8253    /// holds a different branch.
8254    pub fn auto_delete_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
8255        #[allow(unreachable_patterns)]
8256        self.ttl.as_ref().and_then(|v| match v {
8257            crate::model::lifecycle_config::Ttl::AutoDeleteTime(v) => std::option::Option::Some(v),
8258            _ => std::option::Option::None,
8259        })
8260    }
8261
8262    /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
8263    /// to hold a `AutoDeleteTime`.
8264    ///
8265    /// Note that all the setters affecting `ttl` are
8266    /// mutually exclusive.
8267    ///
8268    /// # Example
8269    /// ```ignore,no_run
8270    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8271    /// use wkt::Timestamp;
8272    /// let x = LifecycleConfig::new().set_auto_delete_time(Timestamp::default()/* use setters */);
8273    /// assert!(x.auto_delete_time().is_some());
8274    /// assert!(x.auto_delete_ttl().is_none());
8275    /// ```
8276    pub fn set_auto_delete_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
8277        mut self,
8278        v: T,
8279    ) -> Self {
8280        self.ttl = std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTime(
8281            v.into(),
8282        ));
8283        self
8284    }
8285
8286    /// The value of [ttl][crate::model::LifecycleConfig::ttl]
8287    /// if it holds a `AutoDeleteTtl`, `None` if the field is not set or
8288    /// holds a different branch.
8289    pub fn auto_delete_ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
8290        #[allow(unreachable_patterns)]
8291        self.ttl.as_ref().and_then(|v| match v {
8292            crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v) => std::option::Option::Some(v),
8293            _ => std::option::Option::None,
8294        })
8295    }
8296
8297    /// Sets the value of [ttl][crate::model::LifecycleConfig::ttl]
8298    /// to hold a `AutoDeleteTtl`.
8299    ///
8300    /// Note that all the setters affecting `ttl` are
8301    /// mutually exclusive.
8302    ///
8303    /// # Example
8304    /// ```ignore,no_run
8305    /// # use google_cloud_dataproc_v1::model::LifecycleConfig;
8306    /// use wkt::Duration;
8307    /// let x = LifecycleConfig::new().set_auto_delete_ttl(Duration::default()/* use setters */);
8308    /// assert!(x.auto_delete_ttl().is_some());
8309    /// assert!(x.auto_delete_time().is_none());
8310    /// ```
8311    pub fn set_auto_delete_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
8312        mut self,
8313        v: T,
8314    ) -> Self {
8315        self.ttl =
8316            std::option::Option::Some(crate::model::lifecycle_config::Ttl::AutoDeleteTtl(v.into()));
8317        self
8318    }
8319}
8320
8321impl wkt::message::Message for LifecycleConfig {
8322    fn typename() -> &'static str {
8323        "type.googleapis.com/google.cloud.dataproc.v1.LifecycleConfig"
8324    }
8325}
8326
8327/// Defines additional types related to [LifecycleConfig].
8328pub mod lifecycle_config {
8329    #[allow(unused_imports)]
8330    use super::*;
8331
8332    /// Either the exact time the cluster should be deleted at or
8333    /// the cluster maximum age.
8334    #[derive(Clone, Debug, PartialEq)]
8335    #[non_exhaustive]
8336    pub enum Ttl {
8337        /// Optional. The time when cluster will be auto-deleted (see JSON
8338        /// representation of
8339        /// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8340        AutoDeleteTime(std::boxed::Box<wkt::Timestamp>),
8341        /// Optional. The lifetime duration of cluster. The cluster will be
8342        /// auto-deleted at the end of this period. Minimum value is 10 minutes;
8343        /// maximum value is 14 days (see JSON representation of
8344        /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8345        AutoDeleteTtl(std::boxed::Box<wkt::Duration>),
8346    }
8347}
8348
8349/// Specifies a Metastore configuration.
8350#[derive(Clone, Default, PartialEq)]
8351#[non_exhaustive]
8352pub struct MetastoreConfig {
8353    /// Required. Resource name of an existing Dataproc Metastore service.
8354    ///
8355    /// Example:
8356    ///
8357    /// * `projects/[project_id]/locations/[dataproc_region]/services/[service-name]`
8358    pub dataproc_metastore_service: std::string::String,
8359
8360    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8361}
8362
8363impl MetastoreConfig {
8364    pub fn new() -> Self {
8365        std::default::Default::default()
8366    }
8367
8368    /// Sets the value of [dataproc_metastore_service][crate::model::MetastoreConfig::dataproc_metastore_service].
8369    ///
8370    /// # Example
8371    /// ```ignore,no_run
8372    /// # use google_cloud_dataproc_v1::model::MetastoreConfig;
8373    /// let x = MetastoreConfig::new().set_dataproc_metastore_service("example");
8374    /// ```
8375    pub fn set_dataproc_metastore_service<T: std::convert::Into<std::string::String>>(
8376        mut self,
8377        v: T,
8378    ) -> Self {
8379        self.dataproc_metastore_service = v.into();
8380        self
8381    }
8382}
8383
8384impl wkt::message::Message for MetastoreConfig {
8385    fn typename() -> &'static str {
8386        "type.googleapis.com/google.cloud.dataproc.v1.MetastoreConfig"
8387    }
8388}
8389
8390/// Contains cluster daemon metrics, such as HDFS and YARN stats.
8391///
8392/// **Beta Feature**: This report is available for testing purposes only. It may
8393/// be changed before final release.
8394#[derive(Clone, Default, PartialEq)]
8395#[non_exhaustive]
8396pub struct ClusterMetrics {
8397    /// The HDFS metrics.
8398    pub hdfs_metrics: std::collections::HashMap<std::string::String, i64>,
8399
8400    /// YARN metrics.
8401    pub yarn_metrics: std::collections::HashMap<std::string::String, i64>,
8402
8403    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8404}
8405
8406impl ClusterMetrics {
8407    pub fn new() -> Self {
8408        std::default::Default::default()
8409    }
8410
8411    /// Sets the value of [hdfs_metrics][crate::model::ClusterMetrics::hdfs_metrics].
8412    ///
8413    /// # Example
8414    /// ```ignore,no_run
8415    /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8416    /// let x = ClusterMetrics::new().set_hdfs_metrics([
8417    ///     ("key0", 123),
8418    ///     ("key1", 456),
8419    /// ]);
8420    /// ```
8421    pub fn set_hdfs_metrics<T, K, V>(mut self, v: T) -> Self
8422    where
8423        T: std::iter::IntoIterator<Item = (K, V)>,
8424        K: std::convert::Into<std::string::String>,
8425        V: std::convert::Into<i64>,
8426    {
8427        use std::iter::Iterator;
8428        self.hdfs_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8429        self
8430    }
8431
8432    /// Sets the value of [yarn_metrics][crate::model::ClusterMetrics::yarn_metrics].
8433    ///
8434    /// # Example
8435    /// ```ignore,no_run
8436    /// # use google_cloud_dataproc_v1::model::ClusterMetrics;
8437    /// let x = ClusterMetrics::new().set_yarn_metrics([
8438    ///     ("key0", 123),
8439    ///     ("key1", 456),
8440    /// ]);
8441    /// ```
8442    pub fn set_yarn_metrics<T, K, V>(mut self, v: T) -> Self
8443    where
8444        T: std::iter::IntoIterator<Item = (K, V)>,
8445        K: std::convert::Into<std::string::String>,
8446        V: std::convert::Into<i64>,
8447    {
8448        use std::iter::Iterator;
8449        self.yarn_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8450        self
8451    }
8452}
8453
8454impl wkt::message::Message for ClusterMetrics {
8455    fn typename() -> &'static str {
8456        "type.googleapis.com/google.cloud.dataproc.v1.ClusterMetrics"
8457    }
8458}
8459
8460/// Dataproc metric config.
8461#[derive(Clone, Default, PartialEq)]
8462#[non_exhaustive]
8463pub struct DataprocMetricConfig {
8464    /// Required. Metrics sources to enable.
8465    pub metrics: std::vec::Vec<crate::model::dataproc_metric_config::Metric>,
8466
8467    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8468}
8469
8470impl DataprocMetricConfig {
8471    pub fn new() -> Self {
8472        std::default::Default::default()
8473    }
8474
8475    /// Sets the value of [metrics][crate::model::DataprocMetricConfig::metrics].
8476    ///
8477    /// # Example
8478    /// ```ignore,no_run
8479    /// # use google_cloud_dataproc_v1::model::DataprocMetricConfig;
8480    /// use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8481    /// let x = DataprocMetricConfig::new()
8482    ///     .set_metrics([
8483    ///         Metric::default()/* use setters */,
8484    ///         Metric::default()/* use (different) setters */,
8485    ///     ]);
8486    /// ```
8487    pub fn set_metrics<T, V>(mut self, v: T) -> Self
8488    where
8489        T: std::iter::IntoIterator<Item = V>,
8490        V: std::convert::Into<crate::model::dataproc_metric_config::Metric>,
8491    {
8492        use std::iter::Iterator;
8493        self.metrics = v.into_iter().map(|i| i.into()).collect();
8494        self
8495    }
8496}
8497
8498impl wkt::message::Message for DataprocMetricConfig {
8499    fn typename() -> &'static str {
8500        "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig"
8501    }
8502}
8503
8504/// Defines additional types related to [DataprocMetricConfig].
8505pub mod dataproc_metric_config {
8506    #[allow(unused_imports)]
8507    use super::*;
8508
8509    /// A Dataproc custom metric.
8510    #[derive(Clone, Default, PartialEq)]
8511    #[non_exhaustive]
8512    pub struct Metric {
8513        /// Required. A standard set of metrics is collected unless `metricOverrides`
8514        /// are specified for the metric source (see [Custom metrics]
8515        /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8516        /// for more information).
8517        pub metric_source: crate::model::dataproc_metric_config::MetricSource,
8518
8519        /// Optional. Specify one or more [Custom metrics]
8520        /// (<https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics>)
8521        /// to collect for the metric course (for the `SPARK` metric source (any
8522        /// [Spark metric]
8523        /// (<https://spark.apache.org/docs/latest/monitoring.html#metrics>) can be
8524        /// specified).
8525        ///
8526        /// Provide metrics in the following format:
8527        /// \<code\>\<var\>METRIC_SOURCE\</var\>:\<var\>INSTANCE\</var\>:\<var\>GROUP\</var\>:\<var\>METRIC\</var\>\</code\>
8528        /// Use camelcase as appropriate.
8529        ///
8530        /// Examples:
8531        ///
8532        /// ```norust
8533        /// yarn:ResourceManager:QueueMetrics:AppsCompleted
8534        /// spark:driver:DAGScheduler:job.allJobs
8535        /// sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed
8536        /// hiveserver2:JVM:Memory:NonHeapMemoryUsage.used
8537        /// ```
8538        ///
8539        /// Notes:
8540        ///
8541        /// * Only the specified overridden metrics are collected for the
8542        ///   metric source. For example, if one or more `spark:executive` metrics
8543        ///   are listed as metric overrides, other `SPARK` metrics are not
8544        ///   collected. The collection of the metrics for other enabled custom
8545        ///   metric sources is unaffected. For example, if both `SPARK` andd `YARN`
8546        ///   metric sources are enabled, and overrides are provided for Spark
8547        ///   metrics only, all YARN metrics are collected.
8548        pub metric_overrides: std::vec::Vec<std::string::String>,
8549
8550        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8551    }
8552
8553    impl Metric {
8554        pub fn new() -> Self {
8555            std::default::Default::default()
8556        }
8557
8558        /// Sets the value of [metric_source][crate::model::dataproc_metric_config::Metric::metric_source].
8559        ///
8560        /// # Example
8561        /// ```ignore,no_run
8562        /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8563        /// use google_cloud_dataproc_v1::model::dataproc_metric_config::MetricSource;
8564        /// let x0 = Metric::new().set_metric_source(MetricSource::MonitoringAgentDefaults);
8565        /// let x1 = Metric::new().set_metric_source(MetricSource::Hdfs);
8566        /// let x2 = Metric::new().set_metric_source(MetricSource::Spark);
8567        /// ```
8568        pub fn set_metric_source<
8569            T: std::convert::Into<crate::model::dataproc_metric_config::MetricSource>,
8570        >(
8571            mut self,
8572            v: T,
8573        ) -> Self {
8574            self.metric_source = v.into();
8575            self
8576        }
8577
8578        /// Sets the value of [metric_overrides][crate::model::dataproc_metric_config::Metric::metric_overrides].
8579        ///
8580        /// # Example
8581        /// ```ignore,no_run
8582        /// # use google_cloud_dataproc_v1::model::dataproc_metric_config::Metric;
8583        /// let x = Metric::new().set_metric_overrides(["a", "b", "c"]);
8584        /// ```
8585        pub fn set_metric_overrides<T, V>(mut self, v: T) -> Self
8586        where
8587            T: std::iter::IntoIterator<Item = V>,
8588            V: std::convert::Into<std::string::String>,
8589        {
8590            use std::iter::Iterator;
8591            self.metric_overrides = v.into_iter().map(|i| i.into()).collect();
8592            self
8593        }
8594    }
8595
8596    impl wkt::message::Message for Metric {
8597        fn typename() -> &'static str {
8598            "type.googleapis.com/google.cloud.dataproc.v1.DataprocMetricConfig.Metric"
8599        }
8600    }
8601
8602    /// A source for the collection of Dataproc custom metrics (see [Custom
8603    /// metrics]
8604    /// (<https://cloud.google.com//dataproc/docs/guides/dataproc-metrics#custom_metrics>)).
8605    ///
8606    /// # Working with unknown values
8607    ///
8608    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8609    /// additional enum variants at any time. Adding new variants is not considered
8610    /// a breaking change. Applications should write their code in anticipation of:
8611    ///
8612    /// - New values appearing in future releases of the client library, **and**
8613    /// - New values received dynamically, without application changes.
8614    ///
8615    /// Please consult the [Working with enums] section in the user guide for some
8616    /// guidelines.
8617    ///
8618    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8619    #[derive(Clone, Debug, PartialEq)]
8620    #[non_exhaustive]
8621    pub enum MetricSource {
8622        /// Required unspecified metric source.
8623        Unspecified,
8624        /// Monitoring agent metrics. If this source is enabled,
8625        /// Dataproc enables the monitoring agent in Compute Engine,
8626        /// and collects monitoring agent metrics, which are published
8627        /// with an `agent.googleapis.com` prefix.
8628        MonitoringAgentDefaults,
8629        /// HDFS metric source.
8630        Hdfs,
8631        /// Spark metric source.
8632        Spark,
8633        /// YARN metric source.
8634        Yarn,
8635        /// Spark History Server metric source.
8636        SparkHistoryServer,
8637        /// Hiveserver2 metric source.
8638        Hiveserver2,
8639        /// hivemetastore metric source
8640        Hivemetastore,
8641        /// flink metric source
8642        Flink,
8643        /// If set, the enum was initialized with an unknown value.
8644        ///
8645        /// Applications can examine the value using [MetricSource::value] or
8646        /// [MetricSource::name].
8647        UnknownValue(metric_source::UnknownValue),
8648    }
8649
8650    #[doc(hidden)]
8651    pub mod metric_source {
8652        #[allow(unused_imports)]
8653        use super::*;
8654        #[derive(Clone, Debug, PartialEq)]
8655        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8656    }
8657
8658    impl MetricSource {
8659        /// Gets the enum value.
8660        ///
8661        /// Returns `None` if the enum contains an unknown value deserialized from
8662        /// the string representation of enums.
8663        pub fn value(&self) -> std::option::Option<i32> {
8664            match self {
8665                Self::Unspecified => std::option::Option::Some(0),
8666                Self::MonitoringAgentDefaults => std::option::Option::Some(1),
8667                Self::Hdfs => std::option::Option::Some(2),
8668                Self::Spark => std::option::Option::Some(3),
8669                Self::Yarn => std::option::Option::Some(4),
8670                Self::SparkHistoryServer => std::option::Option::Some(5),
8671                Self::Hiveserver2 => std::option::Option::Some(6),
8672                Self::Hivemetastore => std::option::Option::Some(7),
8673                Self::Flink => std::option::Option::Some(8),
8674                Self::UnknownValue(u) => u.0.value(),
8675            }
8676        }
8677
8678        /// Gets the enum value as a string.
8679        ///
8680        /// Returns `None` if the enum contains an unknown value deserialized from
8681        /// the integer representation of enums.
8682        pub fn name(&self) -> std::option::Option<&str> {
8683            match self {
8684                Self::Unspecified => std::option::Option::Some("METRIC_SOURCE_UNSPECIFIED"),
8685                Self::MonitoringAgentDefaults => {
8686                    std::option::Option::Some("MONITORING_AGENT_DEFAULTS")
8687                }
8688                Self::Hdfs => std::option::Option::Some("HDFS"),
8689                Self::Spark => std::option::Option::Some("SPARK"),
8690                Self::Yarn => std::option::Option::Some("YARN"),
8691                Self::SparkHistoryServer => std::option::Option::Some("SPARK_HISTORY_SERVER"),
8692                Self::Hiveserver2 => std::option::Option::Some("HIVESERVER2"),
8693                Self::Hivemetastore => std::option::Option::Some("HIVEMETASTORE"),
8694                Self::Flink => std::option::Option::Some("FLINK"),
8695                Self::UnknownValue(u) => u.0.name(),
8696            }
8697        }
8698    }
8699
8700    impl std::default::Default for MetricSource {
8701        fn default() -> Self {
8702            use std::convert::From;
8703            Self::from(0)
8704        }
8705    }
8706
8707    impl std::fmt::Display for MetricSource {
8708        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8709            wkt::internal::display_enum(f, self.name(), self.value())
8710        }
8711    }
8712
8713    impl std::convert::From<i32> for MetricSource {
8714        fn from(value: i32) -> Self {
8715            match value {
8716                0 => Self::Unspecified,
8717                1 => Self::MonitoringAgentDefaults,
8718                2 => Self::Hdfs,
8719                3 => Self::Spark,
8720                4 => Self::Yarn,
8721                5 => Self::SparkHistoryServer,
8722                6 => Self::Hiveserver2,
8723                7 => Self::Hivemetastore,
8724                8 => Self::Flink,
8725                _ => Self::UnknownValue(metric_source::UnknownValue(
8726                    wkt::internal::UnknownEnumValue::Integer(value),
8727                )),
8728            }
8729        }
8730    }
8731
8732    impl std::convert::From<&str> for MetricSource {
8733        fn from(value: &str) -> Self {
8734            use std::string::ToString;
8735            match value {
8736                "METRIC_SOURCE_UNSPECIFIED" => Self::Unspecified,
8737                "MONITORING_AGENT_DEFAULTS" => Self::MonitoringAgentDefaults,
8738                "HDFS" => Self::Hdfs,
8739                "SPARK" => Self::Spark,
8740                "YARN" => Self::Yarn,
8741                "SPARK_HISTORY_SERVER" => Self::SparkHistoryServer,
8742                "HIVESERVER2" => Self::Hiveserver2,
8743                "HIVEMETASTORE" => Self::Hivemetastore,
8744                "FLINK" => Self::Flink,
8745                _ => Self::UnknownValue(metric_source::UnknownValue(
8746                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8747                )),
8748            }
8749        }
8750    }
8751
8752    impl serde::ser::Serialize for MetricSource {
8753        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8754        where
8755            S: serde::Serializer,
8756        {
8757            match self {
8758                Self::Unspecified => serializer.serialize_i32(0),
8759                Self::MonitoringAgentDefaults => serializer.serialize_i32(1),
8760                Self::Hdfs => serializer.serialize_i32(2),
8761                Self::Spark => serializer.serialize_i32(3),
8762                Self::Yarn => serializer.serialize_i32(4),
8763                Self::SparkHistoryServer => serializer.serialize_i32(5),
8764                Self::Hiveserver2 => serializer.serialize_i32(6),
8765                Self::Hivemetastore => serializer.serialize_i32(7),
8766                Self::Flink => serializer.serialize_i32(8),
8767                Self::UnknownValue(u) => u.0.serialize(serializer),
8768            }
8769        }
8770    }
8771
8772    impl<'de> serde::de::Deserialize<'de> for MetricSource {
8773        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8774        where
8775            D: serde::Deserializer<'de>,
8776        {
8777            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricSource>::new(
8778                ".google.cloud.dataproc.v1.DataprocMetricConfig.MetricSource",
8779            ))
8780        }
8781    }
8782}
8783
8784/// A request to create a cluster.
8785#[derive(Clone, Default, PartialEq)]
8786#[non_exhaustive]
8787pub struct CreateClusterRequest {
8788    /// Required. The ID of the Google Cloud Platform project that the cluster
8789    /// belongs to.
8790    pub project_id: std::string::String,
8791
8792    /// Required. The Dataproc region in which to handle the request.
8793    pub region: std::string::String,
8794
8795    /// Required. The cluster to create.
8796    pub cluster: std::option::Option<crate::model::Cluster>,
8797
8798    /// Optional. A unique ID used to identify the request. If the server receives
8799    /// two
8800    /// [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
8801    /// with the same id, then the second request will be ignored and the
8802    /// first [google.longrunning.Operation][google.longrunning.Operation] created
8803    /// and stored in the backend is returned.
8804    ///
8805    /// It is recommended to always set this value to a
8806    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8807    ///
8808    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8809    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8810    ///
8811    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8812    pub request_id: std::string::String,
8813
8814    /// Optional. Failure action when primary worker creation fails.
8815    pub action_on_failed_primary_workers: crate::model::FailureAction,
8816
8817    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8818}
8819
8820impl CreateClusterRequest {
8821    pub fn new() -> Self {
8822        std::default::Default::default()
8823    }
8824
8825    /// Sets the value of [project_id][crate::model::CreateClusterRequest::project_id].
8826    ///
8827    /// # Example
8828    /// ```ignore,no_run
8829    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8830    /// let x = CreateClusterRequest::new().set_project_id("example");
8831    /// ```
8832    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8833        self.project_id = v.into();
8834        self
8835    }
8836
8837    /// Sets the value of [region][crate::model::CreateClusterRequest::region].
8838    ///
8839    /// # Example
8840    /// ```ignore,no_run
8841    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8842    /// let x = CreateClusterRequest::new().set_region("example");
8843    /// ```
8844    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8845        self.region = v.into();
8846        self
8847    }
8848
8849    /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
8850    ///
8851    /// # Example
8852    /// ```ignore,no_run
8853    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8854    /// use google_cloud_dataproc_v1::model::Cluster;
8855    /// let x = CreateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
8856    /// ```
8857    pub fn set_cluster<T>(mut self, v: T) -> Self
8858    where
8859        T: std::convert::Into<crate::model::Cluster>,
8860    {
8861        self.cluster = std::option::Option::Some(v.into());
8862        self
8863    }
8864
8865    /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
8866    ///
8867    /// # Example
8868    /// ```ignore,no_run
8869    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8870    /// use google_cloud_dataproc_v1::model::Cluster;
8871    /// let x = CreateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
8872    /// let x = CreateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
8873    /// ```
8874    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
8875    where
8876        T: std::convert::Into<crate::model::Cluster>,
8877    {
8878        self.cluster = v.map(|x| x.into());
8879        self
8880    }
8881
8882    /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
8883    ///
8884    /// # Example
8885    /// ```ignore,no_run
8886    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8887    /// let x = CreateClusterRequest::new().set_request_id("example");
8888    /// ```
8889    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8890        self.request_id = v.into();
8891        self
8892    }
8893
8894    /// Sets the value of [action_on_failed_primary_workers][crate::model::CreateClusterRequest::action_on_failed_primary_workers].
8895    ///
8896    /// # Example
8897    /// ```ignore,no_run
8898    /// # use google_cloud_dataproc_v1::model::CreateClusterRequest;
8899    /// use google_cloud_dataproc_v1::model::FailureAction;
8900    /// let x0 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::NoAction);
8901    /// let x1 = CreateClusterRequest::new().set_action_on_failed_primary_workers(FailureAction::Delete);
8902    /// ```
8903    pub fn set_action_on_failed_primary_workers<
8904        T: std::convert::Into<crate::model::FailureAction>,
8905    >(
8906        mut self,
8907        v: T,
8908    ) -> Self {
8909        self.action_on_failed_primary_workers = v.into();
8910        self
8911    }
8912}
8913
8914impl wkt::message::Message for CreateClusterRequest {
8915    fn typename() -> &'static str {
8916        "type.googleapis.com/google.cloud.dataproc.v1.CreateClusterRequest"
8917    }
8918}
8919
8920/// A request to update a cluster.
8921#[derive(Clone, Default, PartialEq)]
8922#[non_exhaustive]
8923pub struct UpdateClusterRequest {
8924    /// Required. The ID of the Google Cloud Platform project the
8925    /// cluster belongs to.
8926    pub project_id: std::string::String,
8927
8928    /// Required. The Dataproc region in which to handle the request.
8929    pub region: std::string::String,
8930
8931    /// Required. The cluster name.
8932    pub cluster_name: std::string::String,
8933
8934    /// Required. The changes to the cluster.
8935    pub cluster: std::option::Option<crate::model::Cluster>,
8936
8937    /// Optional. Timeout for graceful YARN decommissioning. Graceful
8938    /// decommissioning allows removing nodes from the cluster without
8939    /// interrupting jobs in progress. Timeout specifies how long to wait for jobs
8940    /// in progress to finish before forcefully removing nodes (and potentially
8941    /// interrupting jobs). Default timeout is 0 (for forceful decommission), and
8942    /// the maximum allowed timeout is 1 day. (see JSON representation of
8943    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
8944    ///
8945    /// Only supported on Dataproc image versions 1.2 and higher.
8946    pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
8947
8948    /// Required. Specifies the path, relative to `Cluster`, of
8949    /// the field to update. For example, to change the number of workers
8950    /// in a cluster to 5, the `update_mask` parameter would be
8951    /// specified as `config.worker_config.num_instances`,
8952    /// and the `PATCH` request body would specify the new value, as follows:
8953    ///
8954    /// ```norust
8955    /// {
8956    ///   "config":{
8957    ///     "workerConfig":{
8958    ///       "numInstances":"5"
8959    ///     }
8960    ///   }
8961    /// }
8962    /// ```
8963    ///
8964    /// Similarly, to change the number of preemptible workers in a cluster to 5,
8965    /// the `update_mask` parameter would be
8966    /// `config.secondary_worker_config.num_instances`, and the `PATCH` request
8967    /// body would be set as follows:
8968    ///
8969    /// ```norust
8970    /// {
8971    ///   "config":{
8972    ///     "secondaryWorkerConfig":{
8973    ///       "numInstances":"5"
8974    ///     }
8975    ///   }
8976    /// }
8977    /// ```
8978    ///
8979    /// \<strong\>Note:\</strong\> Currently, only the following fields can be updated:
8980    pub update_mask: std::option::Option<wkt::FieldMask>,
8981
8982    /// Optional. A unique ID used to identify the request. If the server
8983    /// receives two
8984    /// [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
8985    /// with the same id, then the second request will be ignored and the
8986    /// first [google.longrunning.Operation][google.longrunning.Operation] created
8987    /// and stored in the backend is returned.
8988    ///
8989    /// It is recommended to always set this value to a
8990    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
8991    ///
8992    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
8993    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
8994    ///
8995    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
8996    pub request_id: std::string::String,
8997
8998    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8999}
9000
9001impl UpdateClusterRequest {
9002    pub fn new() -> Self {
9003        std::default::Default::default()
9004    }
9005
9006    /// Sets the value of [project_id][crate::model::UpdateClusterRequest::project_id].
9007    ///
9008    /// # Example
9009    /// ```ignore,no_run
9010    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9011    /// let x = UpdateClusterRequest::new().set_project_id("example");
9012    /// ```
9013    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9014        self.project_id = v.into();
9015        self
9016    }
9017
9018    /// Sets the value of [region][crate::model::UpdateClusterRequest::region].
9019    ///
9020    /// # Example
9021    /// ```ignore,no_run
9022    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9023    /// let x = UpdateClusterRequest::new().set_region("example");
9024    /// ```
9025    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9026        self.region = v.into();
9027        self
9028    }
9029
9030    /// Sets the value of [cluster_name][crate::model::UpdateClusterRequest::cluster_name].
9031    ///
9032    /// # Example
9033    /// ```ignore,no_run
9034    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9035    /// let x = UpdateClusterRequest::new().set_cluster_name("example");
9036    /// ```
9037    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9038        self.cluster_name = v.into();
9039        self
9040    }
9041
9042    /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
9043    ///
9044    /// # Example
9045    /// ```ignore,no_run
9046    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9047    /// use google_cloud_dataproc_v1::model::Cluster;
9048    /// let x = UpdateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
9049    /// ```
9050    pub fn set_cluster<T>(mut self, v: T) -> Self
9051    where
9052        T: std::convert::Into<crate::model::Cluster>,
9053    {
9054        self.cluster = std::option::Option::Some(v.into());
9055        self
9056    }
9057
9058    /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
9059    ///
9060    /// # Example
9061    /// ```ignore,no_run
9062    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9063    /// use google_cloud_dataproc_v1::model::Cluster;
9064    /// let x = UpdateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
9065    /// let x = UpdateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
9066    /// ```
9067    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
9068    where
9069        T: std::convert::Into<crate::model::Cluster>,
9070    {
9071        self.cluster = v.map(|x| x.into());
9072        self
9073    }
9074
9075    /// Sets the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
9076    ///
9077    /// # Example
9078    /// ```ignore,no_run
9079    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9080    /// use wkt::Duration;
9081    /// let x = UpdateClusterRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
9082    /// ```
9083    pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
9084    where
9085        T: std::convert::Into<wkt::Duration>,
9086    {
9087        self.graceful_decommission_timeout = std::option::Option::Some(v.into());
9088        self
9089    }
9090
9091    /// Sets or clears the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
9092    ///
9093    /// # Example
9094    /// ```ignore,no_run
9095    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9096    /// use wkt::Duration;
9097    /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
9098    /// let x = UpdateClusterRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
9099    /// ```
9100    pub fn set_or_clear_graceful_decommission_timeout<T>(
9101        mut self,
9102        v: std::option::Option<T>,
9103    ) -> Self
9104    where
9105        T: std::convert::Into<wkt::Duration>,
9106    {
9107        self.graceful_decommission_timeout = v.map(|x| x.into());
9108        self
9109    }
9110
9111    /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9112    ///
9113    /// # Example
9114    /// ```ignore,no_run
9115    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9116    /// use wkt::FieldMask;
9117    /// let x = UpdateClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9118    /// ```
9119    pub fn set_update_mask<T>(mut self, v: T) -> Self
9120    where
9121        T: std::convert::Into<wkt::FieldMask>,
9122    {
9123        self.update_mask = std::option::Option::Some(v.into());
9124        self
9125    }
9126
9127    /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9128    ///
9129    /// # Example
9130    /// ```ignore,no_run
9131    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9132    /// use wkt::FieldMask;
9133    /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9134    /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9135    /// ```
9136    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9137    where
9138        T: std::convert::Into<wkt::FieldMask>,
9139    {
9140        self.update_mask = v.map(|x| x.into());
9141        self
9142    }
9143
9144    /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
9145    ///
9146    /// # Example
9147    /// ```ignore,no_run
9148    /// # use google_cloud_dataproc_v1::model::UpdateClusterRequest;
9149    /// let x = UpdateClusterRequest::new().set_request_id("example");
9150    /// ```
9151    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9152        self.request_id = v.into();
9153        self
9154    }
9155}
9156
9157impl wkt::message::Message for UpdateClusterRequest {
9158    fn typename() -> &'static str {
9159        "type.googleapis.com/google.cloud.dataproc.v1.UpdateClusterRequest"
9160    }
9161}
9162
9163/// A request to stop a cluster.
9164#[derive(Clone, Default, PartialEq)]
9165#[non_exhaustive]
9166pub struct StopClusterRequest {
9167    /// Required. The ID of the Google Cloud Platform project the
9168    /// cluster belongs to.
9169    pub project_id: std::string::String,
9170
9171    /// Required. The Dataproc region in which to handle the request.
9172    pub region: std::string::String,
9173
9174    /// Required. The cluster name.
9175    pub cluster_name: std::string::String,
9176
9177    /// Optional. Specifying the `cluster_uuid` means the RPC will fail
9178    /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
9179    pub cluster_uuid: std::string::String,
9180
9181    /// Optional. A unique ID used to identify the request. If the server
9182    /// receives two
9183    /// [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
9184    /// with the same id, then the second request will be ignored and the
9185    /// first [google.longrunning.Operation][google.longrunning.Operation] created
9186    /// and stored in the backend is returned.
9187    ///
9188    /// Recommendation: Set this value to a
9189    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9190    ///
9191    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9192    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9193    ///
9194    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9195    pub request_id: std::string::String,
9196
9197    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9198}
9199
9200impl StopClusterRequest {
9201    pub fn new() -> Self {
9202        std::default::Default::default()
9203    }
9204
9205    /// Sets the value of [project_id][crate::model::StopClusterRequest::project_id].
9206    ///
9207    /// # Example
9208    /// ```ignore,no_run
9209    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9210    /// let x = StopClusterRequest::new().set_project_id("example");
9211    /// ```
9212    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9213        self.project_id = v.into();
9214        self
9215    }
9216
9217    /// Sets the value of [region][crate::model::StopClusterRequest::region].
9218    ///
9219    /// # Example
9220    /// ```ignore,no_run
9221    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9222    /// let x = StopClusterRequest::new().set_region("example");
9223    /// ```
9224    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9225        self.region = v.into();
9226        self
9227    }
9228
9229    /// Sets the value of [cluster_name][crate::model::StopClusterRequest::cluster_name].
9230    ///
9231    /// # Example
9232    /// ```ignore,no_run
9233    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9234    /// let x = StopClusterRequest::new().set_cluster_name("example");
9235    /// ```
9236    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9237        self.cluster_name = v.into();
9238        self
9239    }
9240
9241    /// Sets the value of [cluster_uuid][crate::model::StopClusterRequest::cluster_uuid].
9242    ///
9243    /// # Example
9244    /// ```ignore,no_run
9245    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9246    /// let x = StopClusterRequest::new().set_cluster_uuid("example");
9247    /// ```
9248    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9249        self.cluster_uuid = v.into();
9250        self
9251    }
9252
9253    /// Sets the value of [request_id][crate::model::StopClusterRequest::request_id].
9254    ///
9255    /// # Example
9256    /// ```ignore,no_run
9257    /// # use google_cloud_dataproc_v1::model::StopClusterRequest;
9258    /// let x = StopClusterRequest::new().set_request_id("example");
9259    /// ```
9260    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9261        self.request_id = v.into();
9262        self
9263    }
9264}
9265
9266impl wkt::message::Message for StopClusterRequest {
9267    fn typename() -> &'static str {
9268        "type.googleapis.com/google.cloud.dataproc.v1.StopClusterRequest"
9269    }
9270}
9271
9272/// A request to start a cluster.
9273#[derive(Clone, Default, PartialEq)]
9274#[non_exhaustive]
9275pub struct StartClusterRequest {
9276    /// Required. The ID of the Google Cloud Platform project the
9277    /// cluster belongs to.
9278    pub project_id: std::string::String,
9279
9280    /// Required. The Dataproc region in which to handle the request.
9281    pub region: std::string::String,
9282
9283    /// Required. The cluster name.
9284    pub cluster_name: std::string::String,
9285
9286    /// Optional. Specifying the `cluster_uuid` means the RPC will fail
9287    /// (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
9288    pub cluster_uuid: std::string::String,
9289
9290    /// Optional. A unique ID used to identify the request. If the server
9291    /// receives two
9292    /// [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
9293    /// with the same id, then the second request will be ignored and the
9294    /// first [google.longrunning.Operation][google.longrunning.Operation] created
9295    /// and stored in the backend is returned.
9296    ///
9297    /// Recommendation: Set this value to a
9298    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9299    ///
9300    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9301    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9302    ///
9303    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9304    pub request_id: std::string::String,
9305
9306    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9307}
9308
9309impl StartClusterRequest {
9310    pub fn new() -> Self {
9311        std::default::Default::default()
9312    }
9313
9314    /// Sets the value of [project_id][crate::model::StartClusterRequest::project_id].
9315    ///
9316    /// # Example
9317    /// ```ignore,no_run
9318    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9319    /// let x = StartClusterRequest::new().set_project_id("example");
9320    /// ```
9321    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9322        self.project_id = v.into();
9323        self
9324    }
9325
9326    /// Sets the value of [region][crate::model::StartClusterRequest::region].
9327    ///
9328    /// # Example
9329    /// ```ignore,no_run
9330    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9331    /// let x = StartClusterRequest::new().set_region("example");
9332    /// ```
9333    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9334        self.region = v.into();
9335        self
9336    }
9337
9338    /// Sets the value of [cluster_name][crate::model::StartClusterRequest::cluster_name].
9339    ///
9340    /// # Example
9341    /// ```ignore,no_run
9342    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9343    /// let x = StartClusterRequest::new().set_cluster_name("example");
9344    /// ```
9345    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9346        self.cluster_name = v.into();
9347        self
9348    }
9349
9350    /// Sets the value of [cluster_uuid][crate::model::StartClusterRequest::cluster_uuid].
9351    ///
9352    /// # Example
9353    /// ```ignore,no_run
9354    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9355    /// let x = StartClusterRequest::new().set_cluster_uuid("example");
9356    /// ```
9357    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9358        self.cluster_uuid = v.into();
9359        self
9360    }
9361
9362    /// Sets the value of [request_id][crate::model::StartClusterRequest::request_id].
9363    ///
9364    /// # Example
9365    /// ```ignore,no_run
9366    /// # use google_cloud_dataproc_v1::model::StartClusterRequest;
9367    /// let x = StartClusterRequest::new().set_request_id("example");
9368    /// ```
9369    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9370        self.request_id = v.into();
9371        self
9372    }
9373}
9374
9375impl wkt::message::Message for StartClusterRequest {
9376    fn typename() -> &'static str {
9377        "type.googleapis.com/google.cloud.dataproc.v1.StartClusterRequest"
9378    }
9379}
9380
9381/// A request to delete a cluster.
9382#[derive(Clone, Default, PartialEq)]
9383#[non_exhaustive]
9384pub struct DeleteClusterRequest {
9385    /// Required. The ID of the Google Cloud Platform project that the cluster
9386    /// belongs to.
9387    pub project_id: std::string::String,
9388
9389    /// Required. The Dataproc region in which to handle the request.
9390    pub region: std::string::String,
9391
9392    /// Required. The cluster name.
9393    pub cluster_name: std::string::String,
9394
9395    /// Optional. Specifying the `cluster_uuid` means the RPC should fail
9396    /// (with error NOT_FOUND) if cluster with specified UUID does not exist.
9397    pub cluster_uuid: std::string::String,
9398
9399    /// Optional. A unique ID used to identify the request. If the server
9400    /// receives two
9401    /// [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
9402    /// with the same id, then the second request will be ignored and the
9403    /// first [google.longrunning.Operation][google.longrunning.Operation] created
9404    /// and stored in the backend is returned.
9405    ///
9406    /// It is recommended to always set this value to a
9407    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
9408    ///
9409    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
9410    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
9411    ///
9412    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
9413    pub request_id: std::string::String,
9414
9415    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9416}
9417
9418impl DeleteClusterRequest {
9419    pub fn new() -> Self {
9420        std::default::Default::default()
9421    }
9422
9423    /// Sets the value of [project_id][crate::model::DeleteClusterRequest::project_id].
9424    ///
9425    /// # Example
9426    /// ```ignore,no_run
9427    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9428    /// let x = DeleteClusterRequest::new().set_project_id("example");
9429    /// ```
9430    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9431        self.project_id = v.into();
9432        self
9433    }
9434
9435    /// Sets the value of [region][crate::model::DeleteClusterRequest::region].
9436    ///
9437    /// # Example
9438    /// ```ignore,no_run
9439    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9440    /// let x = DeleteClusterRequest::new().set_region("example");
9441    /// ```
9442    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9443        self.region = v.into();
9444        self
9445    }
9446
9447    /// Sets the value of [cluster_name][crate::model::DeleteClusterRequest::cluster_name].
9448    ///
9449    /// # Example
9450    /// ```ignore,no_run
9451    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9452    /// let x = DeleteClusterRequest::new().set_cluster_name("example");
9453    /// ```
9454    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9455        self.cluster_name = v.into();
9456        self
9457    }
9458
9459    /// Sets the value of [cluster_uuid][crate::model::DeleteClusterRequest::cluster_uuid].
9460    ///
9461    /// # Example
9462    /// ```ignore,no_run
9463    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9464    /// let x = DeleteClusterRequest::new().set_cluster_uuid("example");
9465    /// ```
9466    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9467        self.cluster_uuid = v.into();
9468        self
9469    }
9470
9471    /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
9472    ///
9473    /// # Example
9474    /// ```ignore,no_run
9475    /// # use google_cloud_dataproc_v1::model::DeleteClusterRequest;
9476    /// let x = DeleteClusterRequest::new().set_request_id("example");
9477    /// ```
9478    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9479        self.request_id = v.into();
9480        self
9481    }
9482}
9483
9484impl wkt::message::Message for DeleteClusterRequest {
9485    fn typename() -> &'static str {
9486        "type.googleapis.com/google.cloud.dataproc.v1.DeleteClusterRequest"
9487    }
9488}
9489
9490/// Request to get the resource representation for a cluster in a project.
9491#[derive(Clone, Default, PartialEq)]
9492#[non_exhaustive]
9493pub struct GetClusterRequest {
9494    /// Required. The ID of the Google Cloud Platform project that the cluster
9495    /// belongs to.
9496    pub project_id: std::string::String,
9497
9498    /// Required. The Dataproc region in which to handle the request.
9499    pub region: std::string::String,
9500
9501    /// Required. The cluster name.
9502    pub cluster_name: std::string::String,
9503
9504    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9505}
9506
9507impl GetClusterRequest {
9508    pub fn new() -> Self {
9509        std::default::Default::default()
9510    }
9511
9512    /// Sets the value of [project_id][crate::model::GetClusterRequest::project_id].
9513    ///
9514    /// # Example
9515    /// ```ignore,no_run
9516    /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9517    /// let x = GetClusterRequest::new().set_project_id("example");
9518    /// ```
9519    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9520        self.project_id = v.into();
9521        self
9522    }
9523
9524    /// Sets the value of [region][crate::model::GetClusterRequest::region].
9525    ///
9526    /// # Example
9527    /// ```ignore,no_run
9528    /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9529    /// let x = GetClusterRequest::new().set_region("example");
9530    /// ```
9531    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9532        self.region = v.into();
9533        self
9534    }
9535
9536    /// Sets the value of [cluster_name][crate::model::GetClusterRequest::cluster_name].
9537    ///
9538    /// # Example
9539    /// ```ignore,no_run
9540    /// # use google_cloud_dataproc_v1::model::GetClusterRequest;
9541    /// let x = GetClusterRequest::new().set_cluster_name("example");
9542    /// ```
9543    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9544        self.cluster_name = v.into();
9545        self
9546    }
9547}
9548
9549impl wkt::message::Message for GetClusterRequest {
9550    fn typename() -> &'static str {
9551        "type.googleapis.com/google.cloud.dataproc.v1.GetClusterRequest"
9552    }
9553}
9554
9555/// A request to list the clusters in a project.
9556#[derive(Clone, Default, PartialEq)]
9557#[non_exhaustive]
9558pub struct ListClustersRequest {
9559    /// Required. The ID of the Google Cloud Platform project that the cluster
9560    /// belongs to.
9561    pub project_id: std::string::String,
9562
9563    /// Required. The Dataproc region in which to handle the request.
9564    pub region: std::string::String,
9565
9566    /// Optional. A filter constraining the clusters to list. Filters are
9567    /// case-sensitive and have the following syntax:
9568    ///
9569    /// field = value [AND [field = value]] ...
9570    ///
9571    /// where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
9572    /// and `[KEY]` is a label key. **value** can be `*` to match all values.
9573    /// `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
9574    /// `CREATING`, `RUNNING`, `ERROR`, `DELETING`, `UPDATING`, `STOPPING`, or
9575    /// `STOPPED`. `ACTIVE` contains the `CREATING`, `UPDATING`, and `RUNNING`
9576    /// states. `INACTIVE` contains the `DELETING`, `ERROR`, `STOPPING`, and
9577    /// `STOPPED` states. `clusterName` is the name of the cluster provided at
9578    /// creation time. Only the logical `AND` operator is supported;
9579    /// space-separated items are treated as having an implicit `AND` operator.
9580    ///
9581    /// Example filter:
9582    ///
9583    /// status.state = ACTIVE AND clusterName = mycluster
9584    /// AND labels.env = staging AND labels.starred = *
9585    pub filter: std::string::String,
9586
9587    /// Optional. The standard List page size.
9588    pub page_size: i32,
9589
9590    /// Optional. The standard List page token.
9591    pub page_token: std::string::String,
9592
9593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9594}
9595
9596impl ListClustersRequest {
9597    pub fn new() -> Self {
9598        std::default::Default::default()
9599    }
9600
9601    /// Sets the value of [project_id][crate::model::ListClustersRequest::project_id].
9602    ///
9603    /// # Example
9604    /// ```ignore,no_run
9605    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9606    /// let x = ListClustersRequest::new().set_project_id("example");
9607    /// ```
9608    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9609        self.project_id = v.into();
9610        self
9611    }
9612
9613    /// Sets the value of [region][crate::model::ListClustersRequest::region].
9614    ///
9615    /// # Example
9616    /// ```ignore,no_run
9617    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9618    /// let x = ListClustersRequest::new().set_region("example");
9619    /// ```
9620    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9621        self.region = v.into();
9622        self
9623    }
9624
9625    /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
9626    ///
9627    /// # Example
9628    /// ```ignore,no_run
9629    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9630    /// let x = ListClustersRequest::new().set_filter("example");
9631    /// ```
9632    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9633        self.filter = v.into();
9634        self
9635    }
9636
9637    /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
9638    ///
9639    /// # Example
9640    /// ```ignore,no_run
9641    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9642    /// let x = ListClustersRequest::new().set_page_size(42);
9643    /// ```
9644    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9645        self.page_size = v.into();
9646        self
9647    }
9648
9649    /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
9650    ///
9651    /// # Example
9652    /// ```ignore,no_run
9653    /// # use google_cloud_dataproc_v1::model::ListClustersRequest;
9654    /// let x = ListClustersRequest::new().set_page_token("example");
9655    /// ```
9656    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9657        self.page_token = v.into();
9658        self
9659    }
9660}
9661
9662impl wkt::message::Message for ListClustersRequest {
9663    fn typename() -> &'static str {
9664        "type.googleapis.com/google.cloud.dataproc.v1.ListClustersRequest"
9665    }
9666}
9667
9668/// The list of all clusters in a project.
9669#[derive(Clone, Default, PartialEq)]
9670#[non_exhaustive]
9671pub struct ListClustersResponse {
9672    /// Output only. The clusters in the project.
9673    pub clusters: std::vec::Vec<crate::model::Cluster>,
9674
9675    /// Output only. This token is included in the response if there are more
9676    /// results to fetch. To fetch additional results, provide this value as the
9677    /// `page_token` in a subsequent `ListClustersRequest`.
9678    pub next_page_token: std::string::String,
9679
9680    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9681}
9682
9683impl ListClustersResponse {
9684    pub fn new() -> Self {
9685        std::default::Default::default()
9686    }
9687
9688    /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
9689    ///
9690    /// # Example
9691    /// ```ignore,no_run
9692    /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
9693    /// use google_cloud_dataproc_v1::model::Cluster;
9694    /// let x = ListClustersResponse::new()
9695    ///     .set_clusters([
9696    ///         Cluster::default()/* use setters */,
9697    ///         Cluster::default()/* use (different) setters */,
9698    ///     ]);
9699    /// ```
9700    pub fn set_clusters<T, V>(mut self, v: T) -> Self
9701    where
9702        T: std::iter::IntoIterator<Item = V>,
9703        V: std::convert::Into<crate::model::Cluster>,
9704    {
9705        use std::iter::Iterator;
9706        self.clusters = v.into_iter().map(|i| i.into()).collect();
9707        self
9708    }
9709
9710    /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
9711    ///
9712    /// # Example
9713    /// ```ignore,no_run
9714    /// # use google_cloud_dataproc_v1::model::ListClustersResponse;
9715    /// let x = ListClustersResponse::new().set_next_page_token("example");
9716    /// ```
9717    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9718        self.next_page_token = v.into();
9719        self
9720    }
9721}
9722
9723impl wkt::message::Message for ListClustersResponse {
9724    fn typename() -> &'static str {
9725        "type.googleapis.com/google.cloud.dataproc.v1.ListClustersResponse"
9726    }
9727}
9728
9729#[doc(hidden)]
9730impl google_cloud_gax::paginator::internal::PageableResponse for ListClustersResponse {
9731    type PageItem = crate::model::Cluster;
9732
9733    fn items(self) -> std::vec::Vec<Self::PageItem> {
9734        self.clusters
9735    }
9736
9737    fn next_page_token(&self) -> std::string::String {
9738        use std::clone::Clone;
9739        self.next_page_token.clone()
9740    }
9741}
9742
9743/// A request to collect cluster diagnostic information.
9744#[derive(Clone, Default, PartialEq)]
9745#[non_exhaustive]
9746pub struct DiagnoseClusterRequest {
9747    /// Required. The ID of the Google Cloud Platform project that the cluster
9748    /// belongs to.
9749    pub project_id: std::string::String,
9750
9751    /// Required. The Dataproc region in which to handle the request.
9752    pub region: std::string::String,
9753
9754    /// Required. The cluster name.
9755    pub cluster_name: std::string::String,
9756
9757    /// Optional. (Optional) The output Cloud Storage directory for the diagnostic
9758    /// tarball. If not specified, a task-specific directory in the cluster's
9759    /// staging bucket will be used.
9760    pub tarball_gcs_dir: std::string::String,
9761
9762    /// Optional. (Optional) The access type to the diagnostic tarball. If not
9763    /// specified, falls back to default access of the bucket
9764    pub tarball_access: crate::model::diagnose_cluster_request::TarballAccess,
9765
9766    /// Optional. Time interval in which diagnosis should be carried out on the
9767    /// cluster.
9768    pub diagnosis_interval: std::option::Option<google_cloud_type::model::Interval>,
9769
9770    /// Optional. Specifies a list of jobs on which diagnosis is to be performed.
9771    /// Format: projects/{project}/regions/{region}/jobs/{job}
9772    pub jobs: std::vec::Vec<std::string::String>,
9773
9774    /// Optional. Specifies a list of yarn applications on which diagnosis is to be
9775    /// performed.
9776    pub yarn_application_ids: std::vec::Vec<std::string::String>,
9777
9778    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9779}
9780
9781impl DiagnoseClusterRequest {
9782    pub fn new() -> Self {
9783        std::default::Default::default()
9784    }
9785
9786    /// Sets the value of [project_id][crate::model::DiagnoseClusterRequest::project_id].
9787    ///
9788    /// # Example
9789    /// ```ignore,no_run
9790    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9791    /// let x = DiagnoseClusterRequest::new().set_project_id("example");
9792    /// ```
9793    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9794        self.project_id = v.into();
9795        self
9796    }
9797
9798    /// Sets the value of [region][crate::model::DiagnoseClusterRequest::region].
9799    ///
9800    /// # Example
9801    /// ```ignore,no_run
9802    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9803    /// let x = DiagnoseClusterRequest::new().set_region("example");
9804    /// ```
9805    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9806        self.region = v.into();
9807        self
9808    }
9809
9810    /// Sets the value of [cluster_name][crate::model::DiagnoseClusterRequest::cluster_name].
9811    ///
9812    /// # Example
9813    /// ```ignore,no_run
9814    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9815    /// let x = DiagnoseClusterRequest::new().set_cluster_name("example");
9816    /// ```
9817    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9818        self.cluster_name = v.into();
9819        self
9820    }
9821
9822    /// Sets the value of [tarball_gcs_dir][crate::model::DiagnoseClusterRequest::tarball_gcs_dir].
9823    ///
9824    /// # Example
9825    /// ```ignore,no_run
9826    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9827    /// let x = DiagnoseClusterRequest::new().set_tarball_gcs_dir("example");
9828    /// ```
9829    pub fn set_tarball_gcs_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9830        self.tarball_gcs_dir = v.into();
9831        self
9832    }
9833
9834    /// Sets the value of [tarball_access][crate::model::DiagnoseClusterRequest::tarball_access].
9835    ///
9836    /// # Example
9837    /// ```ignore,no_run
9838    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9839    /// use google_cloud_dataproc_v1::model::diagnose_cluster_request::TarballAccess;
9840    /// let x0 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleCloudSupport);
9841    /// let x1 = DiagnoseClusterRequest::new().set_tarball_access(TarballAccess::GoogleDataprocDiagnose);
9842    /// ```
9843    pub fn set_tarball_access<
9844        T: std::convert::Into<crate::model::diagnose_cluster_request::TarballAccess>,
9845    >(
9846        mut self,
9847        v: T,
9848    ) -> Self {
9849        self.tarball_access = v.into();
9850        self
9851    }
9852
9853    /// Sets the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
9854    ///
9855    /// # Example
9856    /// ```ignore,no_run
9857    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9858    /// use google_cloud_type::model::Interval;
9859    /// let x = DiagnoseClusterRequest::new().set_diagnosis_interval(Interval::default()/* use setters */);
9860    /// ```
9861    pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
9862    where
9863        T: std::convert::Into<google_cloud_type::model::Interval>,
9864    {
9865        self.diagnosis_interval = std::option::Option::Some(v.into());
9866        self
9867    }
9868
9869    /// Sets or clears the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
9870    ///
9871    /// # Example
9872    /// ```ignore,no_run
9873    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9874    /// use google_cloud_type::model::Interval;
9875    /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(Some(Interval::default()/* use setters */));
9876    /// let x = DiagnoseClusterRequest::new().set_or_clear_diagnosis_interval(None::<Interval>);
9877    /// ```
9878    pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
9879    where
9880        T: std::convert::Into<google_cloud_type::model::Interval>,
9881    {
9882        self.diagnosis_interval = v.map(|x| x.into());
9883        self
9884    }
9885
9886    /// Sets the value of [jobs][crate::model::DiagnoseClusterRequest::jobs].
9887    ///
9888    /// # Example
9889    /// ```ignore,no_run
9890    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9891    /// let x = DiagnoseClusterRequest::new().set_jobs(["a", "b", "c"]);
9892    /// ```
9893    pub fn set_jobs<T, V>(mut self, v: T) -> Self
9894    where
9895        T: std::iter::IntoIterator<Item = V>,
9896        V: std::convert::Into<std::string::String>,
9897    {
9898        use std::iter::Iterator;
9899        self.jobs = v.into_iter().map(|i| i.into()).collect();
9900        self
9901    }
9902
9903    /// Sets the value of [yarn_application_ids][crate::model::DiagnoseClusterRequest::yarn_application_ids].
9904    ///
9905    /// # Example
9906    /// ```ignore,no_run
9907    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterRequest;
9908    /// let x = DiagnoseClusterRequest::new().set_yarn_application_ids(["a", "b", "c"]);
9909    /// ```
9910    pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
9911    where
9912        T: std::iter::IntoIterator<Item = V>,
9913        V: std::convert::Into<std::string::String>,
9914    {
9915        use std::iter::Iterator;
9916        self.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
9917        self
9918    }
9919}
9920
9921impl wkt::message::Message for DiagnoseClusterRequest {
9922    fn typename() -> &'static str {
9923        "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterRequest"
9924    }
9925}
9926
9927/// Defines additional types related to [DiagnoseClusterRequest].
9928pub mod diagnose_cluster_request {
9929    #[allow(unused_imports)]
9930    use super::*;
9931
9932    /// Defines who has access to the diagnostic tarball
9933    ///
9934    /// # Working with unknown values
9935    ///
9936    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9937    /// additional enum variants at any time. Adding new variants is not considered
9938    /// a breaking change. Applications should write their code in anticipation of:
9939    ///
9940    /// - New values appearing in future releases of the client library, **and**
9941    /// - New values received dynamically, without application changes.
9942    ///
9943    /// Please consult the [Working with enums] section in the user guide for some
9944    /// guidelines.
9945    ///
9946    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9947    #[derive(Clone, Debug, PartialEq)]
9948    #[non_exhaustive]
9949    pub enum TarballAccess {
9950        /// Tarball Access unspecified. Falls back to default access of the bucket
9951        Unspecified,
9952        /// Google Cloud Support group has read access to the
9953        /// diagnostic tarball
9954        GoogleCloudSupport,
9955        /// Google Cloud Dataproc Diagnose service account has read access to the
9956        /// diagnostic tarball
9957        GoogleDataprocDiagnose,
9958        /// If set, the enum was initialized with an unknown value.
9959        ///
9960        /// Applications can examine the value using [TarballAccess::value] or
9961        /// [TarballAccess::name].
9962        UnknownValue(tarball_access::UnknownValue),
9963    }
9964
9965    #[doc(hidden)]
9966    pub mod tarball_access {
9967        #[allow(unused_imports)]
9968        use super::*;
9969        #[derive(Clone, Debug, PartialEq)]
9970        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9971    }
9972
9973    impl TarballAccess {
9974        /// Gets the enum value.
9975        ///
9976        /// Returns `None` if the enum contains an unknown value deserialized from
9977        /// the string representation of enums.
9978        pub fn value(&self) -> std::option::Option<i32> {
9979            match self {
9980                Self::Unspecified => std::option::Option::Some(0),
9981                Self::GoogleCloudSupport => std::option::Option::Some(1),
9982                Self::GoogleDataprocDiagnose => std::option::Option::Some(2),
9983                Self::UnknownValue(u) => u.0.value(),
9984            }
9985        }
9986
9987        /// Gets the enum value as a string.
9988        ///
9989        /// Returns `None` if the enum contains an unknown value deserialized from
9990        /// the integer representation of enums.
9991        pub fn name(&self) -> std::option::Option<&str> {
9992            match self {
9993                Self::Unspecified => std::option::Option::Some("TARBALL_ACCESS_UNSPECIFIED"),
9994                Self::GoogleCloudSupport => std::option::Option::Some("GOOGLE_CLOUD_SUPPORT"),
9995                Self::GoogleDataprocDiagnose => {
9996                    std::option::Option::Some("GOOGLE_DATAPROC_DIAGNOSE")
9997                }
9998                Self::UnknownValue(u) => u.0.name(),
9999            }
10000        }
10001    }
10002
10003    impl std::default::Default for TarballAccess {
10004        fn default() -> Self {
10005            use std::convert::From;
10006            Self::from(0)
10007        }
10008    }
10009
10010    impl std::fmt::Display for TarballAccess {
10011        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10012            wkt::internal::display_enum(f, self.name(), self.value())
10013        }
10014    }
10015
10016    impl std::convert::From<i32> for TarballAccess {
10017        fn from(value: i32) -> Self {
10018            match value {
10019                0 => Self::Unspecified,
10020                1 => Self::GoogleCloudSupport,
10021                2 => Self::GoogleDataprocDiagnose,
10022                _ => Self::UnknownValue(tarball_access::UnknownValue(
10023                    wkt::internal::UnknownEnumValue::Integer(value),
10024                )),
10025            }
10026        }
10027    }
10028
10029    impl std::convert::From<&str> for TarballAccess {
10030        fn from(value: &str) -> Self {
10031            use std::string::ToString;
10032            match value {
10033                "TARBALL_ACCESS_UNSPECIFIED" => Self::Unspecified,
10034                "GOOGLE_CLOUD_SUPPORT" => Self::GoogleCloudSupport,
10035                "GOOGLE_DATAPROC_DIAGNOSE" => Self::GoogleDataprocDiagnose,
10036                _ => Self::UnknownValue(tarball_access::UnknownValue(
10037                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10038                )),
10039            }
10040        }
10041    }
10042
10043    impl serde::ser::Serialize for TarballAccess {
10044        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10045        where
10046            S: serde::Serializer,
10047        {
10048            match self {
10049                Self::Unspecified => serializer.serialize_i32(0),
10050                Self::GoogleCloudSupport => serializer.serialize_i32(1),
10051                Self::GoogleDataprocDiagnose => serializer.serialize_i32(2),
10052                Self::UnknownValue(u) => u.0.serialize(serializer),
10053            }
10054        }
10055    }
10056
10057    impl<'de> serde::de::Deserialize<'de> for TarballAccess {
10058        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10059        where
10060            D: serde::Deserializer<'de>,
10061        {
10062            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TarballAccess>::new(
10063                ".google.cloud.dataproc.v1.DiagnoseClusterRequest.TarballAccess",
10064            ))
10065        }
10066    }
10067}
10068
10069/// The location of diagnostic output.
10070#[derive(Clone, Default, PartialEq)]
10071#[non_exhaustive]
10072pub struct DiagnoseClusterResults {
10073    /// Output only. The Cloud Storage URI of the diagnostic output.
10074    /// The output report is a plain text file with a summary of collected
10075    /// diagnostics.
10076    pub output_uri: std::string::String,
10077
10078    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10079}
10080
10081impl DiagnoseClusterResults {
10082    pub fn new() -> Self {
10083        std::default::Default::default()
10084    }
10085
10086    /// Sets the value of [output_uri][crate::model::DiagnoseClusterResults::output_uri].
10087    ///
10088    /// # Example
10089    /// ```ignore,no_run
10090    /// # use google_cloud_dataproc_v1::model::DiagnoseClusterResults;
10091    /// let x = DiagnoseClusterResults::new().set_output_uri("example");
10092    /// ```
10093    pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10094        self.output_uri = v.into();
10095        self
10096    }
10097}
10098
10099impl wkt::message::Message for DiagnoseClusterResults {
10100    fn typename() -> &'static str {
10101        "type.googleapis.com/google.cloud.dataproc.v1.DiagnoseClusterResults"
10102    }
10103}
10104
10105/// Reservation Affinity for consuming Zonal reservation.
10106#[derive(Clone, Default, PartialEq)]
10107#[non_exhaustive]
10108pub struct ReservationAffinity {
10109    /// Optional. Type of reservation to consume
10110    pub consume_reservation_type: crate::model::reservation_affinity::Type,
10111
10112    /// Optional. Corresponds to the label key of reservation resource.
10113    pub key: std::string::String,
10114
10115    /// Optional. Corresponds to the label values of reservation resource.
10116    pub values: std::vec::Vec<std::string::String>,
10117
10118    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10119}
10120
10121impl ReservationAffinity {
10122    pub fn new() -> Self {
10123        std::default::Default::default()
10124    }
10125
10126    /// Sets the value of [consume_reservation_type][crate::model::ReservationAffinity::consume_reservation_type].
10127    ///
10128    /// # Example
10129    /// ```ignore,no_run
10130    /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10131    /// use google_cloud_dataproc_v1::model::reservation_affinity::Type;
10132    /// let x0 = ReservationAffinity::new().set_consume_reservation_type(Type::NoReservation);
10133    /// let x1 = ReservationAffinity::new().set_consume_reservation_type(Type::AnyReservation);
10134    /// let x2 = ReservationAffinity::new().set_consume_reservation_type(Type::SpecificReservation);
10135    /// ```
10136    pub fn set_consume_reservation_type<
10137        T: std::convert::Into<crate::model::reservation_affinity::Type>,
10138    >(
10139        mut self,
10140        v: T,
10141    ) -> Self {
10142        self.consume_reservation_type = v.into();
10143        self
10144    }
10145
10146    /// Sets the value of [key][crate::model::ReservationAffinity::key].
10147    ///
10148    /// # Example
10149    /// ```ignore,no_run
10150    /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10151    /// let x = ReservationAffinity::new().set_key("example");
10152    /// ```
10153    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10154        self.key = v.into();
10155        self
10156    }
10157
10158    /// Sets the value of [values][crate::model::ReservationAffinity::values].
10159    ///
10160    /// # Example
10161    /// ```ignore,no_run
10162    /// # use google_cloud_dataproc_v1::model::ReservationAffinity;
10163    /// let x = ReservationAffinity::new().set_values(["a", "b", "c"]);
10164    /// ```
10165    pub fn set_values<T, V>(mut self, v: T) -> Self
10166    where
10167        T: std::iter::IntoIterator<Item = V>,
10168        V: std::convert::Into<std::string::String>,
10169    {
10170        use std::iter::Iterator;
10171        self.values = v.into_iter().map(|i| i.into()).collect();
10172        self
10173    }
10174}
10175
10176impl wkt::message::Message for ReservationAffinity {
10177    fn typename() -> &'static str {
10178        "type.googleapis.com/google.cloud.dataproc.v1.ReservationAffinity"
10179    }
10180}
10181
10182/// Defines additional types related to [ReservationAffinity].
10183pub mod reservation_affinity {
10184    #[allow(unused_imports)]
10185    use super::*;
10186
10187    /// Indicates whether to consume capacity from an reservation or not.
10188    ///
10189    /// # Working with unknown values
10190    ///
10191    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10192    /// additional enum variants at any time. Adding new variants is not considered
10193    /// a breaking change. Applications should write their code in anticipation of:
10194    ///
10195    /// - New values appearing in future releases of the client library, **and**
10196    /// - New values received dynamically, without application changes.
10197    ///
10198    /// Please consult the [Working with enums] section in the user guide for some
10199    /// guidelines.
10200    ///
10201    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10202    #[derive(Clone, Debug, PartialEq)]
10203    #[non_exhaustive]
10204    pub enum Type {
10205        Unspecified,
10206        /// Do not consume from any allocated capacity.
10207        NoReservation,
10208        /// Consume any reservation available.
10209        AnyReservation,
10210        /// Must consume from a specific reservation. Must specify key value fields
10211        /// for specifying the reservations.
10212        SpecificReservation,
10213        /// If set, the enum was initialized with an unknown value.
10214        ///
10215        /// Applications can examine the value using [Type::value] or
10216        /// [Type::name].
10217        UnknownValue(r#type::UnknownValue),
10218    }
10219
10220    #[doc(hidden)]
10221    pub mod r#type {
10222        #[allow(unused_imports)]
10223        use super::*;
10224        #[derive(Clone, Debug, PartialEq)]
10225        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10226    }
10227
10228    impl Type {
10229        /// Gets the enum value.
10230        ///
10231        /// Returns `None` if the enum contains an unknown value deserialized from
10232        /// the string representation of enums.
10233        pub fn value(&self) -> std::option::Option<i32> {
10234            match self {
10235                Self::Unspecified => std::option::Option::Some(0),
10236                Self::NoReservation => std::option::Option::Some(1),
10237                Self::AnyReservation => std::option::Option::Some(2),
10238                Self::SpecificReservation => std::option::Option::Some(3),
10239                Self::UnknownValue(u) => u.0.value(),
10240            }
10241        }
10242
10243        /// Gets the enum value as a string.
10244        ///
10245        /// Returns `None` if the enum contains an unknown value deserialized from
10246        /// the integer representation of enums.
10247        pub fn name(&self) -> std::option::Option<&str> {
10248            match self {
10249                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
10250                Self::NoReservation => std::option::Option::Some("NO_RESERVATION"),
10251                Self::AnyReservation => std::option::Option::Some("ANY_RESERVATION"),
10252                Self::SpecificReservation => std::option::Option::Some("SPECIFIC_RESERVATION"),
10253                Self::UnknownValue(u) => u.0.name(),
10254            }
10255        }
10256    }
10257
10258    impl std::default::Default for Type {
10259        fn default() -> Self {
10260            use std::convert::From;
10261            Self::from(0)
10262        }
10263    }
10264
10265    impl std::fmt::Display for Type {
10266        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10267            wkt::internal::display_enum(f, self.name(), self.value())
10268        }
10269    }
10270
10271    impl std::convert::From<i32> for Type {
10272        fn from(value: i32) -> Self {
10273            match value {
10274                0 => Self::Unspecified,
10275                1 => Self::NoReservation,
10276                2 => Self::AnyReservation,
10277                3 => Self::SpecificReservation,
10278                _ => Self::UnknownValue(r#type::UnknownValue(
10279                    wkt::internal::UnknownEnumValue::Integer(value),
10280                )),
10281            }
10282        }
10283    }
10284
10285    impl std::convert::From<&str> for Type {
10286        fn from(value: &str) -> Self {
10287            use std::string::ToString;
10288            match value {
10289                "TYPE_UNSPECIFIED" => Self::Unspecified,
10290                "NO_RESERVATION" => Self::NoReservation,
10291                "ANY_RESERVATION" => Self::AnyReservation,
10292                "SPECIFIC_RESERVATION" => Self::SpecificReservation,
10293                _ => Self::UnknownValue(r#type::UnknownValue(
10294                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10295                )),
10296            }
10297        }
10298    }
10299
10300    impl serde::ser::Serialize for Type {
10301        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10302        where
10303            S: serde::Serializer,
10304        {
10305            match self {
10306                Self::Unspecified => serializer.serialize_i32(0),
10307                Self::NoReservation => serializer.serialize_i32(1),
10308                Self::AnyReservation => serializer.serialize_i32(2),
10309                Self::SpecificReservation => serializer.serialize_i32(3),
10310                Self::UnknownValue(u) => u.0.serialize(serializer),
10311            }
10312        }
10313    }
10314
10315    impl<'de> serde::de::Deserialize<'de> for Type {
10316        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10317        where
10318            D: serde::Deserializer<'de>,
10319        {
10320            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
10321                ".google.cloud.dataproc.v1.ReservationAffinity.Type",
10322            ))
10323        }
10324    }
10325}
10326
10327/// The runtime logging config of the job.
10328#[derive(Clone, Default, PartialEq)]
10329#[non_exhaustive]
10330pub struct LoggingConfig {
10331    /// The per-package log levels for the driver. This can include
10332    /// "root" package name to configure rootLogger.
10333    /// Examples:
10334    ///
10335    /// - 'com.google = FATAL'
10336    /// - 'root = INFO'
10337    /// - 'org.apache = DEBUG'
10338    pub driver_log_levels:
10339        std::collections::HashMap<std::string::String, crate::model::logging_config::Level>,
10340
10341    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10342}
10343
10344impl LoggingConfig {
10345    pub fn new() -> Self {
10346        std::default::Default::default()
10347    }
10348
10349    /// Sets the value of [driver_log_levels][crate::model::LoggingConfig::driver_log_levels].
10350    ///
10351    /// # Example
10352    /// ```ignore,no_run
10353    /// # use google_cloud_dataproc_v1::model::LoggingConfig;
10354    /// use google_cloud_dataproc_v1::model::logging_config::Level;
10355    /// let x = LoggingConfig::new().set_driver_log_levels([
10356    ///     ("key0", Level::All),
10357    ///     ("key1", Level::Trace),
10358    ///     ("key2", Level::Debug),
10359    /// ]);
10360    /// ```
10361    pub fn set_driver_log_levels<T, K, V>(mut self, v: T) -> Self
10362    where
10363        T: std::iter::IntoIterator<Item = (K, V)>,
10364        K: std::convert::Into<std::string::String>,
10365        V: std::convert::Into<crate::model::logging_config::Level>,
10366    {
10367        use std::iter::Iterator;
10368        self.driver_log_levels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10369        self
10370    }
10371}
10372
10373impl wkt::message::Message for LoggingConfig {
10374    fn typename() -> &'static str {
10375        "type.googleapis.com/google.cloud.dataproc.v1.LoggingConfig"
10376    }
10377}
10378
10379/// Defines additional types related to [LoggingConfig].
10380pub mod logging_config {
10381    #[allow(unused_imports)]
10382    use super::*;
10383
10384    /// The Log4j level for job execution. When running an
10385    /// [Apache Hive](https://hive.apache.org/) job, Cloud
10386    /// Dataproc configures the Hive client to an equivalent verbosity level.
10387    ///
10388    /// # Working with unknown values
10389    ///
10390    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10391    /// additional enum variants at any time. Adding new variants is not considered
10392    /// a breaking change. Applications should write their code in anticipation of:
10393    ///
10394    /// - New values appearing in future releases of the client library, **and**
10395    /// - New values received dynamically, without application changes.
10396    ///
10397    /// Please consult the [Working with enums] section in the user guide for some
10398    /// guidelines.
10399    ///
10400    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10401    #[derive(Clone, Debug, PartialEq)]
10402    #[non_exhaustive]
10403    pub enum Level {
10404        /// Level is unspecified. Use default level for log4j.
10405        Unspecified,
10406        /// Use ALL level for log4j.
10407        All,
10408        /// Use TRACE level for log4j.
10409        Trace,
10410        /// Use DEBUG level for log4j.
10411        Debug,
10412        /// Use INFO level for log4j.
10413        Info,
10414        /// Use WARN level for log4j.
10415        Warn,
10416        /// Use ERROR level for log4j.
10417        Error,
10418        /// Use FATAL level for log4j.
10419        Fatal,
10420        /// Turn off log4j.
10421        Off,
10422        /// If set, the enum was initialized with an unknown value.
10423        ///
10424        /// Applications can examine the value using [Level::value] or
10425        /// [Level::name].
10426        UnknownValue(level::UnknownValue),
10427    }
10428
10429    #[doc(hidden)]
10430    pub mod level {
10431        #[allow(unused_imports)]
10432        use super::*;
10433        #[derive(Clone, Debug, PartialEq)]
10434        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10435    }
10436
10437    impl Level {
10438        /// Gets the enum value.
10439        ///
10440        /// Returns `None` if the enum contains an unknown value deserialized from
10441        /// the string representation of enums.
10442        pub fn value(&self) -> std::option::Option<i32> {
10443            match self {
10444                Self::Unspecified => std::option::Option::Some(0),
10445                Self::All => std::option::Option::Some(1),
10446                Self::Trace => std::option::Option::Some(2),
10447                Self::Debug => std::option::Option::Some(3),
10448                Self::Info => std::option::Option::Some(4),
10449                Self::Warn => std::option::Option::Some(5),
10450                Self::Error => std::option::Option::Some(6),
10451                Self::Fatal => std::option::Option::Some(7),
10452                Self::Off => std::option::Option::Some(8),
10453                Self::UnknownValue(u) => u.0.value(),
10454            }
10455        }
10456
10457        /// Gets the enum value as a string.
10458        ///
10459        /// Returns `None` if the enum contains an unknown value deserialized from
10460        /// the integer representation of enums.
10461        pub fn name(&self) -> std::option::Option<&str> {
10462            match self {
10463                Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
10464                Self::All => std::option::Option::Some("ALL"),
10465                Self::Trace => std::option::Option::Some("TRACE"),
10466                Self::Debug => std::option::Option::Some("DEBUG"),
10467                Self::Info => std::option::Option::Some("INFO"),
10468                Self::Warn => std::option::Option::Some("WARN"),
10469                Self::Error => std::option::Option::Some("ERROR"),
10470                Self::Fatal => std::option::Option::Some("FATAL"),
10471                Self::Off => std::option::Option::Some("OFF"),
10472                Self::UnknownValue(u) => u.0.name(),
10473            }
10474        }
10475    }
10476
10477    impl std::default::Default for Level {
10478        fn default() -> Self {
10479            use std::convert::From;
10480            Self::from(0)
10481        }
10482    }
10483
10484    impl std::fmt::Display for Level {
10485        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10486            wkt::internal::display_enum(f, self.name(), self.value())
10487        }
10488    }
10489
10490    impl std::convert::From<i32> for Level {
10491        fn from(value: i32) -> Self {
10492            match value {
10493                0 => Self::Unspecified,
10494                1 => Self::All,
10495                2 => Self::Trace,
10496                3 => Self::Debug,
10497                4 => Self::Info,
10498                5 => Self::Warn,
10499                6 => Self::Error,
10500                7 => Self::Fatal,
10501                8 => Self::Off,
10502                _ => Self::UnknownValue(level::UnknownValue(
10503                    wkt::internal::UnknownEnumValue::Integer(value),
10504                )),
10505            }
10506        }
10507    }
10508
10509    impl std::convert::From<&str> for Level {
10510        fn from(value: &str) -> Self {
10511            use std::string::ToString;
10512            match value {
10513                "LEVEL_UNSPECIFIED" => Self::Unspecified,
10514                "ALL" => Self::All,
10515                "TRACE" => Self::Trace,
10516                "DEBUG" => Self::Debug,
10517                "INFO" => Self::Info,
10518                "WARN" => Self::Warn,
10519                "ERROR" => Self::Error,
10520                "FATAL" => Self::Fatal,
10521                "OFF" => Self::Off,
10522                _ => Self::UnknownValue(level::UnknownValue(
10523                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10524                )),
10525            }
10526        }
10527    }
10528
10529    impl serde::ser::Serialize for Level {
10530        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10531        where
10532            S: serde::Serializer,
10533        {
10534            match self {
10535                Self::Unspecified => serializer.serialize_i32(0),
10536                Self::All => serializer.serialize_i32(1),
10537                Self::Trace => serializer.serialize_i32(2),
10538                Self::Debug => serializer.serialize_i32(3),
10539                Self::Info => serializer.serialize_i32(4),
10540                Self::Warn => serializer.serialize_i32(5),
10541                Self::Error => serializer.serialize_i32(6),
10542                Self::Fatal => serializer.serialize_i32(7),
10543                Self::Off => serializer.serialize_i32(8),
10544                Self::UnknownValue(u) => u.0.serialize(serializer),
10545            }
10546        }
10547    }
10548
10549    impl<'de> serde::de::Deserialize<'de> for Level {
10550        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10551        where
10552            D: serde::Deserializer<'de>,
10553        {
10554            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
10555                ".google.cloud.dataproc.v1.LoggingConfig.Level",
10556            ))
10557        }
10558    }
10559}
10560
10561/// A Dataproc job for running
10562/// [Apache Hadoop
10563/// MapReduce](https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html)
10564/// jobs on [Apache Hadoop
10565/// YARN](https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).
10566#[derive(Clone, Default, PartialEq)]
10567#[non_exhaustive]
10568pub struct HadoopJob {
10569    /// Optional. The arguments to pass to the driver. Do not
10570    /// include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as
10571    /// job properties, since a collision might occur that causes an incorrect job
10572    /// submission.
10573    pub args: std::vec::Vec<std::string::String>,
10574
10575    /// Optional. Jar file URIs to add to the CLASSPATHs of the
10576    /// Hadoop driver and tasks.
10577    pub jar_file_uris: std::vec::Vec<std::string::String>,
10578
10579    /// Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied
10580    /// to the working directory of Hadoop drivers and distributed tasks. Useful
10581    /// for naively parallel tasks.
10582    pub file_uris: std::vec::Vec<std::string::String>,
10583
10584    /// Optional. HCFS URIs of archives to be extracted in the working directory of
10585    /// Hadoop drivers and tasks. Supported file types:
10586    /// .jar, .tar, .tar.gz, .tgz, or .zip.
10587    pub archive_uris: std::vec::Vec<std::string::String>,
10588
10589    /// Optional. A mapping of property names to values, used to configure Hadoop.
10590    /// Properties that conflict with values set by the Dataproc API might be
10591    /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site` and
10592    /// classes in user code.
10593    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10594
10595    /// Optional. The runtime log config for job execution.
10596    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10597
10598    /// Required. Indicates the location of the driver's main class. Specify
10599    /// either the jar file that contains the main class or the main class name.
10600    /// To specify both, add the jar file to `jar_file_uris`, and then specify
10601    /// the main class name in this property.
10602    pub driver: std::option::Option<crate::model::hadoop_job::Driver>,
10603
10604    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10605}
10606
10607impl HadoopJob {
10608    pub fn new() -> Self {
10609        std::default::Default::default()
10610    }
10611
10612    /// Sets the value of [args][crate::model::HadoopJob::args].
10613    ///
10614    /// # Example
10615    /// ```ignore,no_run
10616    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10617    /// let x = HadoopJob::new().set_args(["a", "b", "c"]);
10618    /// ```
10619    pub fn set_args<T, V>(mut self, v: T) -> Self
10620    where
10621        T: std::iter::IntoIterator<Item = V>,
10622        V: std::convert::Into<std::string::String>,
10623    {
10624        use std::iter::Iterator;
10625        self.args = v.into_iter().map(|i| i.into()).collect();
10626        self
10627    }
10628
10629    /// Sets the value of [jar_file_uris][crate::model::HadoopJob::jar_file_uris].
10630    ///
10631    /// # Example
10632    /// ```ignore,no_run
10633    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10634    /// let x = HadoopJob::new().set_jar_file_uris(["a", "b", "c"]);
10635    /// ```
10636    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10637    where
10638        T: std::iter::IntoIterator<Item = V>,
10639        V: std::convert::Into<std::string::String>,
10640    {
10641        use std::iter::Iterator;
10642        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10643        self
10644    }
10645
10646    /// Sets the value of [file_uris][crate::model::HadoopJob::file_uris].
10647    ///
10648    /// # Example
10649    /// ```ignore,no_run
10650    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10651    /// let x = HadoopJob::new().set_file_uris(["a", "b", "c"]);
10652    /// ```
10653    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10654    where
10655        T: std::iter::IntoIterator<Item = V>,
10656        V: std::convert::Into<std::string::String>,
10657    {
10658        use std::iter::Iterator;
10659        self.file_uris = v.into_iter().map(|i| i.into()).collect();
10660        self
10661    }
10662
10663    /// Sets the value of [archive_uris][crate::model::HadoopJob::archive_uris].
10664    ///
10665    /// # Example
10666    /// ```ignore,no_run
10667    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10668    /// let x = HadoopJob::new().set_archive_uris(["a", "b", "c"]);
10669    /// ```
10670    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10671    where
10672        T: std::iter::IntoIterator<Item = V>,
10673        V: std::convert::Into<std::string::String>,
10674    {
10675        use std::iter::Iterator;
10676        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10677        self
10678    }
10679
10680    /// Sets the value of [properties][crate::model::HadoopJob::properties].
10681    ///
10682    /// # Example
10683    /// ```ignore,no_run
10684    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10685    /// let x = HadoopJob::new().set_properties([
10686    ///     ("key0", "abc"),
10687    ///     ("key1", "xyz"),
10688    /// ]);
10689    /// ```
10690    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10691    where
10692        T: std::iter::IntoIterator<Item = (K, V)>,
10693        K: std::convert::Into<std::string::String>,
10694        V: std::convert::Into<std::string::String>,
10695    {
10696        use std::iter::Iterator;
10697        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10698        self
10699    }
10700
10701    /// Sets the value of [logging_config][crate::model::HadoopJob::logging_config].
10702    ///
10703    /// # Example
10704    /// ```ignore,no_run
10705    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10706    /// use google_cloud_dataproc_v1::model::LoggingConfig;
10707    /// let x = HadoopJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10708    /// ```
10709    pub fn set_logging_config<T>(mut self, v: T) -> Self
10710    where
10711        T: std::convert::Into<crate::model::LoggingConfig>,
10712    {
10713        self.logging_config = std::option::Option::Some(v.into());
10714        self
10715    }
10716
10717    /// Sets or clears the value of [logging_config][crate::model::HadoopJob::logging_config].
10718    ///
10719    /// # Example
10720    /// ```ignore,no_run
10721    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10722    /// use google_cloud_dataproc_v1::model::LoggingConfig;
10723    /// let x = HadoopJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
10724    /// let x = HadoopJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
10725    /// ```
10726    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
10727    where
10728        T: std::convert::Into<crate::model::LoggingConfig>,
10729    {
10730        self.logging_config = v.map(|x| x.into());
10731        self
10732    }
10733
10734    /// Sets the value of [driver][crate::model::HadoopJob::driver].
10735    ///
10736    /// Note that all the setters affecting `driver` are mutually
10737    /// exclusive.
10738    ///
10739    /// # Example
10740    /// ```ignore,no_run
10741    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10742    /// use google_cloud_dataproc_v1::model::hadoop_job::Driver;
10743    /// let x = HadoopJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
10744    /// ```
10745    pub fn set_driver<
10746        T: std::convert::Into<std::option::Option<crate::model::hadoop_job::Driver>>,
10747    >(
10748        mut self,
10749        v: T,
10750    ) -> Self {
10751        self.driver = v.into();
10752        self
10753    }
10754
10755    /// The value of [driver][crate::model::HadoopJob::driver]
10756    /// if it holds a `MainJarFileUri`, `None` if the field is not set or
10757    /// holds a different branch.
10758    pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
10759        #[allow(unreachable_patterns)]
10760        self.driver.as_ref().and_then(|v| match v {
10761            crate::model::hadoop_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
10762            _ => std::option::Option::None,
10763        })
10764    }
10765
10766    /// Sets the value of [driver][crate::model::HadoopJob::driver]
10767    /// to hold a `MainJarFileUri`.
10768    ///
10769    /// Note that all the setters affecting `driver` are
10770    /// mutually exclusive.
10771    ///
10772    /// # Example
10773    /// ```ignore,no_run
10774    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10775    /// let x = HadoopJob::new().set_main_jar_file_uri("example");
10776    /// assert!(x.main_jar_file_uri().is_some());
10777    /// assert!(x.main_class().is_none());
10778    /// ```
10779    pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
10780        mut self,
10781        v: T,
10782    ) -> Self {
10783        self.driver =
10784            std::option::Option::Some(crate::model::hadoop_job::Driver::MainJarFileUri(v.into()));
10785        self
10786    }
10787
10788    /// The value of [driver][crate::model::HadoopJob::driver]
10789    /// if it holds a `MainClass`, `None` if the field is not set or
10790    /// holds a different branch.
10791    pub fn main_class(&self) -> std::option::Option<&std::string::String> {
10792        #[allow(unreachable_patterns)]
10793        self.driver.as_ref().and_then(|v| match v {
10794            crate::model::hadoop_job::Driver::MainClass(v) => std::option::Option::Some(v),
10795            _ => std::option::Option::None,
10796        })
10797    }
10798
10799    /// Sets the value of [driver][crate::model::HadoopJob::driver]
10800    /// to hold a `MainClass`.
10801    ///
10802    /// Note that all the setters affecting `driver` are
10803    /// mutually exclusive.
10804    ///
10805    /// # Example
10806    /// ```ignore,no_run
10807    /// # use google_cloud_dataproc_v1::model::HadoopJob;
10808    /// let x = HadoopJob::new().set_main_class("example");
10809    /// assert!(x.main_class().is_some());
10810    /// assert!(x.main_jar_file_uri().is_none());
10811    /// ```
10812    pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10813        self.driver =
10814            std::option::Option::Some(crate::model::hadoop_job::Driver::MainClass(v.into()));
10815        self
10816    }
10817}
10818
10819impl wkt::message::Message for HadoopJob {
10820    fn typename() -> &'static str {
10821        "type.googleapis.com/google.cloud.dataproc.v1.HadoopJob"
10822    }
10823}
10824
10825/// Defines additional types related to [HadoopJob].
10826pub mod hadoop_job {
10827    #[allow(unused_imports)]
10828    use super::*;
10829
10830    /// Required. Indicates the location of the driver's main class. Specify
10831    /// either the jar file that contains the main class or the main class name.
10832    /// To specify both, add the jar file to `jar_file_uris`, and then specify
10833    /// the main class name in this property.
10834    #[derive(Clone, Debug, PartialEq)]
10835    #[non_exhaustive]
10836    pub enum Driver {
10837        /// The HCFS URI of the jar file containing the main class.
10838        /// Examples:
10839        /// 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar'
10840        /// 'hdfs:/tmp/test-samples/custom-wordcount.jar'
10841        /// 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar'
10842        MainJarFileUri(std::string::String),
10843        /// The name of the driver's main class. The jar file containing the class
10844        /// must be in the default CLASSPATH or specified in `jar_file_uris`.
10845        MainClass(std::string::String),
10846    }
10847}
10848
10849/// A Dataproc job for running [Apache Spark](https://spark.apache.org/)
10850/// applications on YARN.
10851#[derive(Clone, Default, PartialEq)]
10852#[non_exhaustive]
10853pub struct SparkJob {
10854    /// Optional. The arguments to pass to the driver. Do not include arguments,
10855    /// such as `--conf`, that can be set as job properties, since a collision may
10856    /// occur that causes an incorrect job submission.
10857    pub args: std::vec::Vec<std::string::String>,
10858
10859    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
10860    /// Spark driver and tasks.
10861    pub jar_file_uris: std::vec::Vec<std::string::String>,
10862
10863    /// Optional. HCFS URIs of files to be placed in the working directory of
10864    /// each executor. Useful for naively parallel tasks.
10865    pub file_uris: std::vec::Vec<std::string::String>,
10866
10867    /// Optional. HCFS URIs of archives to be extracted into the working directory
10868    /// of each executor. Supported file types:
10869    /// .jar, .tar, .tar.gz, .tgz, and .zip.
10870    pub archive_uris: std::vec::Vec<std::string::String>,
10871
10872    /// Optional. A mapping of property names to values, used to configure Spark.
10873    /// Properties that conflict with values set by the Dataproc API might be
10874    /// overwritten. Can include properties set in
10875    /// /etc/spark/conf/spark-defaults.conf and classes in user code.
10876    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
10877
10878    /// Optional. The runtime log config for job execution.
10879    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
10880
10881    /// Required. The specification of the main method to call to drive the job.
10882    /// Specify either the jar file that contains the main class or the main class
10883    /// name. To pass both a main jar and a main class in that jar, add the jar to
10884    /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
10885    /// specify the main class name in
10886    /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
10887    ///
10888    /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
10889    /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
10890    pub driver: std::option::Option<crate::model::spark_job::Driver>,
10891
10892    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10893}
10894
10895impl SparkJob {
10896    pub fn new() -> Self {
10897        std::default::Default::default()
10898    }
10899
10900    /// Sets the value of [args][crate::model::SparkJob::args].
10901    ///
10902    /// # Example
10903    /// ```ignore,no_run
10904    /// # use google_cloud_dataproc_v1::model::SparkJob;
10905    /// let x = SparkJob::new().set_args(["a", "b", "c"]);
10906    /// ```
10907    pub fn set_args<T, V>(mut self, v: T) -> Self
10908    where
10909        T: std::iter::IntoIterator<Item = V>,
10910        V: std::convert::Into<std::string::String>,
10911    {
10912        use std::iter::Iterator;
10913        self.args = v.into_iter().map(|i| i.into()).collect();
10914        self
10915    }
10916
10917    /// Sets the value of [jar_file_uris][crate::model::SparkJob::jar_file_uris].
10918    ///
10919    /// # Example
10920    /// ```ignore,no_run
10921    /// # use google_cloud_dataproc_v1::model::SparkJob;
10922    /// let x = SparkJob::new().set_jar_file_uris(["a", "b", "c"]);
10923    /// ```
10924    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
10925    where
10926        T: std::iter::IntoIterator<Item = V>,
10927        V: std::convert::Into<std::string::String>,
10928    {
10929        use std::iter::Iterator;
10930        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
10931        self
10932    }
10933
10934    /// Sets the value of [file_uris][crate::model::SparkJob::file_uris].
10935    ///
10936    /// # Example
10937    /// ```ignore,no_run
10938    /// # use google_cloud_dataproc_v1::model::SparkJob;
10939    /// let x = SparkJob::new().set_file_uris(["a", "b", "c"]);
10940    /// ```
10941    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
10942    where
10943        T: std::iter::IntoIterator<Item = V>,
10944        V: std::convert::Into<std::string::String>,
10945    {
10946        use std::iter::Iterator;
10947        self.file_uris = v.into_iter().map(|i| i.into()).collect();
10948        self
10949    }
10950
10951    /// Sets the value of [archive_uris][crate::model::SparkJob::archive_uris].
10952    ///
10953    /// # Example
10954    /// ```ignore,no_run
10955    /// # use google_cloud_dataproc_v1::model::SparkJob;
10956    /// let x = SparkJob::new().set_archive_uris(["a", "b", "c"]);
10957    /// ```
10958    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
10959    where
10960        T: std::iter::IntoIterator<Item = V>,
10961        V: std::convert::Into<std::string::String>,
10962    {
10963        use std::iter::Iterator;
10964        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
10965        self
10966    }
10967
10968    /// Sets the value of [properties][crate::model::SparkJob::properties].
10969    ///
10970    /// # Example
10971    /// ```ignore,no_run
10972    /// # use google_cloud_dataproc_v1::model::SparkJob;
10973    /// let x = SparkJob::new().set_properties([
10974    ///     ("key0", "abc"),
10975    ///     ("key1", "xyz"),
10976    /// ]);
10977    /// ```
10978    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
10979    where
10980        T: std::iter::IntoIterator<Item = (K, V)>,
10981        K: std::convert::Into<std::string::String>,
10982        V: std::convert::Into<std::string::String>,
10983    {
10984        use std::iter::Iterator;
10985        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10986        self
10987    }
10988
10989    /// Sets the value of [logging_config][crate::model::SparkJob::logging_config].
10990    ///
10991    /// # Example
10992    /// ```ignore,no_run
10993    /// # use google_cloud_dataproc_v1::model::SparkJob;
10994    /// use google_cloud_dataproc_v1::model::LoggingConfig;
10995    /// let x = SparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
10996    /// ```
10997    pub fn set_logging_config<T>(mut self, v: T) -> Self
10998    where
10999        T: std::convert::Into<crate::model::LoggingConfig>,
11000    {
11001        self.logging_config = std::option::Option::Some(v.into());
11002        self
11003    }
11004
11005    /// Sets or clears the value of [logging_config][crate::model::SparkJob::logging_config].
11006    ///
11007    /// # Example
11008    /// ```ignore,no_run
11009    /// # use google_cloud_dataproc_v1::model::SparkJob;
11010    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11011    /// let x = SparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11012    /// let x = SparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11013    /// ```
11014    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11015    where
11016        T: std::convert::Into<crate::model::LoggingConfig>,
11017    {
11018        self.logging_config = v.map(|x| x.into());
11019        self
11020    }
11021
11022    /// Sets the value of [driver][crate::model::SparkJob::driver].
11023    ///
11024    /// Note that all the setters affecting `driver` are mutually
11025    /// exclusive.
11026    ///
11027    /// # Example
11028    /// ```ignore,no_run
11029    /// # use google_cloud_dataproc_v1::model::SparkJob;
11030    /// use google_cloud_dataproc_v1::model::spark_job::Driver;
11031    /// let x = SparkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
11032    /// ```
11033    pub fn set_driver<
11034        T: std::convert::Into<std::option::Option<crate::model::spark_job::Driver>>,
11035    >(
11036        mut self,
11037        v: T,
11038    ) -> Self {
11039        self.driver = v.into();
11040        self
11041    }
11042
11043    /// The value of [driver][crate::model::SparkJob::driver]
11044    /// if it holds a `MainJarFileUri`, `None` if the field is not set or
11045    /// holds a different branch.
11046    pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
11047        #[allow(unreachable_patterns)]
11048        self.driver.as_ref().and_then(|v| match v {
11049            crate::model::spark_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
11050            _ => std::option::Option::None,
11051        })
11052    }
11053
11054    /// Sets the value of [driver][crate::model::SparkJob::driver]
11055    /// to hold a `MainJarFileUri`.
11056    ///
11057    /// Note that all the setters affecting `driver` are
11058    /// mutually exclusive.
11059    ///
11060    /// # Example
11061    /// ```ignore,no_run
11062    /// # use google_cloud_dataproc_v1::model::SparkJob;
11063    /// let x = SparkJob::new().set_main_jar_file_uri("example");
11064    /// assert!(x.main_jar_file_uri().is_some());
11065    /// assert!(x.main_class().is_none());
11066    /// ```
11067    pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
11068        mut self,
11069        v: T,
11070    ) -> Self {
11071        self.driver =
11072            std::option::Option::Some(crate::model::spark_job::Driver::MainJarFileUri(v.into()));
11073        self
11074    }
11075
11076    /// The value of [driver][crate::model::SparkJob::driver]
11077    /// if it holds a `MainClass`, `None` if the field is not set or
11078    /// holds a different branch.
11079    pub fn main_class(&self) -> std::option::Option<&std::string::String> {
11080        #[allow(unreachable_patterns)]
11081        self.driver.as_ref().and_then(|v| match v {
11082            crate::model::spark_job::Driver::MainClass(v) => std::option::Option::Some(v),
11083            _ => std::option::Option::None,
11084        })
11085    }
11086
11087    /// Sets the value of [driver][crate::model::SparkJob::driver]
11088    /// to hold a `MainClass`.
11089    ///
11090    /// Note that all the setters affecting `driver` are
11091    /// mutually exclusive.
11092    ///
11093    /// # Example
11094    /// ```ignore,no_run
11095    /// # use google_cloud_dataproc_v1::model::SparkJob;
11096    /// let x = SparkJob::new().set_main_class("example");
11097    /// assert!(x.main_class().is_some());
11098    /// assert!(x.main_jar_file_uri().is_none());
11099    /// ```
11100    pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11101        self.driver =
11102            std::option::Option::Some(crate::model::spark_job::Driver::MainClass(v.into()));
11103        self
11104    }
11105}
11106
11107impl wkt::message::Message for SparkJob {
11108    fn typename() -> &'static str {
11109        "type.googleapis.com/google.cloud.dataproc.v1.SparkJob"
11110    }
11111}
11112
11113/// Defines additional types related to [SparkJob].
11114pub mod spark_job {
11115    #[allow(unused_imports)]
11116    use super::*;
11117
11118    /// Required. The specification of the main method to call to drive the job.
11119    /// Specify either the jar file that contains the main class or the main class
11120    /// name. To pass both a main jar and a main class in that jar, add the jar to
11121    /// [jarFileUris][google.cloud.dataproc.v1.SparkJob.jar_file_uris], and then
11122    /// specify the main class name in
11123    /// [mainClass][google.cloud.dataproc.v1.SparkJob.main_class].
11124    ///
11125    /// [google.cloud.dataproc.v1.SparkJob.jar_file_uris]: crate::model::SparkJob::jar_file_uris
11126    /// [google.cloud.dataproc.v1.SparkJob.main_class]: crate::model::SparkJob::driver
11127    #[derive(Clone, Debug, PartialEq)]
11128    #[non_exhaustive]
11129    pub enum Driver {
11130        /// The HCFS URI of the jar file that contains the main class.
11131        MainJarFileUri(std::string::String),
11132        /// The name of the driver's main class. The jar file that contains the class
11133        /// must be in the default CLASSPATH or specified in
11134        /// SparkJob.jar_file_uris.
11135        MainClass(std::string::String),
11136    }
11137}
11138
11139/// A Dataproc job for running
11140/// [Apache
11141/// PySpark](https://spark.apache.org/docs/0.9.0/python-programming-guide.html)
11142/// applications on YARN.
11143#[derive(Clone, Default, PartialEq)]
11144#[non_exhaustive]
11145pub struct PySparkJob {
11146    /// Required. The HCFS URI of the main Python file to use as the driver. Must
11147    /// be a .py file.
11148    pub main_python_file_uri: std::string::String,
11149
11150    /// Optional. The arguments to pass to the driver.  Do not include arguments,
11151    /// such as `--conf`, that can be set as job properties, since a collision may
11152    /// occur that causes an incorrect job submission.
11153    pub args: std::vec::Vec<std::string::String>,
11154
11155    /// Optional. HCFS file URIs of Python files to pass to the PySpark
11156    /// framework. Supported file types: .py, .egg, and .zip.
11157    pub python_file_uris: std::vec::Vec<std::string::String>,
11158
11159    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
11160    /// Python driver and tasks.
11161    pub jar_file_uris: std::vec::Vec<std::string::String>,
11162
11163    /// Optional. HCFS URIs of files to be placed in the working directory of
11164    /// each executor. Useful for naively parallel tasks.
11165    pub file_uris: std::vec::Vec<std::string::String>,
11166
11167    /// Optional. HCFS URIs of archives to be extracted into the working directory
11168    /// of each executor. Supported file types:
11169    /// .jar, .tar, .tar.gz, .tgz, and .zip.
11170    pub archive_uris: std::vec::Vec<std::string::String>,
11171
11172    /// Optional. A mapping of property names to values, used to configure PySpark.
11173    /// Properties that conflict with values set by the Dataproc API might be
11174    /// overwritten. Can include properties set in
11175    /// /etc/spark/conf/spark-defaults.conf and classes in user code.
11176    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11177
11178    /// Optional. The runtime log config for job execution.
11179    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11180
11181    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11182}
11183
11184impl PySparkJob {
11185    pub fn new() -> Self {
11186        std::default::Default::default()
11187    }
11188
11189    /// Sets the value of [main_python_file_uri][crate::model::PySparkJob::main_python_file_uri].
11190    ///
11191    /// # Example
11192    /// ```ignore,no_run
11193    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11194    /// let x = PySparkJob::new().set_main_python_file_uri("example");
11195    /// ```
11196    pub fn set_main_python_file_uri<T: std::convert::Into<std::string::String>>(
11197        mut self,
11198        v: T,
11199    ) -> Self {
11200        self.main_python_file_uri = v.into();
11201        self
11202    }
11203
11204    /// Sets the value of [args][crate::model::PySparkJob::args].
11205    ///
11206    /// # Example
11207    /// ```ignore,no_run
11208    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11209    /// let x = PySparkJob::new().set_args(["a", "b", "c"]);
11210    /// ```
11211    pub fn set_args<T, V>(mut self, v: T) -> Self
11212    where
11213        T: std::iter::IntoIterator<Item = V>,
11214        V: std::convert::Into<std::string::String>,
11215    {
11216        use std::iter::Iterator;
11217        self.args = v.into_iter().map(|i| i.into()).collect();
11218        self
11219    }
11220
11221    /// Sets the value of [python_file_uris][crate::model::PySparkJob::python_file_uris].
11222    ///
11223    /// # Example
11224    /// ```ignore,no_run
11225    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11226    /// let x = PySparkJob::new().set_python_file_uris(["a", "b", "c"]);
11227    /// ```
11228    pub fn set_python_file_uris<T, V>(mut self, v: T) -> Self
11229    where
11230        T: std::iter::IntoIterator<Item = V>,
11231        V: std::convert::Into<std::string::String>,
11232    {
11233        use std::iter::Iterator;
11234        self.python_file_uris = v.into_iter().map(|i| i.into()).collect();
11235        self
11236    }
11237
11238    /// Sets the value of [jar_file_uris][crate::model::PySparkJob::jar_file_uris].
11239    ///
11240    /// # Example
11241    /// ```ignore,no_run
11242    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11243    /// let x = PySparkJob::new().set_jar_file_uris(["a", "b", "c"]);
11244    /// ```
11245    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11246    where
11247        T: std::iter::IntoIterator<Item = V>,
11248        V: std::convert::Into<std::string::String>,
11249    {
11250        use std::iter::Iterator;
11251        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11252        self
11253    }
11254
11255    /// Sets the value of [file_uris][crate::model::PySparkJob::file_uris].
11256    ///
11257    /// # Example
11258    /// ```ignore,no_run
11259    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11260    /// let x = PySparkJob::new().set_file_uris(["a", "b", "c"]);
11261    /// ```
11262    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
11263    where
11264        T: std::iter::IntoIterator<Item = V>,
11265        V: std::convert::Into<std::string::String>,
11266    {
11267        use std::iter::Iterator;
11268        self.file_uris = v.into_iter().map(|i| i.into()).collect();
11269        self
11270    }
11271
11272    /// Sets the value of [archive_uris][crate::model::PySparkJob::archive_uris].
11273    ///
11274    /// # Example
11275    /// ```ignore,no_run
11276    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11277    /// let x = PySparkJob::new().set_archive_uris(["a", "b", "c"]);
11278    /// ```
11279    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
11280    where
11281        T: std::iter::IntoIterator<Item = V>,
11282        V: std::convert::Into<std::string::String>,
11283    {
11284        use std::iter::Iterator;
11285        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
11286        self
11287    }
11288
11289    /// Sets the value of [properties][crate::model::PySparkJob::properties].
11290    ///
11291    /// # Example
11292    /// ```ignore,no_run
11293    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11294    /// let x = PySparkJob::new().set_properties([
11295    ///     ("key0", "abc"),
11296    ///     ("key1", "xyz"),
11297    /// ]);
11298    /// ```
11299    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11300    where
11301        T: std::iter::IntoIterator<Item = (K, V)>,
11302        K: std::convert::Into<std::string::String>,
11303        V: std::convert::Into<std::string::String>,
11304    {
11305        use std::iter::Iterator;
11306        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11307        self
11308    }
11309
11310    /// Sets the value of [logging_config][crate::model::PySparkJob::logging_config].
11311    ///
11312    /// # Example
11313    /// ```ignore,no_run
11314    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11315    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11316    /// let x = PySparkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11317    /// ```
11318    pub fn set_logging_config<T>(mut self, v: T) -> Self
11319    where
11320        T: std::convert::Into<crate::model::LoggingConfig>,
11321    {
11322        self.logging_config = std::option::Option::Some(v.into());
11323        self
11324    }
11325
11326    /// Sets or clears the value of [logging_config][crate::model::PySparkJob::logging_config].
11327    ///
11328    /// # Example
11329    /// ```ignore,no_run
11330    /// # use google_cloud_dataproc_v1::model::PySparkJob;
11331    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11332    /// let x = PySparkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11333    /// let x = PySparkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11334    /// ```
11335    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11336    where
11337        T: std::convert::Into<crate::model::LoggingConfig>,
11338    {
11339        self.logging_config = v.map(|x| x.into());
11340        self
11341    }
11342}
11343
11344impl wkt::message::Message for PySparkJob {
11345    fn typename() -> &'static str {
11346        "type.googleapis.com/google.cloud.dataproc.v1.PySparkJob"
11347    }
11348}
11349
11350/// A list of queries to run on a cluster.
11351#[derive(Clone, Default, PartialEq)]
11352#[non_exhaustive]
11353pub struct QueryList {
11354    /// Required. The queries to execute. You do not need to end a query expression
11355    /// with a semicolon. Multiple queries can be specified in one
11356    /// string by separating each with a semicolon. Here is an example of a
11357    /// Dataproc API snippet that uses a QueryList to specify a HiveJob:
11358    ///
11359    /// ```norust
11360    /// "hiveJob": {
11361    ///   "queryList": {
11362    ///     "queries": [
11363    ///       "query1",
11364    ///       "query2",
11365    ///       "query3;query4",
11366    ///     ]
11367    ///   }
11368    /// }
11369    /// ```
11370    pub queries: std::vec::Vec<std::string::String>,
11371
11372    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11373}
11374
11375impl QueryList {
11376    pub fn new() -> Self {
11377        std::default::Default::default()
11378    }
11379
11380    /// Sets the value of [queries][crate::model::QueryList::queries].
11381    ///
11382    /// # Example
11383    /// ```ignore,no_run
11384    /// # use google_cloud_dataproc_v1::model::QueryList;
11385    /// let x = QueryList::new().set_queries(["a", "b", "c"]);
11386    /// ```
11387    pub fn set_queries<T, V>(mut self, v: T) -> Self
11388    where
11389        T: std::iter::IntoIterator<Item = V>,
11390        V: std::convert::Into<std::string::String>,
11391    {
11392        use std::iter::Iterator;
11393        self.queries = v.into_iter().map(|i| i.into()).collect();
11394        self
11395    }
11396}
11397
11398impl wkt::message::Message for QueryList {
11399    fn typename() -> &'static str {
11400        "type.googleapis.com/google.cloud.dataproc.v1.QueryList"
11401    }
11402}
11403
11404/// A Dataproc job for running [Apache Hive](https://hive.apache.org/)
11405/// queries on YARN.
11406#[derive(Clone, Default, PartialEq)]
11407#[non_exhaustive]
11408pub struct HiveJob {
11409    /// Optional. Whether to continue executing queries if a query fails.
11410    /// The default value is `false`. Setting to `true` can be useful when
11411    /// executing independent parallel queries.
11412    pub continue_on_failure: bool,
11413
11414    /// Optional. Mapping of query variable names to values (equivalent to the
11415    /// Hive command: `SET name="value";`).
11416    pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11417
11418    /// Optional. A mapping of property names and values, used to configure Hive.
11419    /// Properties that conflict with values set by the Dataproc API might be
11420    /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11421    /// /etc/hive/conf/hive-site.xml, and classes in user code.
11422    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11423
11424    /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the
11425    /// Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes
11426    /// and UDFs.
11427    pub jar_file_uris: std::vec::Vec<std::string::String>,
11428
11429    /// Required. The sequence of Hive queries to execute, specified as either
11430    /// an HCFS file URI or a list of queries.
11431    pub queries: std::option::Option<crate::model::hive_job::Queries>,
11432
11433    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11434}
11435
11436impl HiveJob {
11437    pub fn new() -> Self {
11438        std::default::Default::default()
11439    }
11440
11441    /// Sets the value of [continue_on_failure][crate::model::HiveJob::continue_on_failure].
11442    ///
11443    /// # Example
11444    /// ```ignore,no_run
11445    /// # use google_cloud_dataproc_v1::model::HiveJob;
11446    /// let x = HiveJob::new().set_continue_on_failure(true);
11447    /// ```
11448    pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11449        self.continue_on_failure = v.into();
11450        self
11451    }
11452
11453    /// Sets the value of [script_variables][crate::model::HiveJob::script_variables].
11454    ///
11455    /// # Example
11456    /// ```ignore,no_run
11457    /// # use google_cloud_dataproc_v1::model::HiveJob;
11458    /// let x = HiveJob::new().set_script_variables([
11459    ///     ("key0", "abc"),
11460    ///     ("key1", "xyz"),
11461    /// ]);
11462    /// ```
11463    pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11464    where
11465        T: std::iter::IntoIterator<Item = (K, V)>,
11466        K: std::convert::Into<std::string::String>,
11467        V: std::convert::Into<std::string::String>,
11468    {
11469        use std::iter::Iterator;
11470        self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11471        self
11472    }
11473
11474    /// Sets the value of [properties][crate::model::HiveJob::properties].
11475    ///
11476    /// # Example
11477    /// ```ignore,no_run
11478    /// # use google_cloud_dataproc_v1::model::HiveJob;
11479    /// let x = HiveJob::new().set_properties([
11480    ///     ("key0", "abc"),
11481    ///     ("key1", "xyz"),
11482    /// ]);
11483    /// ```
11484    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11485    where
11486        T: std::iter::IntoIterator<Item = (K, V)>,
11487        K: std::convert::Into<std::string::String>,
11488        V: std::convert::Into<std::string::String>,
11489    {
11490        use std::iter::Iterator;
11491        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11492        self
11493    }
11494
11495    /// Sets the value of [jar_file_uris][crate::model::HiveJob::jar_file_uris].
11496    ///
11497    /// # Example
11498    /// ```ignore,no_run
11499    /// # use google_cloud_dataproc_v1::model::HiveJob;
11500    /// let x = HiveJob::new().set_jar_file_uris(["a", "b", "c"]);
11501    /// ```
11502    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11503    where
11504        T: std::iter::IntoIterator<Item = V>,
11505        V: std::convert::Into<std::string::String>,
11506    {
11507        use std::iter::Iterator;
11508        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11509        self
11510    }
11511
11512    /// Sets the value of [queries][crate::model::HiveJob::queries].
11513    ///
11514    /// Note that all the setters affecting `queries` are mutually
11515    /// exclusive.
11516    ///
11517    /// # Example
11518    /// ```ignore,no_run
11519    /// # use google_cloud_dataproc_v1::model::HiveJob;
11520    /// use google_cloud_dataproc_v1::model::hive_job::Queries;
11521    /// let x = HiveJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11522    /// ```
11523    pub fn set_queries<
11524        T: std::convert::Into<std::option::Option<crate::model::hive_job::Queries>>,
11525    >(
11526        mut self,
11527        v: T,
11528    ) -> Self {
11529        self.queries = v.into();
11530        self
11531    }
11532
11533    /// The value of [queries][crate::model::HiveJob::queries]
11534    /// if it holds a `QueryFileUri`, `None` if the field is not set or
11535    /// holds a different branch.
11536    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11537        #[allow(unreachable_patterns)]
11538        self.queries.as_ref().and_then(|v| match v {
11539            crate::model::hive_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11540            _ => std::option::Option::None,
11541        })
11542    }
11543
11544    /// Sets the value of [queries][crate::model::HiveJob::queries]
11545    /// to hold a `QueryFileUri`.
11546    ///
11547    /// Note that all the setters affecting `queries` are
11548    /// mutually exclusive.
11549    ///
11550    /// # Example
11551    /// ```ignore,no_run
11552    /// # use google_cloud_dataproc_v1::model::HiveJob;
11553    /// let x = HiveJob::new().set_query_file_uri("example");
11554    /// assert!(x.query_file_uri().is_some());
11555    /// assert!(x.query_list().is_none());
11556    /// ```
11557    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11558        self.queries =
11559            std::option::Option::Some(crate::model::hive_job::Queries::QueryFileUri(v.into()));
11560        self
11561    }
11562
11563    /// The value of [queries][crate::model::HiveJob::queries]
11564    /// if it holds a `QueryList`, `None` if the field is not set or
11565    /// holds a different branch.
11566    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11567        #[allow(unreachable_patterns)]
11568        self.queries.as_ref().and_then(|v| match v {
11569            crate::model::hive_job::Queries::QueryList(v) => std::option::Option::Some(v),
11570            _ => std::option::Option::None,
11571        })
11572    }
11573
11574    /// Sets the value of [queries][crate::model::HiveJob::queries]
11575    /// to hold a `QueryList`.
11576    ///
11577    /// Note that all the setters affecting `queries` are
11578    /// mutually exclusive.
11579    ///
11580    /// # Example
11581    /// ```ignore,no_run
11582    /// # use google_cloud_dataproc_v1::model::HiveJob;
11583    /// use google_cloud_dataproc_v1::model::QueryList;
11584    /// let x = HiveJob::new().set_query_list(QueryList::default()/* use setters */);
11585    /// assert!(x.query_list().is_some());
11586    /// assert!(x.query_file_uri().is_none());
11587    /// ```
11588    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11589        mut self,
11590        v: T,
11591    ) -> Self {
11592        self.queries =
11593            std::option::Option::Some(crate::model::hive_job::Queries::QueryList(v.into()));
11594        self
11595    }
11596}
11597
11598impl wkt::message::Message for HiveJob {
11599    fn typename() -> &'static str {
11600        "type.googleapis.com/google.cloud.dataproc.v1.HiveJob"
11601    }
11602}
11603
11604/// Defines additional types related to [HiveJob].
11605pub mod hive_job {
11606    #[allow(unused_imports)]
11607    use super::*;
11608
11609    /// Required. The sequence of Hive queries to execute, specified as either
11610    /// an HCFS file URI or a list of queries.
11611    #[derive(Clone, Debug, PartialEq)]
11612    #[non_exhaustive]
11613    pub enum Queries {
11614        /// The HCFS URI of the script that contains Hive queries.
11615        QueryFileUri(std::string::String),
11616        /// A list of queries.
11617        QueryList(std::boxed::Box<crate::model::QueryList>),
11618    }
11619}
11620
11621/// A Dataproc job for running [Apache Spark
11622/// SQL](https://spark.apache.org/sql/) queries.
11623#[derive(Clone, Default, PartialEq)]
11624#[non_exhaustive]
11625pub struct SparkSqlJob {
11626    /// Optional. Mapping of query variable names to values (equivalent to the
11627    /// Spark SQL command: SET `name="value";`).
11628    pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11629
11630    /// Optional. A mapping of property names to values, used to configure
11631    /// Spark SQL's SparkConf. Properties that conflict with values set by the
11632    /// Dataproc API might be overwritten.
11633    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11634
11635    /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
11636    pub jar_file_uris: std::vec::Vec<std::string::String>,
11637
11638    /// Optional. The runtime log config for job execution.
11639    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11640
11641    /// Required. The sequence of Spark SQL queries to execute, specified as
11642    /// either an HCFS file URI or as a list of queries.
11643    pub queries: std::option::Option<crate::model::spark_sql_job::Queries>,
11644
11645    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11646}
11647
11648impl SparkSqlJob {
11649    pub fn new() -> Self {
11650        std::default::Default::default()
11651    }
11652
11653    /// Sets the value of [script_variables][crate::model::SparkSqlJob::script_variables].
11654    ///
11655    /// # Example
11656    /// ```ignore,no_run
11657    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11658    /// let x = SparkSqlJob::new().set_script_variables([
11659    ///     ("key0", "abc"),
11660    ///     ("key1", "xyz"),
11661    /// ]);
11662    /// ```
11663    pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11664    where
11665        T: std::iter::IntoIterator<Item = (K, V)>,
11666        K: std::convert::Into<std::string::String>,
11667        V: std::convert::Into<std::string::String>,
11668    {
11669        use std::iter::Iterator;
11670        self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11671        self
11672    }
11673
11674    /// Sets the value of [properties][crate::model::SparkSqlJob::properties].
11675    ///
11676    /// # Example
11677    /// ```ignore,no_run
11678    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11679    /// let x = SparkSqlJob::new().set_properties([
11680    ///     ("key0", "abc"),
11681    ///     ("key1", "xyz"),
11682    /// ]);
11683    /// ```
11684    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11685    where
11686        T: std::iter::IntoIterator<Item = (K, V)>,
11687        K: std::convert::Into<std::string::String>,
11688        V: std::convert::Into<std::string::String>,
11689    {
11690        use std::iter::Iterator;
11691        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11692        self
11693    }
11694
11695    /// Sets the value of [jar_file_uris][crate::model::SparkSqlJob::jar_file_uris].
11696    ///
11697    /// # Example
11698    /// ```ignore,no_run
11699    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11700    /// let x = SparkSqlJob::new().set_jar_file_uris(["a", "b", "c"]);
11701    /// ```
11702    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11703    where
11704        T: std::iter::IntoIterator<Item = V>,
11705        V: std::convert::Into<std::string::String>,
11706    {
11707        use std::iter::Iterator;
11708        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11709        self
11710    }
11711
11712    /// Sets the value of [logging_config][crate::model::SparkSqlJob::logging_config].
11713    ///
11714    /// # Example
11715    /// ```ignore,no_run
11716    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11717    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11718    /// let x = SparkSqlJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11719    /// ```
11720    pub fn set_logging_config<T>(mut self, v: T) -> Self
11721    where
11722        T: std::convert::Into<crate::model::LoggingConfig>,
11723    {
11724        self.logging_config = std::option::Option::Some(v.into());
11725        self
11726    }
11727
11728    /// Sets or clears the value of [logging_config][crate::model::SparkSqlJob::logging_config].
11729    ///
11730    /// # Example
11731    /// ```ignore,no_run
11732    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11733    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11734    /// let x = SparkSqlJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11735    /// let x = SparkSqlJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11736    /// ```
11737    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11738    where
11739        T: std::convert::Into<crate::model::LoggingConfig>,
11740    {
11741        self.logging_config = v.map(|x| x.into());
11742        self
11743    }
11744
11745    /// Sets the value of [queries][crate::model::SparkSqlJob::queries].
11746    ///
11747    /// Note that all the setters affecting `queries` are mutually
11748    /// exclusive.
11749    ///
11750    /// # Example
11751    /// ```ignore,no_run
11752    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11753    /// use google_cloud_dataproc_v1::model::spark_sql_job::Queries;
11754    /// let x = SparkSqlJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
11755    /// ```
11756    pub fn set_queries<
11757        T: std::convert::Into<std::option::Option<crate::model::spark_sql_job::Queries>>,
11758    >(
11759        mut self,
11760        v: T,
11761    ) -> Self {
11762        self.queries = v.into();
11763        self
11764    }
11765
11766    /// The value of [queries][crate::model::SparkSqlJob::queries]
11767    /// if it holds a `QueryFileUri`, `None` if the field is not set or
11768    /// holds a different branch.
11769    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
11770        #[allow(unreachable_patterns)]
11771        self.queries.as_ref().and_then(|v| match v {
11772            crate::model::spark_sql_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
11773            _ => std::option::Option::None,
11774        })
11775    }
11776
11777    /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
11778    /// to hold a `QueryFileUri`.
11779    ///
11780    /// Note that all the setters affecting `queries` are
11781    /// mutually exclusive.
11782    ///
11783    /// # Example
11784    /// ```ignore,no_run
11785    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11786    /// let x = SparkSqlJob::new().set_query_file_uri("example");
11787    /// assert!(x.query_file_uri().is_some());
11788    /// assert!(x.query_list().is_none());
11789    /// ```
11790    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11791        self.queries =
11792            std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryFileUri(v.into()));
11793        self
11794    }
11795
11796    /// The value of [queries][crate::model::SparkSqlJob::queries]
11797    /// if it holds a `QueryList`, `None` if the field is not set or
11798    /// holds a different branch.
11799    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
11800        #[allow(unreachable_patterns)]
11801        self.queries.as_ref().and_then(|v| match v {
11802            crate::model::spark_sql_job::Queries::QueryList(v) => std::option::Option::Some(v),
11803            _ => std::option::Option::None,
11804        })
11805    }
11806
11807    /// Sets the value of [queries][crate::model::SparkSqlJob::queries]
11808    /// to hold a `QueryList`.
11809    ///
11810    /// Note that all the setters affecting `queries` are
11811    /// mutually exclusive.
11812    ///
11813    /// # Example
11814    /// ```ignore,no_run
11815    /// # use google_cloud_dataproc_v1::model::SparkSqlJob;
11816    /// use google_cloud_dataproc_v1::model::QueryList;
11817    /// let x = SparkSqlJob::new().set_query_list(QueryList::default()/* use setters */);
11818    /// assert!(x.query_list().is_some());
11819    /// assert!(x.query_file_uri().is_none());
11820    /// ```
11821    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
11822        mut self,
11823        v: T,
11824    ) -> Self {
11825        self.queries =
11826            std::option::Option::Some(crate::model::spark_sql_job::Queries::QueryList(v.into()));
11827        self
11828    }
11829}
11830
11831impl wkt::message::Message for SparkSqlJob {
11832    fn typename() -> &'static str {
11833        "type.googleapis.com/google.cloud.dataproc.v1.SparkSqlJob"
11834    }
11835}
11836
11837/// Defines additional types related to [SparkSqlJob].
11838pub mod spark_sql_job {
11839    #[allow(unused_imports)]
11840    use super::*;
11841
11842    /// Required. The sequence of Spark SQL queries to execute, specified as
11843    /// either an HCFS file URI or as a list of queries.
11844    #[derive(Clone, Debug, PartialEq)]
11845    #[non_exhaustive]
11846    pub enum Queries {
11847        /// The HCFS URI of the script that contains SQL queries.
11848        QueryFileUri(std::string::String),
11849        /// A list of queries.
11850        QueryList(std::boxed::Box<crate::model::QueryList>),
11851    }
11852}
11853
11854/// A Dataproc job for running [Apache Pig](https://pig.apache.org/)
11855/// queries on YARN.
11856#[derive(Clone, Default, PartialEq)]
11857#[non_exhaustive]
11858pub struct PigJob {
11859    /// Optional. Whether to continue executing queries if a query fails.
11860    /// The default value is `false`. Setting to `true` can be useful when
11861    /// executing independent parallel queries.
11862    pub continue_on_failure: bool,
11863
11864    /// Optional. Mapping of query variable names to values (equivalent to the Pig
11865    /// command: `name=[value]`).
11866    pub script_variables: std::collections::HashMap<std::string::String, std::string::String>,
11867
11868    /// Optional. A mapping of property names to values, used to configure Pig.
11869    /// Properties that conflict with values set by the Dataproc API might be
11870    /// overwritten. Can include properties set in `/etc/hadoop/conf/*-site.xml`,
11871    /// /etc/pig/conf/pig.properties, and classes in user code.
11872    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
11873
11874    /// Optional. HCFS URIs of jar files to add to the CLASSPATH of
11875    /// the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs.
11876    pub jar_file_uris: std::vec::Vec<std::string::String>,
11877
11878    /// Optional. The runtime log config for job execution.
11879    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
11880
11881    /// Required. The sequence of Pig queries to execute, specified as an HCFS
11882    /// file URI or a list of queries.
11883    pub queries: std::option::Option<crate::model::pig_job::Queries>,
11884
11885    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11886}
11887
11888impl PigJob {
11889    pub fn new() -> Self {
11890        std::default::Default::default()
11891    }
11892
11893    /// Sets the value of [continue_on_failure][crate::model::PigJob::continue_on_failure].
11894    ///
11895    /// # Example
11896    /// ```ignore,no_run
11897    /// # use google_cloud_dataproc_v1::model::PigJob;
11898    /// let x = PigJob::new().set_continue_on_failure(true);
11899    /// ```
11900    pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11901        self.continue_on_failure = v.into();
11902        self
11903    }
11904
11905    /// Sets the value of [script_variables][crate::model::PigJob::script_variables].
11906    ///
11907    /// # Example
11908    /// ```ignore,no_run
11909    /// # use google_cloud_dataproc_v1::model::PigJob;
11910    /// let x = PigJob::new().set_script_variables([
11911    ///     ("key0", "abc"),
11912    ///     ("key1", "xyz"),
11913    /// ]);
11914    /// ```
11915    pub fn set_script_variables<T, K, V>(mut self, v: T) -> Self
11916    where
11917        T: std::iter::IntoIterator<Item = (K, V)>,
11918        K: std::convert::Into<std::string::String>,
11919        V: std::convert::Into<std::string::String>,
11920    {
11921        use std::iter::Iterator;
11922        self.script_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11923        self
11924    }
11925
11926    /// Sets the value of [properties][crate::model::PigJob::properties].
11927    ///
11928    /// # Example
11929    /// ```ignore,no_run
11930    /// # use google_cloud_dataproc_v1::model::PigJob;
11931    /// let x = PigJob::new().set_properties([
11932    ///     ("key0", "abc"),
11933    ///     ("key1", "xyz"),
11934    /// ]);
11935    /// ```
11936    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
11937    where
11938        T: std::iter::IntoIterator<Item = (K, V)>,
11939        K: std::convert::Into<std::string::String>,
11940        V: std::convert::Into<std::string::String>,
11941    {
11942        use std::iter::Iterator;
11943        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11944        self
11945    }
11946
11947    /// Sets the value of [jar_file_uris][crate::model::PigJob::jar_file_uris].
11948    ///
11949    /// # Example
11950    /// ```ignore,no_run
11951    /// # use google_cloud_dataproc_v1::model::PigJob;
11952    /// let x = PigJob::new().set_jar_file_uris(["a", "b", "c"]);
11953    /// ```
11954    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
11955    where
11956        T: std::iter::IntoIterator<Item = V>,
11957        V: std::convert::Into<std::string::String>,
11958    {
11959        use std::iter::Iterator;
11960        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
11961        self
11962    }
11963
11964    /// Sets the value of [logging_config][crate::model::PigJob::logging_config].
11965    ///
11966    /// # Example
11967    /// ```ignore,no_run
11968    /// # use google_cloud_dataproc_v1::model::PigJob;
11969    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11970    /// let x = PigJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
11971    /// ```
11972    pub fn set_logging_config<T>(mut self, v: T) -> Self
11973    where
11974        T: std::convert::Into<crate::model::LoggingConfig>,
11975    {
11976        self.logging_config = std::option::Option::Some(v.into());
11977        self
11978    }
11979
11980    /// Sets or clears the value of [logging_config][crate::model::PigJob::logging_config].
11981    ///
11982    /// # Example
11983    /// ```ignore,no_run
11984    /// # use google_cloud_dataproc_v1::model::PigJob;
11985    /// use google_cloud_dataproc_v1::model::LoggingConfig;
11986    /// let x = PigJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
11987    /// let x = PigJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
11988    /// ```
11989    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
11990    where
11991        T: std::convert::Into<crate::model::LoggingConfig>,
11992    {
11993        self.logging_config = v.map(|x| x.into());
11994        self
11995    }
11996
11997    /// Sets the value of [queries][crate::model::PigJob::queries].
11998    ///
11999    /// Note that all the setters affecting `queries` are mutually
12000    /// exclusive.
12001    ///
12002    /// # Example
12003    /// ```ignore,no_run
12004    /// # use google_cloud_dataproc_v1::model::PigJob;
12005    /// use google_cloud_dataproc_v1::model::pig_job::Queries;
12006    /// let x = PigJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12007    /// ```
12008    pub fn set_queries<
12009        T: std::convert::Into<std::option::Option<crate::model::pig_job::Queries>>,
12010    >(
12011        mut self,
12012        v: T,
12013    ) -> Self {
12014        self.queries = v.into();
12015        self
12016    }
12017
12018    /// The value of [queries][crate::model::PigJob::queries]
12019    /// if it holds a `QueryFileUri`, `None` if the field is not set or
12020    /// holds a different branch.
12021    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12022        #[allow(unreachable_patterns)]
12023        self.queries.as_ref().and_then(|v| match v {
12024            crate::model::pig_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12025            _ => std::option::Option::None,
12026        })
12027    }
12028
12029    /// Sets the value of [queries][crate::model::PigJob::queries]
12030    /// to hold a `QueryFileUri`.
12031    ///
12032    /// Note that all the setters affecting `queries` are
12033    /// mutually exclusive.
12034    ///
12035    /// # Example
12036    /// ```ignore,no_run
12037    /// # use google_cloud_dataproc_v1::model::PigJob;
12038    /// let x = PigJob::new().set_query_file_uri("example");
12039    /// assert!(x.query_file_uri().is_some());
12040    /// assert!(x.query_list().is_none());
12041    /// ```
12042    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12043        self.queries =
12044            std::option::Option::Some(crate::model::pig_job::Queries::QueryFileUri(v.into()));
12045        self
12046    }
12047
12048    /// The value of [queries][crate::model::PigJob::queries]
12049    /// if it holds a `QueryList`, `None` if the field is not set or
12050    /// holds a different branch.
12051    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12052        #[allow(unreachable_patterns)]
12053        self.queries.as_ref().and_then(|v| match v {
12054            crate::model::pig_job::Queries::QueryList(v) => std::option::Option::Some(v),
12055            _ => std::option::Option::None,
12056        })
12057    }
12058
12059    /// Sets the value of [queries][crate::model::PigJob::queries]
12060    /// to hold a `QueryList`.
12061    ///
12062    /// Note that all the setters affecting `queries` are
12063    /// mutually exclusive.
12064    ///
12065    /// # Example
12066    /// ```ignore,no_run
12067    /// # use google_cloud_dataproc_v1::model::PigJob;
12068    /// use google_cloud_dataproc_v1::model::QueryList;
12069    /// let x = PigJob::new().set_query_list(QueryList::default()/* use setters */);
12070    /// assert!(x.query_list().is_some());
12071    /// assert!(x.query_file_uri().is_none());
12072    /// ```
12073    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12074        mut self,
12075        v: T,
12076    ) -> Self {
12077        self.queries =
12078            std::option::Option::Some(crate::model::pig_job::Queries::QueryList(v.into()));
12079        self
12080    }
12081}
12082
12083impl wkt::message::Message for PigJob {
12084    fn typename() -> &'static str {
12085        "type.googleapis.com/google.cloud.dataproc.v1.PigJob"
12086    }
12087}
12088
12089/// Defines additional types related to [PigJob].
12090pub mod pig_job {
12091    #[allow(unused_imports)]
12092    use super::*;
12093
12094    /// Required. The sequence of Pig queries to execute, specified as an HCFS
12095    /// file URI or a list of queries.
12096    #[derive(Clone, Debug, PartialEq)]
12097    #[non_exhaustive]
12098    pub enum Queries {
12099        /// The HCFS URI of the script that contains the Pig queries.
12100        QueryFileUri(std::string::String),
12101        /// A list of queries.
12102        QueryList(std::boxed::Box<crate::model::QueryList>),
12103    }
12104}
12105
12106/// A Dataproc job for running
12107/// [Apache SparkR](https://spark.apache.org/docs/latest/sparkr.html)
12108/// applications on YARN.
12109#[derive(Clone, Default, PartialEq)]
12110#[non_exhaustive]
12111pub struct SparkRJob {
12112    /// Required. The HCFS URI of the main R file to use as the driver.
12113    /// Must be a .R file.
12114    pub main_r_file_uri: std::string::String,
12115
12116    /// Optional. The arguments to pass to the driver.  Do not include arguments,
12117    /// such as `--conf`, that can be set as job properties, since a collision may
12118    /// occur that causes an incorrect job submission.
12119    pub args: std::vec::Vec<std::string::String>,
12120
12121    /// Optional. HCFS URIs of files to be placed in the working directory of
12122    /// each executor. Useful for naively parallel tasks.
12123    pub file_uris: std::vec::Vec<std::string::String>,
12124
12125    /// Optional. HCFS URIs of archives to be extracted into the working directory
12126    /// of each executor. Supported file types:
12127    /// .jar, .tar, .tar.gz, .tgz, and .zip.
12128    pub archive_uris: std::vec::Vec<std::string::String>,
12129
12130    /// Optional. A mapping of property names to values, used to configure SparkR.
12131    /// Properties that conflict with values set by the Dataproc API might be
12132    /// overwritten. Can include properties set in
12133    /// /etc/spark/conf/spark-defaults.conf and classes in user code.
12134    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12135
12136    /// Optional. The runtime log config for job execution.
12137    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12138
12139    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12140}
12141
12142impl SparkRJob {
12143    pub fn new() -> Self {
12144        std::default::Default::default()
12145    }
12146
12147    /// Sets the value of [main_r_file_uri][crate::model::SparkRJob::main_r_file_uri].
12148    ///
12149    /// # Example
12150    /// ```ignore,no_run
12151    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12152    /// let x = SparkRJob::new().set_main_r_file_uri("example");
12153    /// ```
12154    pub fn set_main_r_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12155        self.main_r_file_uri = v.into();
12156        self
12157    }
12158
12159    /// Sets the value of [args][crate::model::SparkRJob::args].
12160    ///
12161    /// # Example
12162    /// ```ignore,no_run
12163    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12164    /// let x = SparkRJob::new().set_args(["a", "b", "c"]);
12165    /// ```
12166    pub fn set_args<T, V>(mut self, v: T) -> Self
12167    where
12168        T: std::iter::IntoIterator<Item = V>,
12169        V: std::convert::Into<std::string::String>,
12170    {
12171        use std::iter::Iterator;
12172        self.args = v.into_iter().map(|i| i.into()).collect();
12173        self
12174    }
12175
12176    /// Sets the value of [file_uris][crate::model::SparkRJob::file_uris].
12177    ///
12178    /// # Example
12179    /// ```ignore,no_run
12180    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12181    /// let x = SparkRJob::new().set_file_uris(["a", "b", "c"]);
12182    /// ```
12183    pub fn set_file_uris<T, V>(mut self, v: T) -> Self
12184    where
12185        T: std::iter::IntoIterator<Item = V>,
12186        V: std::convert::Into<std::string::String>,
12187    {
12188        use std::iter::Iterator;
12189        self.file_uris = v.into_iter().map(|i| i.into()).collect();
12190        self
12191    }
12192
12193    /// Sets the value of [archive_uris][crate::model::SparkRJob::archive_uris].
12194    ///
12195    /// # Example
12196    /// ```ignore,no_run
12197    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12198    /// let x = SparkRJob::new().set_archive_uris(["a", "b", "c"]);
12199    /// ```
12200    pub fn set_archive_uris<T, V>(mut self, v: T) -> Self
12201    where
12202        T: std::iter::IntoIterator<Item = V>,
12203        V: std::convert::Into<std::string::String>,
12204    {
12205        use std::iter::Iterator;
12206        self.archive_uris = v.into_iter().map(|i| i.into()).collect();
12207        self
12208    }
12209
12210    /// Sets the value of [properties][crate::model::SparkRJob::properties].
12211    ///
12212    /// # Example
12213    /// ```ignore,no_run
12214    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12215    /// let x = SparkRJob::new().set_properties([
12216    ///     ("key0", "abc"),
12217    ///     ("key1", "xyz"),
12218    /// ]);
12219    /// ```
12220    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12221    where
12222        T: std::iter::IntoIterator<Item = (K, V)>,
12223        K: std::convert::Into<std::string::String>,
12224        V: std::convert::Into<std::string::String>,
12225    {
12226        use std::iter::Iterator;
12227        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12228        self
12229    }
12230
12231    /// Sets the value of [logging_config][crate::model::SparkRJob::logging_config].
12232    ///
12233    /// # Example
12234    /// ```ignore,no_run
12235    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12236    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12237    /// let x = SparkRJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12238    /// ```
12239    pub fn set_logging_config<T>(mut self, v: T) -> Self
12240    where
12241        T: std::convert::Into<crate::model::LoggingConfig>,
12242    {
12243        self.logging_config = std::option::Option::Some(v.into());
12244        self
12245    }
12246
12247    /// Sets or clears the value of [logging_config][crate::model::SparkRJob::logging_config].
12248    ///
12249    /// # Example
12250    /// ```ignore,no_run
12251    /// # use google_cloud_dataproc_v1::model::SparkRJob;
12252    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12253    /// let x = SparkRJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12254    /// let x = SparkRJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12255    /// ```
12256    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12257    where
12258        T: std::convert::Into<crate::model::LoggingConfig>,
12259    {
12260        self.logging_config = v.map(|x| x.into());
12261        self
12262    }
12263}
12264
12265impl wkt::message::Message for SparkRJob {
12266    fn typename() -> &'static str {
12267        "type.googleapis.com/google.cloud.dataproc.v1.SparkRJob"
12268    }
12269}
12270
12271/// A Dataproc job for running [Presto](https://prestosql.io/) queries.
12272/// **IMPORTANT**: The [Dataproc Presto Optional
12273/// Component](https://cloud.google.com/dataproc/docs/concepts/components/presto)
12274/// must be enabled when the cluster is created to submit a Presto job to the
12275/// cluster.
12276#[derive(Clone, Default, PartialEq)]
12277#[non_exhaustive]
12278pub struct PrestoJob {
12279    /// Optional. Whether to continue executing queries if a query fails.
12280    /// The default value is `false`. Setting to `true` can be useful when
12281    /// executing independent parallel queries.
12282    pub continue_on_failure: bool,
12283
12284    /// Optional. The format in which query output will be displayed. See the
12285    /// Presto documentation for supported output formats
12286    pub output_format: std::string::String,
12287
12288    /// Optional. Presto client tags to attach to this query
12289    pub client_tags: std::vec::Vec<std::string::String>,
12290
12291    /// Optional. A mapping of property names to values. Used to set Presto
12292    /// [session properties](https://prestodb.io/docs/current/sql/set-session.html)
12293    /// Equivalent to using the --session flag in the Presto CLI
12294    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12295
12296    /// Optional. The runtime log config for job execution.
12297    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12298
12299    /// Required. The sequence of Presto queries to execute, specified as
12300    /// either an HCFS file URI or as a list of queries.
12301    pub queries: std::option::Option<crate::model::presto_job::Queries>,
12302
12303    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12304}
12305
12306impl PrestoJob {
12307    pub fn new() -> Self {
12308        std::default::Default::default()
12309    }
12310
12311    /// Sets the value of [continue_on_failure][crate::model::PrestoJob::continue_on_failure].
12312    ///
12313    /// # Example
12314    /// ```ignore,no_run
12315    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12316    /// let x = PrestoJob::new().set_continue_on_failure(true);
12317    /// ```
12318    pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12319        self.continue_on_failure = v.into();
12320        self
12321    }
12322
12323    /// Sets the value of [output_format][crate::model::PrestoJob::output_format].
12324    ///
12325    /// # Example
12326    /// ```ignore,no_run
12327    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12328    /// let x = PrestoJob::new().set_output_format("example");
12329    /// ```
12330    pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12331        self.output_format = v.into();
12332        self
12333    }
12334
12335    /// Sets the value of [client_tags][crate::model::PrestoJob::client_tags].
12336    ///
12337    /// # Example
12338    /// ```ignore,no_run
12339    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12340    /// let x = PrestoJob::new().set_client_tags(["a", "b", "c"]);
12341    /// ```
12342    pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12343    where
12344        T: std::iter::IntoIterator<Item = V>,
12345        V: std::convert::Into<std::string::String>,
12346    {
12347        use std::iter::Iterator;
12348        self.client_tags = v.into_iter().map(|i| i.into()).collect();
12349        self
12350    }
12351
12352    /// Sets the value of [properties][crate::model::PrestoJob::properties].
12353    ///
12354    /// # Example
12355    /// ```ignore,no_run
12356    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12357    /// let x = PrestoJob::new().set_properties([
12358    ///     ("key0", "abc"),
12359    ///     ("key1", "xyz"),
12360    /// ]);
12361    /// ```
12362    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12363    where
12364        T: std::iter::IntoIterator<Item = (K, V)>,
12365        K: std::convert::Into<std::string::String>,
12366        V: std::convert::Into<std::string::String>,
12367    {
12368        use std::iter::Iterator;
12369        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12370        self
12371    }
12372
12373    /// Sets the value of [logging_config][crate::model::PrestoJob::logging_config].
12374    ///
12375    /// # Example
12376    /// ```ignore,no_run
12377    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12378    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12379    /// let x = PrestoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12380    /// ```
12381    pub fn set_logging_config<T>(mut self, v: T) -> Self
12382    where
12383        T: std::convert::Into<crate::model::LoggingConfig>,
12384    {
12385        self.logging_config = std::option::Option::Some(v.into());
12386        self
12387    }
12388
12389    /// Sets or clears the value of [logging_config][crate::model::PrestoJob::logging_config].
12390    ///
12391    /// # Example
12392    /// ```ignore,no_run
12393    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12394    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12395    /// let x = PrestoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12396    /// let x = PrestoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12397    /// ```
12398    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12399    where
12400        T: std::convert::Into<crate::model::LoggingConfig>,
12401    {
12402        self.logging_config = v.map(|x| x.into());
12403        self
12404    }
12405
12406    /// Sets the value of [queries][crate::model::PrestoJob::queries].
12407    ///
12408    /// Note that all the setters affecting `queries` are mutually
12409    /// exclusive.
12410    ///
12411    /// # Example
12412    /// ```ignore,no_run
12413    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12414    /// use google_cloud_dataproc_v1::model::presto_job::Queries;
12415    /// let x = PrestoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12416    /// ```
12417    pub fn set_queries<
12418        T: std::convert::Into<std::option::Option<crate::model::presto_job::Queries>>,
12419    >(
12420        mut self,
12421        v: T,
12422    ) -> Self {
12423        self.queries = v.into();
12424        self
12425    }
12426
12427    /// The value of [queries][crate::model::PrestoJob::queries]
12428    /// if it holds a `QueryFileUri`, `None` if the field is not set or
12429    /// holds a different branch.
12430    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12431        #[allow(unreachable_patterns)]
12432        self.queries.as_ref().and_then(|v| match v {
12433            crate::model::presto_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12434            _ => std::option::Option::None,
12435        })
12436    }
12437
12438    /// Sets the value of [queries][crate::model::PrestoJob::queries]
12439    /// to hold a `QueryFileUri`.
12440    ///
12441    /// Note that all the setters affecting `queries` are
12442    /// mutually exclusive.
12443    ///
12444    /// # Example
12445    /// ```ignore,no_run
12446    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12447    /// let x = PrestoJob::new().set_query_file_uri("example");
12448    /// assert!(x.query_file_uri().is_some());
12449    /// assert!(x.query_list().is_none());
12450    /// ```
12451    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12452        self.queries =
12453            std::option::Option::Some(crate::model::presto_job::Queries::QueryFileUri(v.into()));
12454        self
12455    }
12456
12457    /// The value of [queries][crate::model::PrestoJob::queries]
12458    /// if it holds a `QueryList`, `None` if the field is not set or
12459    /// holds a different branch.
12460    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12461        #[allow(unreachable_patterns)]
12462        self.queries.as_ref().and_then(|v| match v {
12463            crate::model::presto_job::Queries::QueryList(v) => std::option::Option::Some(v),
12464            _ => std::option::Option::None,
12465        })
12466    }
12467
12468    /// Sets the value of [queries][crate::model::PrestoJob::queries]
12469    /// to hold a `QueryList`.
12470    ///
12471    /// Note that all the setters affecting `queries` are
12472    /// mutually exclusive.
12473    ///
12474    /// # Example
12475    /// ```ignore,no_run
12476    /// # use google_cloud_dataproc_v1::model::PrestoJob;
12477    /// use google_cloud_dataproc_v1::model::QueryList;
12478    /// let x = PrestoJob::new().set_query_list(QueryList::default()/* use setters */);
12479    /// assert!(x.query_list().is_some());
12480    /// assert!(x.query_file_uri().is_none());
12481    /// ```
12482    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12483        mut self,
12484        v: T,
12485    ) -> Self {
12486        self.queries =
12487            std::option::Option::Some(crate::model::presto_job::Queries::QueryList(v.into()));
12488        self
12489    }
12490}
12491
12492impl wkt::message::Message for PrestoJob {
12493    fn typename() -> &'static str {
12494        "type.googleapis.com/google.cloud.dataproc.v1.PrestoJob"
12495    }
12496}
12497
12498/// Defines additional types related to [PrestoJob].
12499pub mod presto_job {
12500    #[allow(unused_imports)]
12501    use super::*;
12502
12503    /// Required. The sequence of Presto queries to execute, specified as
12504    /// either an HCFS file URI or as a list of queries.
12505    #[derive(Clone, Debug, PartialEq)]
12506    #[non_exhaustive]
12507    pub enum Queries {
12508        /// The HCFS URI of the script that contains SQL queries.
12509        QueryFileUri(std::string::String),
12510        /// A list of queries.
12511        QueryList(std::boxed::Box<crate::model::QueryList>),
12512    }
12513}
12514
12515/// A Dataproc job for running [Trino](https://trino.io/) queries.
12516/// **IMPORTANT**: The [Dataproc Trino Optional
12517/// Component](https://cloud.google.com/dataproc/docs/concepts/components/trino)
12518/// must be enabled when the cluster is created to submit a Trino job to the
12519/// cluster.
12520#[derive(Clone, Default, PartialEq)]
12521#[non_exhaustive]
12522pub struct TrinoJob {
12523    /// Optional. Whether to continue executing queries if a query fails.
12524    /// The default value is `false`. Setting to `true` can be useful when
12525    /// executing independent parallel queries.
12526    pub continue_on_failure: bool,
12527
12528    /// Optional. The format in which query output will be displayed. See the
12529    /// Trino documentation for supported output formats
12530    pub output_format: std::string::String,
12531
12532    /// Optional. Trino client tags to attach to this query
12533    pub client_tags: std::vec::Vec<std::string::String>,
12534
12535    /// Optional. A mapping of property names to values. Used to set Trino
12536    /// [session properties](https://trino.io/docs/current/sql/set-session.html)
12537    /// Equivalent to using the --session flag in the Trino CLI
12538    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12539
12540    /// Optional. The runtime log config for job execution.
12541    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12542
12543    /// Required. The sequence of Trino queries to execute, specified as
12544    /// either an HCFS file URI or as a list of queries.
12545    pub queries: std::option::Option<crate::model::trino_job::Queries>,
12546
12547    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12548}
12549
12550impl TrinoJob {
12551    pub fn new() -> Self {
12552        std::default::Default::default()
12553    }
12554
12555    /// Sets the value of [continue_on_failure][crate::model::TrinoJob::continue_on_failure].
12556    ///
12557    /// # Example
12558    /// ```ignore,no_run
12559    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12560    /// let x = TrinoJob::new().set_continue_on_failure(true);
12561    /// ```
12562    pub fn set_continue_on_failure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12563        self.continue_on_failure = v.into();
12564        self
12565    }
12566
12567    /// Sets the value of [output_format][crate::model::TrinoJob::output_format].
12568    ///
12569    /// # Example
12570    /// ```ignore,no_run
12571    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12572    /// let x = TrinoJob::new().set_output_format("example");
12573    /// ```
12574    pub fn set_output_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12575        self.output_format = v.into();
12576        self
12577    }
12578
12579    /// Sets the value of [client_tags][crate::model::TrinoJob::client_tags].
12580    ///
12581    /// # Example
12582    /// ```ignore,no_run
12583    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12584    /// let x = TrinoJob::new().set_client_tags(["a", "b", "c"]);
12585    /// ```
12586    pub fn set_client_tags<T, V>(mut self, v: T) -> Self
12587    where
12588        T: std::iter::IntoIterator<Item = V>,
12589        V: std::convert::Into<std::string::String>,
12590    {
12591        use std::iter::Iterator;
12592        self.client_tags = v.into_iter().map(|i| i.into()).collect();
12593        self
12594    }
12595
12596    /// Sets the value of [properties][crate::model::TrinoJob::properties].
12597    ///
12598    /// # Example
12599    /// ```ignore,no_run
12600    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12601    /// let x = TrinoJob::new().set_properties([
12602    ///     ("key0", "abc"),
12603    ///     ("key1", "xyz"),
12604    /// ]);
12605    /// ```
12606    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12607    where
12608        T: std::iter::IntoIterator<Item = (K, V)>,
12609        K: std::convert::Into<std::string::String>,
12610        V: std::convert::Into<std::string::String>,
12611    {
12612        use std::iter::Iterator;
12613        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12614        self
12615    }
12616
12617    /// Sets the value of [logging_config][crate::model::TrinoJob::logging_config].
12618    ///
12619    /// # Example
12620    /// ```ignore,no_run
12621    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12622    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12623    /// let x = TrinoJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12624    /// ```
12625    pub fn set_logging_config<T>(mut self, v: T) -> Self
12626    where
12627        T: std::convert::Into<crate::model::LoggingConfig>,
12628    {
12629        self.logging_config = std::option::Option::Some(v.into());
12630        self
12631    }
12632
12633    /// Sets or clears the value of [logging_config][crate::model::TrinoJob::logging_config].
12634    ///
12635    /// # Example
12636    /// ```ignore,no_run
12637    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12638    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12639    /// let x = TrinoJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12640    /// let x = TrinoJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12641    /// ```
12642    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12643    where
12644        T: std::convert::Into<crate::model::LoggingConfig>,
12645    {
12646        self.logging_config = v.map(|x| x.into());
12647        self
12648    }
12649
12650    /// Sets the value of [queries][crate::model::TrinoJob::queries].
12651    ///
12652    /// Note that all the setters affecting `queries` are mutually
12653    /// exclusive.
12654    ///
12655    /// # Example
12656    /// ```ignore,no_run
12657    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12658    /// use google_cloud_dataproc_v1::model::trino_job::Queries;
12659    /// let x = TrinoJob::new().set_queries(Some(Queries::QueryFileUri("example".to_string())));
12660    /// ```
12661    pub fn set_queries<
12662        T: std::convert::Into<std::option::Option<crate::model::trino_job::Queries>>,
12663    >(
12664        mut self,
12665        v: T,
12666    ) -> Self {
12667        self.queries = v.into();
12668        self
12669    }
12670
12671    /// The value of [queries][crate::model::TrinoJob::queries]
12672    /// if it holds a `QueryFileUri`, `None` if the field is not set or
12673    /// holds a different branch.
12674    pub fn query_file_uri(&self) -> std::option::Option<&std::string::String> {
12675        #[allow(unreachable_patterns)]
12676        self.queries.as_ref().and_then(|v| match v {
12677            crate::model::trino_job::Queries::QueryFileUri(v) => std::option::Option::Some(v),
12678            _ => std::option::Option::None,
12679        })
12680    }
12681
12682    /// Sets the value of [queries][crate::model::TrinoJob::queries]
12683    /// to hold a `QueryFileUri`.
12684    ///
12685    /// Note that all the setters affecting `queries` are
12686    /// mutually exclusive.
12687    ///
12688    /// # Example
12689    /// ```ignore,no_run
12690    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12691    /// let x = TrinoJob::new().set_query_file_uri("example");
12692    /// assert!(x.query_file_uri().is_some());
12693    /// assert!(x.query_list().is_none());
12694    /// ```
12695    pub fn set_query_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12696        self.queries =
12697            std::option::Option::Some(crate::model::trino_job::Queries::QueryFileUri(v.into()));
12698        self
12699    }
12700
12701    /// The value of [queries][crate::model::TrinoJob::queries]
12702    /// if it holds a `QueryList`, `None` if the field is not set or
12703    /// holds a different branch.
12704    pub fn query_list(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryList>> {
12705        #[allow(unreachable_patterns)]
12706        self.queries.as_ref().and_then(|v| match v {
12707            crate::model::trino_job::Queries::QueryList(v) => std::option::Option::Some(v),
12708            _ => std::option::Option::None,
12709        })
12710    }
12711
12712    /// Sets the value of [queries][crate::model::TrinoJob::queries]
12713    /// to hold a `QueryList`.
12714    ///
12715    /// Note that all the setters affecting `queries` are
12716    /// mutually exclusive.
12717    ///
12718    /// # Example
12719    /// ```ignore,no_run
12720    /// # use google_cloud_dataproc_v1::model::TrinoJob;
12721    /// use google_cloud_dataproc_v1::model::QueryList;
12722    /// let x = TrinoJob::new().set_query_list(QueryList::default()/* use setters */);
12723    /// assert!(x.query_list().is_some());
12724    /// assert!(x.query_file_uri().is_none());
12725    /// ```
12726    pub fn set_query_list<T: std::convert::Into<std::boxed::Box<crate::model::QueryList>>>(
12727        mut self,
12728        v: T,
12729    ) -> Self {
12730        self.queries =
12731            std::option::Option::Some(crate::model::trino_job::Queries::QueryList(v.into()));
12732        self
12733    }
12734}
12735
12736impl wkt::message::Message for TrinoJob {
12737    fn typename() -> &'static str {
12738        "type.googleapis.com/google.cloud.dataproc.v1.TrinoJob"
12739    }
12740}
12741
12742/// Defines additional types related to [TrinoJob].
12743pub mod trino_job {
12744    #[allow(unused_imports)]
12745    use super::*;
12746
12747    /// Required. The sequence of Trino queries to execute, specified as
12748    /// either an HCFS file URI or as a list of queries.
12749    #[derive(Clone, Debug, PartialEq)]
12750    #[non_exhaustive]
12751    pub enum Queries {
12752        /// The HCFS URI of the script that contains SQL queries.
12753        QueryFileUri(std::string::String),
12754        /// A list of queries.
12755        QueryList(std::boxed::Box<crate::model::QueryList>),
12756    }
12757}
12758
12759/// A Dataproc job for running Apache Flink applications on YARN.
12760#[derive(Clone, Default, PartialEq)]
12761#[non_exhaustive]
12762pub struct FlinkJob {
12763    /// Optional. The arguments to pass to the driver. Do not include arguments,
12764    /// such as `--conf`, that can be set as job properties, since a collision
12765    /// might occur that causes an incorrect job submission.
12766    pub args: std::vec::Vec<std::string::String>,
12767
12768    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the
12769    /// Flink driver and tasks.
12770    pub jar_file_uris: std::vec::Vec<std::string::String>,
12771
12772    /// Optional. HCFS URI of the savepoint, which contains the last saved progress
12773    /// for starting the current job.
12774    pub savepoint_uri: std::string::String,
12775
12776    /// Optional. A mapping of property names to values, used to configure Flink.
12777    /// Properties that conflict with values set by the Dataproc API might be
12778    /// overwritten. Can include properties set in
12779    /// `/etc/flink/conf/flink-defaults.conf` and classes in user code.
12780    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
12781
12782    /// Optional. The runtime log config for job execution.
12783    pub logging_config: std::option::Option<crate::model::LoggingConfig>,
12784
12785    /// Required. The specification of the main method to call to drive the job.
12786    /// Specify either the jar file that contains the main class or the main class
12787    /// name. To pass both a main jar and a main class in the jar, add the jar to
12788    /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
12789    /// specify the main class name in
12790    /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
12791    ///
12792    /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
12793    /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
12794    pub driver: std::option::Option<crate::model::flink_job::Driver>,
12795
12796    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12797}
12798
12799impl FlinkJob {
12800    pub fn new() -> Self {
12801        std::default::Default::default()
12802    }
12803
12804    /// Sets the value of [args][crate::model::FlinkJob::args].
12805    ///
12806    /// # Example
12807    /// ```ignore,no_run
12808    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12809    /// let x = FlinkJob::new().set_args(["a", "b", "c"]);
12810    /// ```
12811    pub fn set_args<T, V>(mut self, v: T) -> Self
12812    where
12813        T: std::iter::IntoIterator<Item = V>,
12814        V: std::convert::Into<std::string::String>,
12815    {
12816        use std::iter::Iterator;
12817        self.args = v.into_iter().map(|i| i.into()).collect();
12818        self
12819    }
12820
12821    /// Sets the value of [jar_file_uris][crate::model::FlinkJob::jar_file_uris].
12822    ///
12823    /// # Example
12824    /// ```ignore,no_run
12825    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12826    /// let x = FlinkJob::new().set_jar_file_uris(["a", "b", "c"]);
12827    /// ```
12828    pub fn set_jar_file_uris<T, V>(mut self, v: T) -> Self
12829    where
12830        T: std::iter::IntoIterator<Item = V>,
12831        V: std::convert::Into<std::string::String>,
12832    {
12833        use std::iter::Iterator;
12834        self.jar_file_uris = v.into_iter().map(|i| i.into()).collect();
12835        self
12836    }
12837
12838    /// Sets the value of [savepoint_uri][crate::model::FlinkJob::savepoint_uri].
12839    ///
12840    /// # Example
12841    /// ```ignore,no_run
12842    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12843    /// let x = FlinkJob::new().set_savepoint_uri("example");
12844    /// ```
12845    pub fn set_savepoint_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12846        self.savepoint_uri = v.into();
12847        self
12848    }
12849
12850    /// Sets the value of [properties][crate::model::FlinkJob::properties].
12851    ///
12852    /// # Example
12853    /// ```ignore,no_run
12854    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12855    /// let x = FlinkJob::new().set_properties([
12856    ///     ("key0", "abc"),
12857    ///     ("key1", "xyz"),
12858    /// ]);
12859    /// ```
12860    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
12861    where
12862        T: std::iter::IntoIterator<Item = (K, V)>,
12863        K: std::convert::Into<std::string::String>,
12864        V: std::convert::Into<std::string::String>,
12865    {
12866        use std::iter::Iterator;
12867        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12868        self
12869    }
12870
12871    /// Sets the value of [logging_config][crate::model::FlinkJob::logging_config].
12872    ///
12873    /// # Example
12874    /// ```ignore,no_run
12875    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12876    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12877    /// let x = FlinkJob::new().set_logging_config(LoggingConfig::default()/* use setters */);
12878    /// ```
12879    pub fn set_logging_config<T>(mut self, v: T) -> Self
12880    where
12881        T: std::convert::Into<crate::model::LoggingConfig>,
12882    {
12883        self.logging_config = std::option::Option::Some(v.into());
12884        self
12885    }
12886
12887    /// Sets or clears the value of [logging_config][crate::model::FlinkJob::logging_config].
12888    ///
12889    /// # Example
12890    /// ```ignore,no_run
12891    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12892    /// use google_cloud_dataproc_v1::model::LoggingConfig;
12893    /// let x = FlinkJob::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
12894    /// let x = FlinkJob::new().set_or_clear_logging_config(None::<LoggingConfig>);
12895    /// ```
12896    pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
12897    where
12898        T: std::convert::Into<crate::model::LoggingConfig>,
12899    {
12900        self.logging_config = v.map(|x| x.into());
12901        self
12902    }
12903
12904    /// Sets the value of [driver][crate::model::FlinkJob::driver].
12905    ///
12906    /// Note that all the setters affecting `driver` are mutually
12907    /// exclusive.
12908    ///
12909    /// # Example
12910    /// ```ignore,no_run
12911    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12912    /// use google_cloud_dataproc_v1::model::flink_job::Driver;
12913    /// let x = FlinkJob::new().set_driver(Some(Driver::MainJarFileUri("example".to_string())));
12914    /// ```
12915    pub fn set_driver<
12916        T: std::convert::Into<std::option::Option<crate::model::flink_job::Driver>>,
12917    >(
12918        mut self,
12919        v: T,
12920    ) -> Self {
12921        self.driver = v.into();
12922        self
12923    }
12924
12925    /// The value of [driver][crate::model::FlinkJob::driver]
12926    /// if it holds a `MainJarFileUri`, `None` if the field is not set or
12927    /// holds a different branch.
12928    pub fn main_jar_file_uri(&self) -> std::option::Option<&std::string::String> {
12929        #[allow(unreachable_patterns)]
12930        self.driver.as_ref().and_then(|v| match v {
12931            crate::model::flink_job::Driver::MainJarFileUri(v) => std::option::Option::Some(v),
12932            _ => std::option::Option::None,
12933        })
12934    }
12935
12936    /// Sets the value of [driver][crate::model::FlinkJob::driver]
12937    /// to hold a `MainJarFileUri`.
12938    ///
12939    /// Note that all the setters affecting `driver` are
12940    /// mutually exclusive.
12941    ///
12942    /// # Example
12943    /// ```ignore,no_run
12944    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12945    /// let x = FlinkJob::new().set_main_jar_file_uri("example");
12946    /// assert!(x.main_jar_file_uri().is_some());
12947    /// assert!(x.main_class().is_none());
12948    /// ```
12949    pub fn set_main_jar_file_uri<T: std::convert::Into<std::string::String>>(
12950        mut self,
12951        v: T,
12952    ) -> Self {
12953        self.driver =
12954            std::option::Option::Some(crate::model::flink_job::Driver::MainJarFileUri(v.into()));
12955        self
12956    }
12957
12958    /// The value of [driver][crate::model::FlinkJob::driver]
12959    /// if it holds a `MainClass`, `None` if the field is not set or
12960    /// holds a different branch.
12961    pub fn main_class(&self) -> std::option::Option<&std::string::String> {
12962        #[allow(unreachable_patterns)]
12963        self.driver.as_ref().and_then(|v| match v {
12964            crate::model::flink_job::Driver::MainClass(v) => std::option::Option::Some(v),
12965            _ => std::option::Option::None,
12966        })
12967    }
12968
12969    /// Sets the value of [driver][crate::model::FlinkJob::driver]
12970    /// to hold a `MainClass`.
12971    ///
12972    /// Note that all the setters affecting `driver` are
12973    /// mutually exclusive.
12974    ///
12975    /// # Example
12976    /// ```ignore,no_run
12977    /// # use google_cloud_dataproc_v1::model::FlinkJob;
12978    /// let x = FlinkJob::new().set_main_class("example");
12979    /// assert!(x.main_class().is_some());
12980    /// assert!(x.main_jar_file_uri().is_none());
12981    /// ```
12982    pub fn set_main_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12983        self.driver =
12984            std::option::Option::Some(crate::model::flink_job::Driver::MainClass(v.into()));
12985        self
12986    }
12987}
12988
12989impl wkt::message::Message for FlinkJob {
12990    fn typename() -> &'static str {
12991        "type.googleapis.com/google.cloud.dataproc.v1.FlinkJob"
12992    }
12993}
12994
12995/// Defines additional types related to [FlinkJob].
12996pub mod flink_job {
12997    #[allow(unused_imports)]
12998    use super::*;
12999
13000    /// Required. The specification of the main method to call to drive the job.
13001    /// Specify either the jar file that contains the main class or the main class
13002    /// name. To pass both a main jar and a main class in the jar, add the jar to
13003    /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris], and then
13004    /// specify the main class name in
13005    /// [mainClass][google.cloud.dataproc.v1.FlinkJob.main_class].
13006    ///
13007    /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13008    /// [google.cloud.dataproc.v1.FlinkJob.main_class]: crate::model::FlinkJob::driver
13009    #[derive(Clone, Debug, PartialEq)]
13010    #[non_exhaustive]
13011    pub enum Driver {
13012        /// The HCFS URI of the jar file that contains the main class.
13013        MainJarFileUri(std::string::String),
13014        /// The name of the driver's main class. The jar file that contains the class
13015        /// must be in the default CLASSPATH or specified in
13016        /// [jarFileUris][google.cloud.dataproc.v1.FlinkJob.jar_file_uris].
13017        ///
13018        /// [google.cloud.dataproc.v1.FlinkJob.jar_file_uris]: crate::model::FlinkJob::jar_file_uris
13019        MainClass(std::string::String),
13020    }
13021}
13022
13023/// Dataproc job config.
13024#[derive(Clone, Default, PartialEq)]
13025#[non_exhaustive]
13026pub struct JobPlacement {
13027    /// Required. The name of the cluster where the job will be submitted.
13028    pub cluster_name: std::string::String,
13029
13030    /// Output only. A cluster UUID generated by the Dataproc service when
13031    /// the job is submitted.
13032    pub cluster_uuid: std::string::String,
13033
13034    /// Optional. Cluster labels to identify a cluster where the job will be
13035    /// submitted.
13036    pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
13037
13038    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13039}
13040
13041impl JobPlacement {
13042    pub fn new() -> Self {
13043        std::default::Default::default()
13044    }
13045
13046    /// Sets the value of [cluster_name][crate::model::JobPlacement::cluster_name].
13047    ///
13048    /// # Example
13049    /// ```ignore,no_run
13050    /// # use google_cloud_dataproc_v1::model::JobPlacement;
13051    /// let x = JobPlacement::new().set_cluster_name("example");
13052    /// ```
13053    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13054        self.cluster_name = v.into();
13055        self
13056    }
13057
13058    /// Sets the value of [cluster_uuid][crate::model::JobPlacement::cluster_uuid].
13059    ///
13060    /// # Example
13061    /// ```ignore,no_run
13062    /// # use google_cloud_dataproc_v1::model::JobPlacement;
13063    /// let x = JobPlacement::new().set_cluster_uuid("example");
13064    /// ```
13065    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13066        self.cluster_uuid = v.into();
13067        self
13068    }
13069
13070    /// Sets the value of [cluster_labels][crate::model::JobPlacement::cluster_labels].
13071    ///
13072    /// # Example
13073    /// ```ignore,no_run
13074    /// # use google_cloud_dataproc_v1::model::JobPlacement;
13075    /// let x = JobPlacement::new().set_cluster_labels([
13076    ///     ("key0", "abc"),
13077    ///     ("key1", "xyz"),
13078    /// ]);
13079    /// ```
13080    pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
13081    where
13082        T: std::iter::IntoIterator<Item = (K, V)>,
13083        K: std::convert::Into<std::string::String>,
13084        V: std::convert::Into<std::string::String>,
13085    {
13086        use std::iter::Iterator;
13087        self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13088        self
13089    }
13090}
13091
13092impl wkt::message::Message for JobPlacement {
13093    fn typename() -> &'static str {
13094        "type.googleapis.com/google.cloud.dataproc.v1.JobPlacement"
13095    }
13096}
13097
13098/// Dataproc job status.
13099#[derive(Clone, Default, PartialEq)]
13100#[non_exhaustive]
13101pub struct JobStatus {
13102    /// Output only. A state message specifying the overall job state.
13103    pub state: crate::model::job_status::State,
13104
13105    /// Optional. Output only. Job state details, such as an error
13106    /// description if the state is `ERROR`.
13107    pub details: std::string::String,
13108
13109    /// Output only. The time when this state was entered.
13110    pub state_start_time: std::option::Option<wkt::Timestamp>,
13111
13112    /// Output only. Additional state information, which includes
13113    /// status reported by the agent.
13114    pub substate: crate::model::job_status::Substate,
13115
13116    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13117}
13118
13119impl JobStatus {
13120    pub fn new() -> Self {
13121        std::default::Default::default()
13122    }
13123
13124    /// Sets the value of [state][crate::model::JobStatus::state].
13125    ///
13126    /// # Example
13127    /// ```ignore,no_run
13128    /// # use google_cloud_dataproc_v1::model::JobStatus;
13129    /// use google_cloud_dataproc_v1::model::job_status::State;
13130    /// let x0 = JobStatus::new().set_state(State::Pending);
13131    /// let x1 = JobStatus::new().set_state(State::SetupDone);
13132    /// let x2 = JobStatus::new().set_state(State::Running);
13133    /// ```
13134    pub fn set_state<T: std::convert::Into<crate::model::job_status::State>>(
13135        mut self,
13136        v: T,
13137    ) -> Self {
13138        self.state = v.into();
13139        self
13140    }
13141
13142    /// Sets the value of [details][crate::model::JobStatus::details].
13143    ///
13144    /// # Example
13145    /// ```ignore,no_run
13146    /// # use google_cloud_dataproc_v1::model::JobStatus;
13147    /// let x = JobStatus::new().set_details("example");
13148    /// ```
13149    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13150        self.details = v.into();
13151        self
13152    }
13153
13154    /// Sets the value of [state_start_time][crate::model::JobStatus::state_start_time].
13155    ///
13156    /// # Example
13157    /// ```ignore,no_run
13158    /// # use google_cloud_dataproc_v1::model::JobStatus;
13159    /// use wkt::Timestamp;
13160    /// let x = JobStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
13161    /// ```
13162    pub fn set_state_start_time<T>(mut self, v: T) -> Self
13163    where
13164        T: std::convert::Into<wkt::Timestamp>,
13165    {
13166        self.state_start_time = std::option::Option::Some(v.into());
13167        self
13168    }
13169
13170    /// Sets or clears the value of [state_start_time][crate::model::JobStatus::state_start_time].
13171    ///
13172    /// # Example
13173    /// ```ignore,no_run
13174    /// # use google_cloud_dataproc_v1::model::JobStatus;
13175    /// use wkt::Timestamp;
13176    /// let x = JobStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
13177    /// let x = JobStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
13178    /// ```
13179    pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
13180    where
13181        T: std::convert::Into<wkt::Timestamp>,
13182    {
13183        self.state_start_time = v.map(|x| x.into());
13184        self
13185    }
13186
13187    /// Sets the value of [substate][crate::model::JobStatus::substate].
13188    ///
13189    /// # Example
13190    /// ```ignore,no_run
13191    /// # use google_cloud_dataproc_v1::model::JobStatus;
13192    /// use google_cloud_dataproc_v1::model::job_status::Substate;
13193    /// let x0 = JobStatus::new().set_substate(Substate::Submitted);
13194    /// let x1 = JobStatus::new().set_substate(Substate::Queued);
13195    /// let x2 = JobStatus::new().set_substate(Substate::StaleStatus);
13196    /// ```
13197    pub fn set_substate<T: std::convert::Into<crate::model::job_status::Substate>>(
13198        mut self,
13199        v: T,
13200    ) -> Self {
13201        self.substate = v.into();
13202        self
13203    }
13204}
13205
13206impl wkt::message::Message for JobStatus {
13207    fn typename() -> &'static str {
13208        "type.googleapis.com/google.cloud.dataproc.v1.JobStatus"
13209    }
13210}
13211
13212/// Defines additional types related to [JobStatus].
13213pub mod job_status {
13214    #[allow(unused_imports)]
13215    use super::*;
13216
13217    /// The job state.
13218    ///
13219    /// # Working with unknown values
13220    ///
13221    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13222    /// additional enum variants at any time. Adding new variants is not considered
13223    /// a breaking change. Applications should write their code in anticipation of:
13224    ///
13225    /// - New values appearing in future releases of the client library, **and**
13226    /// - New values received dynamically, without application changes.
13227    ///
13228    /// Please consult the [Working with enums] section in the user guide for some
13229    /// guidelines.
13230    ///
13231    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13232    #[derive(Clone, Debug, PartialEq)]
13233    #[non_exhaustive]
13234    pub enum State {
13235        /// The job state is unknown.
13236        Unspecified,
13237        /// The job is pending; it has been submitted, but is not yet running.
13238        Pending,
13239        /// Job has been received by the service and completed initial setup;
13240        /// it will soon be submitted to the cluster.
13241        SetupDone,
13242        /// The job is running on the cluster.
13243        Running,
13244        /// A CancelJob request has been received, but is pending.
13245        CancelPending,
13246        /// Transient in-flight resources have been canceled, and the request to
13247        /// cancel the running job has been issued to the cluster.
13248        CancelStarted,
13249        /// The job cancellation was successful.
13250        Cancelled,
13251        /// The job has completed successfully.
13252        Done,
13253        /// The job has completed, but encountered an error.
13254        Error,
13255        /// Job attempt has failed. The detail field contains failure details for
13256        /// this attempt.
13257        ///
13258        /// Applies to restartable jobs only.
13259        AttemptFailure,
13260        /// If set, the enum was initialized with an unknown value.
13261        ///
13262        /// Applications can examine the value using [State::value] or
13263        /// [State::name].
13264        UnknownValue(state::UnknownValue),
13265    }
13266
13267    #[doc(hidden)]
13268    pub mod state {
13269        #[allow(unused_imports)]
13270        use super::*;
13271        #[derive(Clone, Debug, PartialEq)]
13272        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13273    }
13274
13275    impl State {
13276        /// Gets the enum value.
13277        ///
13278        /// Returns `None` if the enum contains an unknown value deserialized from
13279        /// the string representation of enums.
13280        pub fn value(&self) -> std::option::Option<i32> {
13281            match self {
13282                Self::Unspecified => std::option::Option::Some(0),
13283                Self::Pending => std::option::Option::Some(1),
13284                Self::SetupDone => std::option::Option::Some(8),
13285                Self::Running => std::option::Option::Some(2),
13286                Self::CancelPending => std::option::Option::Some(3),
13287                Self::CancelStarted => std::option::Option::Some(7),
13288                Self::Cancelled => std::option::Option::Some(4),
13289                Self::Done => std::option::Option::Some(5),
13290                Self::Error => std::option::Option::Some(6),
13291                Self::AttemptFailure => std::option::Option::Some(9),
13292                Self::UnknownValue(u) => u.0.value(),
13293            }
13294        }
13295
13296        /// Gets the enum value as a string.
13297        ///
13298        /// Returns `None` if the enum contains an unknown value deserialized from
13299        /// the integer representation of enums.
13300        pub fn name(&self) -> std::option::Option<&str> {
13301            match self {
13302                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13303                Self::Pending => std::option::Option::Some("PENDING"),
13304                Self::SetupDone => std::option::Option::Some("SETUP_DONE"),
13305                Self::Running => std::option::Option::Some("RUNNING"),
13306                Self::CancelPending => std::option::Option::Some("CANCEL_PENDING"),
13307                Self::CancelStarted => std::option::Option::Some("CANCEL_STARTED"),
13308                Self::Cancelled => std::option::Option::Some("CANCELLED"),
13309                Self::Done => std::option::Option::Some("DONE"),
13310                Self::Error => std::option::Option::Some("ERROR"),
13311                Self::AttemptFailure => std::option::Option::Some("ATTEMPT_FAILURE"),
13312                Self::UnknownValue(u) => u.0.name(),
13313            }
13314        }
13315    }
13316
13317    impl std::default::Default for State {
13318        fn default() -> Self {
13319            use std::convert::From;
13320            Self::from(0)
13321        }
13322    }
13323
13324    impl std::fmt::Display for State {
13325        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13326            wkt::internal::display_enum(f, self.name(), self.value())
13327        }
13328    }
13329
13330    impl std::convert::From<i32> for State {
13331        fn from(value: i32) -> Self {
13332            match value {
13333                0 => Self::Unspecified,
13334                1 => Self::Pending,
13335                2 => Self::Running,
13336                3 => Self::CancelPending,
13337                4 => Self::Cancelled,
13338                5 => Self::Done,
13339                6 => Self::Error,
13340                7 => Self::CancelStarted,
13341                8 => Self::SetupDone,
13342                9 => Self::AttemptFailure,
13343                _ => Self::UnknownValue(state::UnknownValue(
13344                    wkt::internal::UnknownEnumValue::Integer(value),
13345                )),
13346            }
13347        }
13348    }
13349
13350    impl std::convert::From<&str> for State {
13351        fn from(value: &str) -> Self {
13352            use std::string::ToString;
13353            match value {
13354                "STATE_UNSPECIFIED" => Self::Unspecified,
13355                "PENDING" => Self::Pending,
13356                "SETUP_DONE" => Self::SetupDone,
13357                "RUNNING" => Self::Running,
13358                "CANCEL_PENDING" => Self::CancelPending,
13359                "CANCEL_STARTED" => Self::CancelStarted,
13360                "CANCELLED" => Self::Cancelled,
13361                "DONE" => Self::Done,
13362                "ERROR" => Self::Error,
13363                "ATTEMPT_FAILURE" => Self::AttemptFailure,
13364                _ => Self::UnknownValue(state::UnknownValue(
13365                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13366                )),
13367            }
13368        }
13369    }
13370
13371    impl serde::ser::Serialize for State {
13372        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13373        where
13374            S: serde::Serializer,
13375        {
13376            match self {
13377                Self::Unspecified => serializer.serialize_i32(0),
13378                Self::Pending => serializer.serialize_i32(1),
13379                Self::SetupDone => serializer.serialize_i32(8),
13380                Self::Running => serializer.serialize_i32(2),
13381                Self::CancelPending => serializer.serialize_i32(3),
13382                Self::CancelStarted => serializer.serialize_i32(7),
13383                Self::Cancelled => serializer.serialize_i32(4),
13384                Self::Done => serializer.serialize_i32(5),
13385                Self::Error => serializer.serialize_i32(6),
13386                Self::AttemptFailure => serializer.serialize_i32(9),
13387                Self::UnknownValue(u) => u.0.serialize(serializer),
13388            }
13389        }
13390    }
13391
13392    impl<'de> serde::de::Deserialize<'de> for State {
13393        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13394        where
13395            D: serde::Deserializer<'de>,
13396        {
13397            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13398                ".google.cloud.dataproc.v1.JobStatus.State",
13399            ))
13400        }
13401    }
13402
13403    /// The job substate.
13404    ///
13405    /// # Working with unknown values
13406    ///
13407    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13408    /// additional enum variants at any time. Adding new variants is not considered
13409    /// a breaking change. Applications should write their code in anticipation of:
13410    ///
13411    /// - New values appearing in future releases of the client library, **and**
13412    /// - New values received dynamically, without application changes.
13413    ///
13414    /// Please consult the [Working with enums] section in the user guide for some
13415    /// guidelines.
13416    ///
13417    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13418    #[derive(Clone, Debug, PartialEq)]
13419    #[non_exhaustive]
13420    pub enum Substate {
13421        /// The job substate is unknown.
13422        Unspecified,
13423        /// The Job is submitted to the agent.
13424        ///
13425        /// Applies to RUNNING state.
13426        Submitted,
13427        /// The Job has been received and is awaiting execution (it might be waiting
13428        /// for a condition to be met). See the "details" field for the reason for
13429        /// the delay.
13430        ///
13431        /// Applies to RUNNING state.
13432        Queued,
13433        /// The agent-reported status is out of date, which can be caused by a
13434        /// loss of communication between the agent and Dataproc. If the
13435        /// agent does not send a timely update, the job will fail.
13436        ///
13437        /// Applies to RUNNING state.
13438        StaleStatus,
13439        /// If set, the enum was initialized with an unknown value.
13440        ///
13441        /// Applications can examine the value using [Substate::value] or
13442        /// [Substate::name].
13443        UnknownValue(substate::UnknownValue),
13444    }
13445
13446    #[doc(hidden)]
13447    pub mod substate {
13448        #[allow(unused_imports)]
13449        use super::*;
13450        #[derive(Clone, Debug, PartialEq)]
13451        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13452    }
13453
13454    impl Substate {
13455        /// Gets the enum value.
13456        ///
13457        /// Returns `None` if the enum contains an unknown value deserialized from
13458        /// the string representation of enums.
13459        pub fn value(&self) -> std::option::Option<i32> {
13460            match self {
13461                Self::Unspecified => std::option::Option::Some(0),
13462                Self::Submitted => std::option::Option::Some(1),
13463                Self::Queued => std::option::Option::Some(2),
13464                Self::StaleStatus => std::option::Option::Some(3),
13465                Self::UnknownValue(u) => u.0.value(),
13466            }
13467        }
13468
13469        /// Gets the enum value as a string.
13470        ///
13471        /// Returns `None` if the enum contains an unknown value deserialized from
13472        /// the integer representation of enums.
13473        pub fn name(&self) -> std::option::Option<&str> {
13474            match self {
13475                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
13476                Self::Submitted => std::option::Option::Some("SUBMITTED"),
13477                Self::Queued => std::option::Option::Some("QUEUED"),
13478                Self::StaleStatus => std::option::Option::Some("STALE_STATUS"),
13479                Self::UnknownValue(u) => u.0.name(),
13480            }
13481        }
13482    }
13483
13484    impl std::default::Default for Substate {
13485        fn default() -> Self {
13486            use std::convert::From;
13487            Self::from(0)
13488        }
13489    }
13490
13491    impl std::fmt::Display for Substate {
13492        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13493            wkt::internal::display_enum(f, self.name(), self.value())
13494        }
13495    }
13496
13497    impl std::convert::From<i32> for Substate {
13498        fn from(value: i32) -> Self {
13499            match value {
13500                0 => Self::Unspecified,
13501                1 => Self::Submitted,
13502                2 => Self::Queued,
13503                3 => Self::StaleStatus,
13504                _ => Self::UnknownValue(substate::UnknownValue(
13505                    wkt::internal::UnknownEnumValue::Integer(value),
13506                )),
13507            }
13508        }
13509    }
13510
13511    impl std::convert::From<&str> for Substate {
13512        fn from(value: &str) -> Self {
13513            use std::string::ToString;
13514            match value {
13515                "UNSPECIFIED" => Self::Unspecified,
13516                "SUBMITTED" => Self::Submitted,
13517                "QUEUED" => Self::Queued,
13518                "STALE_STATUS" => Self::StaleStatus,
13519                _ => Self::UnknownValue(substate::UnknownValue(
13520                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13521                )),
13522            }
13523        }
13524    }
13525
13526    impl serde::ser::Serialize for Substate {
13527        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13528        where
13529            S: serde::Serializer,
13530        {
13531            match self {
13532                Self::Unspecified => serializer.serialize_i32(0),
13533                Self::Submitted => serializer.serialize_i32(1),
13534                Self::Queued => serializer.serialize_i32(2),
13535                Self::StaleStatus => serializer.serialize_i32(3),
13536                Self::UnknownValue(u) => u.0.serialize(serializer),
13537            }
13538        }
13539    }
13540
13541    impl<'de> serde::de::Deserialize<'de> for Substate {
13542        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13543        where
13544            D: serde::Deserializer<'de>,
13545        {
13546            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Substate>::new(
13547                ".google.cloud.dataproc.v1.JobStatus.Substate",
13548            ))
13549        }
13550    }
13551}
13552
13553/// Encapsulates the full scoping used to reference a job.
13554#[derive(Clone, Default, PartialEq)]
13555#[non_exhaustive]
13556pub struct JobReference {
13557    /// Optional. The ID of the Google Cloud Platform project that the job belongs
13558    /// to. If specified, must match the request project ID.
13559    pub project_id: std::string::String,
13560
13561    /// Optional. The job ID, which must be unique within the project.
13562    ///
13563    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
13564    /// underscores (_), or hyphens (-). The maximum length is 100 characters.
13565    ///
13566    /// If not specified by the caller, the job ID will be provided by the server.
13567    pub job_id: std::string::String,
13568
13569    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13570}
13571
13572impl JobReference {
13573    pub fn new() -> Self {
13574        std::default::Default::default()
13575    }
13576
13577    /// Sets the value of [project_id][crate::model::JobReference::project_id].
13578    ///
13579    /// # Example
13580    /// ```ignore,no_run
13581    /// # use google_cloud_dataproc_v1::model::JobReference;
13582    /// let x = JobReference::new().set_project_id("example");
13583    /// ```
13584    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13585        self.project_id = v.into();
13586        self
13587    }
13588
13589    /// Sets the value of [job_id][crate::model::JobReference::job_id].
13590    ///
13591    /// # Example
13592    /// ```ignore,no_run
13593    /// # use google_cloud_dataproc_v1::model::JobReference;
13594    /// let x = JobReference::new().set_job_id("example");
13595    /// ```
13596    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13597        self.job_id = v.into();
13598        self
13599    }
13600}
13601
13602impl wkt::message::Message for JobReference {
13603    fn typename() -> &'static str {
13604        "type.googleapis.com/google.cloud.dataproc.v1.JobReference"
13605    }
13606}
13607
13608/// A YARN application created by a job. Application information is a subset of
13609/// \<code\>org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto\</code\>.
13610///
13611/// **Beta Feature**: This report is available for testing purposes only. It may
13612/// be changed before final release.
13613#[derive(Clone, Default, PartialEq)]
13614#[non_exhaustive]
13615pub struct YarnApplication {
13616    /// Required. The application name.
13617    pub name: std::string::String,
13618
13619    /// Required. The application state.
13620    pub state: crate::model::yarn_application::State,
13621
13622    /// Required. The numerical progress of the application, from 1 to 100.
13623    pub progress: f32,
13624
13625    /// Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or
13626    /// TimelineServer that provides application-specific information. The URL uses
13627    /// the internal hostname, and requires a proxy server for resolution and,
13628    /// possibly, access.
13629    pub tracking_url: std::string::String,
13630
13631    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13632}
13633
13634impl YarnApplication {
13635    pub fn new() -> Self {
13636        std::default::Default::default()
13637    }
13638
13639    /// Sets the value of [name][crate::model::YarnApplication::name].
13640    ///
13641    /// # Example
13642    /// ```ignore,no_run
13643    /// # use google_cloud_dataproc_v1::model::YarnApplication;
13644    /// let x = YarnApplication::new().set_name("example");
13645    /// ```
13646    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13647        self.name = v.into();
13648        self
13649    }
13650
13651    /// Sets the value of [state][crate::model::YarnApplication::state].
13652    ///
13653    /// # Example
13654    /// ```ignore,no_run
13655    /// # use google_cloud_dataproc_v1::model::YarnApplication;
13656    /// use google_cloud_dataproc_v1::model::yarn_application::State;
13657    /// let x0 = YarnApplication::new().set_state(State::New);
13658    /// let x1 = YarnApplication::new().set_state(State::NewSaving);
13659    /// let x2 = YarnApplication::new().set_state(State::Submitted);
13660    /// ```
13661    pub fn set_state<T: std::convert::Into<crate::model::yarn_application::State>>(
13662        mut self,
13663        v: T,
13664    ) -> Self {
13665        self.state = v.into();
13666        self
13667    }
13668
13669    /// Sets the value of [progress][crate::model::YarnApplication::progress].
13670    ///
13671    /// # Example
13672    /// ```ignore,no_run
13673    /// # use google_cloud_dataproc_v1::model::YarnApplication;
13674    /// let x = YarnApplication::new().set_progress(42.0);
13675    /// ```
13676    pub fn set_progress<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
13677        self.progress = v.into();
13678        self
13679    }
13680
13681    /// Sets the value of [tracking_url][crate::model::YarnApplication::tracking_url].
13682    ///
13683    /// # Example
13684    /// ```ignore,no_run
13685    /// # use google_cloud_dataproc_v1::model::YarnApplication;
13686    /// let x = YarnApplication::new().set_tracking_url("example");
13687    /// ```
13688    pub fn set_tracking_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13689        self.tracking_url = v.into();
13690        self
13691    }
13692}
13693
13694impl wkt::message::Message for YarnApplication {
13695    fn typename() -> &'static str {
13696        "type.googleapis.com/google.cloud.dataproc.v1.YarnApplication"
13697    }
13698}
13699
13700/// Defines additional types related to [YarnApplication].
13701pub mod yarn_application {
13702    #[allow(unused_imports)]
13703    use super::*;
13704
13705    /// The application state, corresponding to
13706    /// \<code\>YarnProtos.YarnApplicationStateProto\</code\>.
13707    ///
13708    /// # Working with unknown values
13709    ///
13710    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13711    /// additional enum variants at any time. Adding new variants is not considered
13712    /// a breaking change. Applications should write their code in anticipation of:
13713    ///
13714    /// - New values appearing in future releases of the client library, **and**
13715    /// - New values received dynamically, without application changes.
13716    ///
13717    /// Please consult the [Working with enums] section in the user guide for some
13718    /// guidelines.
13719    ///
13720    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13721    #[derive(Clone, Debug, PartialEq)]
13722    #[non_exhaustive]
13723    pub enum State {
13724        /// Status is unspecified.
13725        Unspecified,
13726        /// Status is NEW.
13727        New,
13728        /// Status is NEW_SAVING.
13729        NewSaving,
13730        /// Status is SUBMITTED.
13731        Submitted,
13732        /// Status is ACCEPTED.
13733        Accepted,
13734        /// Status is RUNNING.
13735        Running,
13736        /// Status is FINISHED.
13737        Finished,
13738        /// Status is FAILED.
13739        Failed,
13740        /// Status is KILLED.
13741        Killed,
13742        /// If set, the enum was initialized with an unknown value.
13743        ///
13744        /// Applications can examine the value using [State::value] or
13745        /// [State::name].
13746        UnknownValue(state::UnknownValue),
13747    }
13748
13749    #[doc(hidden)]
13750    pub mod state {
13751        #[allow(unused_imports)]
13752        use super::*;
13753        #[derive(Clone, Debug, PartialEq)]
13754        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13755    }
13756
13757    impl State {
13758        /// Gets the enum value.
13759        ///
13760        /// Returns `None` if the enum contains an unknown value deserialized from
13761        /// the string representation of enums.
13762        pub fn value(&self) -> std::option::Option<i32> {
13763            match self {
13764                Self::Unspecified => std::option::Option::Some(0),
13765                Self::New => std::option::Option::Some(1),
13766                Self::NewSaving => std::option::Option::Some(2),
13767                Self::Submitted => std::option::Option::Some(3),
13768                Self::Accepted => std::option::Option::Some(4),
13769                Self::Running => std::option::Option::Some(5),
13770                Self::Finished => std::option::Option::Some(6),
13771                Self::Failed => std::option::Option::Some(7),
13772                Self::Killed => std::option::Option::Some(8),
13773                Self::UnknownValue(u) => u.0.value(),
13774            }
13775        }
13776
13777        /// Gets the enum value as a string.
13778        ///
13779        /// Returns `None` if the enum contains an unknown value deserialized from
13780        /// the integer representation of enums.
13781        pub fn name(&self) -> std::option::Option<&str> {
13782            match self {
13783                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13784                Self::New => std::option::Option::Some("NEW"),
13785                Self::NewSaving => std::option::Option::Some("NEW_SAVING"),
13786                Self::Submitted => std::option::Option::Some("SUBMITTED"),
13787                Self::Accepted => std::option::Option::Some("ACCEPTED"),
13788                Self::Running => std::option::Option::Some("RUNNING"),
13789                Self::Finished => std::option::Option::Some("FINISHED"),
13790                Self::Failed => std::option::Option::Some("FAILED"),
13791                Self::Killed => std::option::Option::Some("KILLED"),
13792                Self::UnknownValue(u) => u.0.name(),
13793            }
13794        }
13795    }
13796
13797    impl std::default::Default for State {
13798        fn default() -> Self {
13799            use std::convert::From;
13800            Self::from(0)
13801        }
13802    }
13803
13804    impl std::fmt::Display for State {
13805        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13806            wkt::internal::display_enum(f, self.name(), self.value())
13807        }
13808    }
13809
13810    impl std::convert::From<i32> for State {
13811        fn from(value: i32) -> Self {
13812            match value {
13813                0 => Self::Unspecified,
13814                1 => Self::New,
13815                2 => Self::NewSaving,
13816                3 => Self::Submitted,
13817                4 => Self::Accepted,
13818                5 => Self::Running,
13819                6 => Self::Finished,
13820                7 => Self::Failed,
13821                8 => Self::Killed,
13822                _ => Self::UnknownValue(state::UnknownValue(
13823                    wkt::internal::UnknownEnumValue::Integer(value),
13824                )),
13825            }
13826        }
13827    }
13828
13829    impl std::convert::From<&str> for State {
13830        fn from(value: &str) -> Self {
13831            use std::string::ToString;
13832            match value {
13833                "STATE_UNSPECIFIED" => Self::Unspecified,
13834                "NEW" => Self::New,
13835                "NEW_SAVING" => Self::NewSaving,
13836                "SUBMITTED" => Self::Submitted,
13837                "ACCEPTED" => Self::Accepted,
13838                "RUNNING" => Self::Running,
13839                "FINISHED" => Self::Finished,
13840                "FAILED" => Self::Failed,
13841                "KILLED" => Self::Killed,
13842                _ => Self::UnknownValue(state::UnknownValue(
13843                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13844                )),
13845            }
13846        }
13847    }
13848
13849    impl serde::ser::Serialize for State {
13850        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13851        where
13852            S: serde::Serializer,
13853        {
13854            match self {
13855                Self::Unspecified => serializer.serialize_i32(0),
13856                Self::New => serializer.serialize_i32(1),
13857                Self::NewSaving => serializer.serialize_i32(2),
13858                Self::Submitted => serializer.serialize_i32(3),
13859                Self::Accepted => serializer.serialize_i32(4),
13860                Self::Running => serializer.serialize_i32(5),
13861                Self::Finished => serializer.serialize_i32(6),
13862                Self::Failed => serializer.serialize_i32(7),
13863                Self::Killed => serializer.serialize_i32(8),
13864                Self::UnknownValue(u) => u.0.serialize(serializer),
13865            }
13866        }
13867    }
13868
13869    impl<'de> serde::de::Deserialize<'de> for State {
13870        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13871        where
13872            D: serde::Deserializer<'de>,
13873        {
13874            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13875                ".google.cloud.dataproc.v1.YarnApplication.State",
13876            ))
13877        }
13878    }
13879}
13880
13881/// A Dataproc job resource.
13882#[derive(Clone, Default, PartialEq)]
13883#[non_exhaustive]
13884pub struct Job {
13885    /// Optional. The fully qualified reference to the job, which can be used to
13886    /// obtain the equivalent REST path of the job resource. If this property
13887    /// is not specified when a job is created, the server generates a
13888    /// \<code\>job_id\</code\>.
13889    pub reference: std::option::Option<crate::model::JobReference>,
13890
13891    /// Required. Job information, including how, when, and where to
13892    /// run the job.
13893    pub placement: std::option::Option<crate::model::JobPlacement>,
13894
13895    /// Output only. The job status. Additional application-specific
13896    /// status information might be contained in the \<code\>type_job\</code\>
13897    /// and \<code\>yarn_applications\</code\> fields.
13898    pub status: std::option::Option<crate::model::JobStatus>,
13899
13900    /// Output only. The previous job status.
13901    pub status_history: std::vec::Vec<crate::model::JobStatus>,
13902
13903    /// Output only. The collection of YARN applications spun up by this job.
13904    ///
13905    /// **Beta** Feature: This report is available for testing purposes only. It
13906    /// might be changed before final release.
13907    pub yarn_applications: std::vec::Vec<crate::model::YarnApplication>,
13908
13909    /// Output only. A URI pointing to the location of the stdout of the job's
13910    /// driver program.
13911    pub driver_output_resource_uri: std::string::String,
13912
13913    /// Output only. If present, the location of miscellaneous control files
13914    /// which can be used as part of job setup and handling. If not present,
13915    /// control files might be placed in the same location as `driver_output_uri`.
13916    pub driver_control_files_uri: std::string::String,
13917
13918    /// Optional. The labels to associate with this job.
13919    /// Label **keys** must contain 1 to 63 characters, and must conform to
13920    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
13921    /// Label **values** can be empty, but, if present, must contain 1 to 63
13922    /// characters, and must conform to [RFC
13923    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
13924    /// associated with a job.
13925    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
13926
13927    /// Optional. Job scheduling configuration.
13928    pub scheduling: std::option::Option<crate::model::JobScheduling>,
13929
13930    /// Output only. A UUID that uniquely identifies a job within the project
13931    /// over time. This is in contrast to a user-settable reference.job_id that
13932    /// might be reused over time.
13933    pub job_uuid: std::string::String,
13934
13935    /// Output only. Indicates whether the job is completed. If the value is
13936    /// `false`, the job is still in progress. If `true`, the job is completed, and
13937    /// `status.state` field will indicate if it was successful, failed,
13938    /// or cancelled.
13939    pub done: bool,
13940
13941    /// Optional. Driver scheduling configuration.
13942    pub driver_scheduling_config: std::option::Option<crate::model::DriverSchedulingConfig>,
13943
13944    /// Required. The application/framework-specific portion of the job.
13945    pub type_job: std::option::Option<crate::model::job::TypeJob>,
13946
13947    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13948}
13949
13950impl Job {
13951    pub fn new() -> Self {
13952        std::default::Default::default()
13953    }
13954
13955    /// Sets the value of [reference][crate::model::Job::reference].
13956    ///
13957    /// # Example
13958    /// ```ignore,no_run
13959    /// # use google_cloud_dataproc_v1::model::Job;
13960    /// use google_cloud_dataproc_v1::model::JobReference;
13961    /// let x = Job::new().set_reference(JobReference::default()/* use setters */);
13962    /// ```
13963    pub fn set_reference<T>(mut self, v: T) -> Self
13964    where
13965        T: std::convert::Into<crate::model::JobReference>,
13966    {
13967        self.reference = std::option::Option::Some(v.into());
13968        self
13969    }
13970
13971    /// Sets or clears the value of [reference][crate::model::Job::reference].
13972    ///
13973    /// # Example
13974    /// ```ignore,no_run
13975    /// # use google_cloud_dataproc_v1::model::Job;
13976    /// use google_cloud_dataproc_v1::model::JobReference;
13977    /// let x = Job::new().set_or_clear_reference(Some(JobReference::default()/* use setters */));
13978    /// let x = Job::new().set_or_clear_reference(None::<JobReference>);
13979    /// ```
13980    pub fn set_or_clear_reference<T>(mut self, v: std::option::Option<T>) -> Self
13981    where
13982        T: std::convert::Into<crate::model::JobReference>,
13983    {
13984        self.reference = v.map(|x| x.into());
13985        self
13986    }
13987
13988    /// Sets the value of [placement][crate::model::Job::placement].
13989    ///
13990    /// # Example
13991    /// ```ignore,no_run
13992    /// # use google_cloud_dataproc_v1::model::Job;
13993    /// use google_cloud_dataproc_v1::model::JobPlacement;
13994    /// let x = Job::new().set_placement(JobPlacement::default()/* use setters */);
13995    /// ```
13996    pub fn set_placement<T>(mut self, v: T) -> Self
13997    where
13998        T: std::convert::Into<crate::model::JobPlacement>,
13999    {
14000        self.placement = std::option::Option::Some(v.into());
14001        self
14002    }
14003
14004    /// Sets or clears the value of [placement][crate::model::Job::placement].
14005    ///
14006    /// # Example
14007    /// ```ignore,no_run
14008    /// # use google_cloud_dataproc_v1::model::Job;
14009    /// use google_cloud_dataproc_v1::model::JobPlacement;
14010    /// let x = Job::new().set_or_clear_placement(Some(JobPlacement::default()/* use setters */));
14011    /// let x = Job::new().set_or_clear_placement(None::<JobPlacement>);
14012    /// ```
14013    pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
14014    where
14015        T: std::convert::Into<crate::model::JobPlacement>,
14016    {
14017        self.placement = v.map(|x| x.into());
14018        self
14019    }
14020
14021    /// Sets the value of [status][crate::model::Job::status].
14022    ///
14023    /// # Example
14024    /// ```ignore,no_run
14025    /// # use google_cloud_dataproc_v1::model::Job;
14026    /// use google_cloud_dataproc_v1::model::JobStatus;
14027    /// let x = Job::new().set_status(JobStatus::default()/* use setters */);
14028    /// ```
14029    pub fn set_status<T>(mut self, v: T) -> Self
14030    where
14031        T: std::convert::Into<crate::model::JobStatus>,
14032    {
14033        self.status = std::option::Option::Some(v.into());
14034        self
14035    }
14036
14037    /// Sets or clears the value of [status][crate::model::Job::status].
14038    ///
14039    /// # Example
14040    /// ```ignore,no_run
14041    /// # use google_cloud_dataproc_v1::model::Job;
14042    /// use google_cloud_dataproc_v1::model::JobStatus;
14043    /// let x = Job::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
14044    /// let x = Job::new().set_or_clear_status(None::<JobStatus>);
14045    /// ```
14046    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
14047    where
14048        T: std::convert::Into<crate::model::JobStatus>,
14049    {
14050        self.status = v.map(|x| x.into());
14051        self
14052    }
14053
14054    /// Sets the value of [status_history][crate::model::Job::status_history].
14055    ///
14056    /// # Example
14057    /// ```ignore,no_run
14058    /// # use google_cloud_dataproc_v1::model::Job;
14059    /// use google_cloud_dataproc_v1::model::JobStatus;
14060    /// let x = Job::new()
14061    ///     .set_status_history([
14062    ///         JobStatus::default()/* use setters */,
14063    ///         JobStatus::default()/* use (different) setters */,
14064    ///     ]);
14065    /// ```
14066    pub fn set_status_history<T, V>(mut self, v: T) -> Self
14067    where
14068        T: std::iter::IntoIterator<Item = V>,
14069        V: std::convert::Into<crate::model::JobStatus>,
14070    {
14071        use std::iter::Iterator;
14072        self.status_history = v.into_iter().map(|i| i.into()).collect();
14073        self
14074    }
14075
14076    /// Sets the value of [yarn_applications][crate::model::Job::yarn_applications].
14077    ///
14078    /// # Example
14079    /// ```ignore,no_run
14080    /// # use google_cloud_dataproc_v1::model::Job;
14081    /// use google_cloud_dataproc_v1::model::YarnApplication;
14082    /// let x = Job::new()
14083    ///     .set_yarn_applications([
14084    ///         YarnApplication::default()/* use setters */,
14085    ///         YarnApplication::default()/* use (different) setters */,
14086    ///     ]);
14087    /// ```
14088    pub fn set_yarn_applications<T, V>(mut self, v: T) -> Self
14089    where
14090        T: std::iter::IntoIterator<Item = V>,
14091        V: std::convert::Into<crate::model::YarnApplication>,
14092    {
14093        use std::iter::Iterator;
14094        self.yarn_applications = v.into_iter().map(|i| i.into()).collect();
14095        self
14096    }
14097
14098    /// Sets the value of [driver_output_resource_uri][crate::model::Job::driver_output_resource_uri].
14099    ///
14100    /// # Example
14101    /// ```ignore,no_run
14102    /// # use google_cloud_dataproc_v1::model::Job;
14103    /// let x = Job::new().set_driver_output_resource_uri("example");
14104    /// ```
14105    pub fn set_driver_output_resource_uri<T: std::convert::Into<std::string::String>>(
14106        mut self,
14107        v: T,
14108    ) -> Self {
14109        self.driver_output_resource_uri = v.into();
14110        self
14111    }
14112
14113    /// Sets the value of [driver_control_files_uri][crate::model::Job::driver_control_files_uri].
14114    ///
14115    /// # Example
14116    /// ```ignore,no_run
14117    /// # use google_cloud_dataproc_v1::model::Job;
14118    /// let x = Job::new().set_driver_control_files_uri("example");
14119    /// ```
14120    pub fn set_driver_control_files_uri<T: std::convert::Into<std::string::String>>(
14121        mut self,
14122        v: T,
14123    ) -> Self {
14124        self.driver_control_files_uri = v.into();
14125        self
14126    }
14127
14128    /// Sets the value of [labels][crate::model::Job::labels].
14129    ///
14130    /// # Example
14131    /// ```ignore,no_run
14132    /// # use google_cloud_dataproc_v1::model::Job;
14133    /// let x = Job::new().set_labels([
14134    ///     ("key0", "abc"),
14135    ///     ("key1", "xyz"),
14136    /// ]);
14137    /// ```
14138    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14139    where
14140        T: std::iter::IntoIterator<Item = (K, V)>,
14141        K: std::convert::Into<std::string::String>,
14142        V: std::convert::Into<std::string::String>,
14143    {
14144        use std::iter::Iterator;
14145        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14146        self
14147    }
14148
14149    /// Sets the value of [scheduling][crate::model::Job::scheduling].
14150    ///
14151    /// # Example
14152    /// ```ignore,no_run
14153    /// # use google_cloud_dataproc_v1::model::Job;
14154    /// use google_cloud_dataproc_v1::model::JobScheduling;
14155    /// let x = Job::new().set_scheduling(JobScheduling::default()/* use setters */);
14156    /// ```
14157    pub fn set_scheduling<T>(mut self, v: T) -> Self
14158    where
14159        T: std::convert::Into<crate::model::JobScheduling>,
14160    {
14161        self.scheduling = std::option::Option::Some(v.into());
14162        self
14163    }
14164
14165    /// Sets or clears the value of [scheduling][crate::model::Job::scheduling].
14166    ///
14167    /// # Example
14168    /// ```ignore,no_run
14169    /// # use google_cloud_dataproc_v1::model::Job;
14170    /// use google_cloud_dataproc_v1::model::JobScheduling;
14171    /// let x = Job::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
14172    /// let x = Job::new().set_or_clear_scheduling(None::<JobScheduling>);
14173    /// ```
14174    pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
14175    where
14176        T: std::convert::Into<crate::model::JobScheduling>,
14177    {
14178        self.scheduling = v.map(|x| x.into());
14179        self
14180    }
14181
14182    /// Sets the value of [job_uuid][crate::model::Job::job_uuid].
14183    ///
14184    /// # Example
14185    /// ```ignore,no_run
14186    /// # use google_cloud_dataproc_v1::model::Job;
14187    /// let x = Job::new().set_job_uuid("example");
14188    /// ```
14189    pub fn set_job_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14190        self.job_uuid = v.into();
14191        self
14192    }
14193
14194    /// Sets the value of [done][crate::model::Job::done].
14195    ///
14196    /// # Example
14197    /// ```ignore,no_run
14198    /// # use google_cloud_dataproc_v1::model::Job;
14199    /// let x = Job::new().set_done(true);
14200    /// ```
14201    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14202        self.done = v.into();
14203        self
14204    }
14205
14206    /// Sets the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
14207    ///
14208    /// # Example
14209    /// ```ignore,no_run
14210    /// # use google_cloud_dataproc_v1::model::Job;
14211    /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14212    /// let x = Job::new().set_driver_scheduling_config(DriverSchedulingConfig::default()/* use setters */);
14213    /// ```
14214    pub fn set_driver_scheduling_config<T>(mut self, v: T) -> Self
14215    where
14216        T: std::convert::Into<crate::model::DriverSchedulingConfig>,
14217    {
14218        self.driver_scheduling_config = std::option::Option::Some(v.into());
14219        self
14220    }
14221
14222    /// Sets or clears the value of [driver_scheduling_config][crate::model::Job::driver_scheduling_config].
14223    ///
14224    /// # Example
14225    /// ```ignore,no_run
14226    /// # use google_cloud_dataproc_v1::model::Job;
14227    /// use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14228    /// let x = Job::new().set_or_clear_driver_scheduling_config(Some(DriverSchedulingConfig::default()/* use setters */));
14229    /// let x = Job::new().set_or_clear_driver_scheduling_config(None::<DriverSchedulingConfig>);
14230    /// ```
14231    pub fn set_or_clear_driver_scheduling_config<T>(mut self, v: std::option::Option<T>) -> Self
14232    where
14233        T: std::convert::Into<crate::model::DriverSchedulingConfig>,
14234    {
14235        self.driver_scheduling_config = v.map(|x| x.into());
14236        self
14237    }
14238
14239    /// Sets the value of [type_job][crate::model::Job::type_job].
14240    ///
14241    /// Note that all the setters affecting `type_job` are mutually
14242    /// exclusive.
14243    ///
14244    /// # Example
14245    /// ```ignore,no_run
14246    /// # use google_cloud_dataproc_v1::model::Job;
14247    /// use google_cloud_dataproc_v1::model::HadoopJob;
14248    /// let x = Job::new().set_type_job(Some(
14249    ///     google_cloud_dataproc_v1::model::job::TypeJob::HadoopJob(HadoopJob::default().into())));
14250    /// ```
14251    pub fn set_type_job<T: std::convert::Into<std::option::Option<crate::model::job::TypeJob>>>(
14252        mut self,
14253        v: T,
14254    ) -> Self {
14255        self.type_job = v.into();
14256        self
14257    }
14258
14259    /// The value of [type_job][crate::model::Job::type_job]
14260    /// if it holds a `HadoopJob`, `None` if the field is not set or
14261    /// holds a different branch.
14262    pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
14263        #[allow(unreachable_patterns)]
14264        self.type_job.as_ref().and_then(|v| match v {
14265            crate::model::job::TypeJob::HadoopJob(v) => std::option::Option::Some(v),
14266            _ => std::option::Option::None,
14267        })
14268    }
14269
14270    /// Sets the value of [type_job][crate::model::Job::type_job]
14271    /// to hold a `HadoopJob`.
14272    ///
14273    /// Note that all the setters affecting `type_job` are
14274    /// mutually exclusive.
14275    ///
14276    /// # Example
14277    /// ```ignore,no_run
14278    /// # use google_cloud_dataproc_v1::model::Job;
14279    /// use google_cloud_dataproc_v1::model::HadoopJob;
14280    /// let x = Job::new().set_hadoop_job(HadoopJob::default()/* use setters */);
14281    /// assert!(x.hadoop_job().is_some());
14282    /// assert!(x.spark_job().is_none());
14283    /// assert!(x.pyspark_job().is_none());
14284    /// assert!(x.hive_job().is_none());
14285    /// assert!(x.pig_job().is_none());
14286    /// assert!(x.spark_r_job().is_none());
14287    /// assert!(x.spark_sql_job().is_none());
14288    /// assert!(x.presto_job().is_none());
14289    /// assert!(x.trino_job().is_none());
14290    /// assert!(x.flink_job().is_none());
14291    /// ```
14292    pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
14293        mut self,
14294        v: T,
14295    ) -> Self {
14296        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HadoopJob(v.into()));
14297        self
14298    }
14299
14300    /// The value of [type_job][crate::model::Job::type_job]
14301    /// if it holds a `SparkJob`, `None` if the field is not set or
14302    /// holds a different branch.
14303    pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
14304        #[allow(unreachable_patterns)]
14305        self.type_job.as_ref().and_then(|v| match v {
14306            crate::model::job::TypeJob::SparkJob(v) => std::option::Option::Some(v),
14307            _ => std::option::Option::None,
14308        })
14309    }
14310
14311    /// Sets the value of [type_job][crate::model::Job::type_job]
14312    /// to hold a `SparkJob`.
14313    ///
14314    /// Note that all the setters affecting `type_job` are
14315    /// mutually exclusive.
14316    ///
14317    /// # Example
14318    /// ```ignore,no_run
14319    /// # use google_cloud_dataproc_v1::model::Job;
14320    /// use google_cloud_dataproc_v1::model::SparkJob;
14321    /// let x = Job::new().set_spark_job(SparkJob::default()/* use setters */);
14322    /// assert!(x.spark_job().is_some());
14323    /// assert!(x.hadoop_job().is_none());
14324    /// assert!(x.pyspark_job().is_none());
14325    /// assert!(x.hive_job().is_none());
14326    /// assert!(x.pig_job().is_none());
14327    /// assert!(x.spark_r_job().is_none());
14328    /// assert!(x.spark_sql_job().is_none());
14329    /// assert!(x.presto_job().is_none());
14330    /// assert!(x.trino_job().is_none());
14331    /// assert!(x.flink_job().is_none());
14332    /// ```
14333    pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
14334        mut self,
14335        v: T,
14336    ) -> Self {
14337        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkJob(v.into()));
14338        self
14339    }
14340
14341    /// The value of [type_job][crate::model::Job::type_job]
14342    /// if it holds a `PysparkJob`, `None` if the field is not set or
14343    /// holds a different branch.
14344    pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
14345        #[allow(unreachable_patterns)]
14346        self.type_job.as_ref().and_then(|v| match v {
14347            crate::model::job::TypeJob::PysparkJob(v) => std::option::Option::Some(v),
14348            _ => std::option::Option::None,
14349        })
14350    }
14351
14352    /// Sets the value of [type_job][crate::model::Job::type_job]
14353    /// to hold a `PysparkJob`.
14354    ///
14355    /// Note that all the setters affecting `type_job` are
14356    /// mutually exclusive.
14357    ///
14358    /// # Example
14359    /// ```ignore,no_run
14360    /// # use google_cloud_dataproc_v1::model::Job;
14361    /// use google_cloud_dataproc_v1::model::PySparkJob;
14362    /// let x = Job::new().set_pyspark_job(PySparkJob::default()/* use setters */);
14363    /// assert!(x.pyspark_job().is_some());
14364    /// assert!(x.hadoop_job().is_none());
14365    /// assert!(x.spark_job().is_none());
14366    /// assert!(x.hive_job().is_none());
14367    /// assert!(x.pig_job().is_none());
14368    /// assert!(x.spark_r_job().is_none());
14369    /// assert!(x.spark_sql_job().is_none());
14370    /// assert!(x.presto_job().is_none());
14371    /// assert!(x.trino_job().is_none());
14372    /// assert!(x.flink_job().is_none());
14373    /// ```
14374    pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
14375        mut self,
14376        v: T,
14377    ) -> Self {
14378        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PysparkJob(v.into()));
14379        self
14380    }
14381
14382    /// The value of [type_job][crate::model::Job::type_job]
14383    /// if it holds a `HiveJob`, `None` if the field is not set or
14384    /// holds a different branch.
14385    pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
14386        #[allow(unreachable_patterns)]
14387        self.type_job.as_ref().and_then(|v| match v {
14388            crate::model::job::TypeJob::HiveJob(v) => std::option::Option::Some(v),
14389            _ => std::option::Option::None,
14390        })
14391    }
14392
14393    /// Sets the value of [type_job][crate::model::Job::type_job]
14394    /// to hold a `HiveJob`.
14395    ///
14396    /// Note that all the setters affecting `type_job` are
14397    /// mutually exclusive.
14398    ///
14399    /// # Example
14400    /// ```ignore,no_run
14401    /// # use google_cloud_dataproc_v1::model::Job;
14402    /// use google_cloud_dataproc_v1::model::HiveJob;
14403    /// let x = Job::new().set_hive_job(HiveJob::default()/* use setters */);
14404    /// assert!(x.hive_job().is_some());
14405    /// assert!(x.hadoop_job().is_none());
14406    /// assert!(x.spark_job().is_none());
14407    /// assert!(x.pyspark_job().is_none());
14408    /// assert!(x.pig_job().is_none());
14409    /// assert!(x.spark_r_job().is_none());
14410    /// assert!(x.spark_sql_job().is_none());
14411    /// assert!(x.presto_job().is_none());
14412    /// assert!(x.trino_job().is_none());
14413    /// assert!(x.flink_job().is_none());
14414    /// ```
14415    pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
14416        mut self,
14417        v: T,
14418    ) -> Self {
14419        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::HiveJob(v.into()));
14420        self
14421    }
14422
14423    /// The value of [type_job][crate::model::Job::type_job]
14424    /// if it holds a `PigJob`, `None` if the field is not set or
14425    /// holds a different branch.
14426    pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
14427        #[allow(unreachable_patterns)]
14428        self.type_job.as_ref().and_then(|v| match v {
14429            crate::model::job::TypeJob::PigJob(v) => std::option::Option::Some(v),
14430            _ => std::option::Option::None,
14431        })
14432    }
14433
14434    /// Sets the value of [type_job][crate::model::Job::type_job]
14435    /// to hold a `PigJob`.
14436    ///
14437    /// Note that all the setters affecting `type_job` are
14438    /// mutually exclusive.
14439    ///
14440    /// # Example
14441    /// ```ignore,no_run
14442    /// # use google_cloud_dataproc_v1::model::Job;
14443    /// use google_cloud_dataproc_v1::model::PigJob;
14444    /// let x = Job::new().set_pig_job(PigJob::default()/* use setters */);
14445    /// assert!(x.pig_job().is_some());
14446    /// assert!(x.hadoop_job().is_none());
14447    /// assert!(x.spark_job().is_none());
14448    /// assert!(x.pyspark_job().is_none());
14449    /// assert!(x.hive_job().is_none());
14450    /// assert!(x.spark_r_job().is_none());
14451    /// assert!(x.spark_sql_job().is_none());
14452    /// assert!(x.presto_job().is_none());
14453    /// assert!(x.trino_job().is_none());
14454    /// assert!(x.flink_job().is_none());
14455    /// ```
14456    pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
14457        mut self,
14458        v: T,
14459    ) -> Self {
14460        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PigJob(v.into()));
14461        self
14462    }
14463
14464    /// The value of [type_job][crate::model::Job::type_job]
14465    /// if it holds a `SparkRJob`, `None` if the field is not set or
14466    /// holds a different branch.
14467    pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
14468        #[allow(unreachable_patterns)]
14469        self.type_job.as_ref().and_then(|v| match v {
14470            crate::model::job::TypeJob::SparkRJob(v) => std::option::Option::Some(v),
14471            _ => std::option::Option::None,
14472        })
14473    }
14474
14475    /// Sets the value of [type_job][crate::model::Job::type_job]
14476    /// to hold a `SparkRJob`.
14477    ///
14478    /// Note that all the setters affecting `type_job` are
14479    /// mutually exclusive.
14480    ///
14481    /// # Example
14482    /// ```ignore,no_run
14483    /// # use google_cloud_dataproc_v1::model::Job;
14484    /// use google_cloud_dataproc_v1::model::SparkRJob;
14485    /// let x = Job::new().set_spark_r_job(SparkRJob::default()/* use setters */);
14486    /// assert!(x.spark_r_job().is_some());
14487    /// assert!(x.hadoop_job().is_none());
14488    /// assert!(x.spark_job().is_none());
14489    /// assert!(x.pyspark_job().is_none());
14490    /// assert!(x.hive_job().is_none());
14491    /// assert!(x.pig_job().is_none());
14492    /// assert!(x.spark_sql_job().is_none());
14493    /// assert!(x.presto_job().is_none());
14494    /// assert!(x.trino_job().is_none());
14495    /// assert!(x.flink_job().is_none());
14496    /// ```
14497    pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
14498        mut self,
14499        v: T,
14500    ) -> Self {
14501        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::SparkRJob(v.into()));
14502        self
14503    }
14504
14505    /// The value of [type_job][crate::model::Job::type_job]
14506    /// if it holds a `SparkSqlJob`, `None` if the field is not set or
14507    /// holds a different branch.
14508    pub fn spark_sql_job(
14509        &self,
14510    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
14511        #[allow(unreachable_patterns)]
14512        self.type_job.as_ref().and_then(|v| match v {
14513            crate::model::job::TypeJob::SparkSqlJob(v) => std::option::Option::Some(v),
14514            _ => std::option::Option::None,
14515        })
14516    }
14517
14518    /// Sets the value of [type_job][crate::model::Job::type_job]
14519    /// to hold a `SparkSqlJob`.
14520    ///
14521    /// Note that all the setters affecting `type_job` are
14522    /// mutually exclusive.
14523    ///
14524    /// # Example
14525    /// ```ignore,no_run
14526    /// # use google_cloud_dataproc_v1::model::Job;
14527    /// use google_cloud_dataproc_v1::model::SparkSqlJob;
14528    /// let x = Job::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
14529    /// assert!(x.spark_sql_job().is_some());
14530    /// assert!(x.hadoop_job().is_none());
14531    /// assert!(x.spark_job().is_none());
14532    /// assert!(x.pyspark_job().is_none());
14533    /// assert!(x.hive_job().is_none());
14534    /// assert!(x.pig_job().is_none());
14535    /// assert!(x.spark_r_job().is_none());
14536    /// assert!(x.presto_job().is_none());
14537    /// assert!(x.trino_job().is_none());
14538    /// assert!(x.flink_job().is_none());
14539    /// ```
14540    pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
14541        mut self,
14542        v: T,
14543    ) -> Self {
14544        self.type_job =
14545            std::option::Option::Some(crate::model::job::TypeJob::SparkSqlJob(v.into()));
14546        self
14547    }
14548
14549    /// The value of [type_job][crate::model::Job::type_job]
14550    /// if it holds a `PrestoJob`, `None` if the field is not set or
14551    /// holds a different branch.
14552    pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
14553        #[allow(unreachable_patterns)]
14554        self.type_job.as_ref().and_then(|v| match v {
14555            crate::model::job::TypeJob::PrestoJob(v) => std::option::Option::Some(v),
14556            _ => std::option::Option::None,
14557        })
14558    }
14559
14560    /// Sets the value of [type_job][crate::model::Job::type_job]
14561    /// to hold a `PrestoJob`.
14562    ///
14563    /// Note that all the setters affecting `type_job` are
14564    /// mutually exclusive.
14565    ///
14566    /// # Example
14567    /// ```ignore,no_run
14568    /// # use google_cloud_dataproc_v1::model::Job;
14569    /// use google_cloud_dataproc_v1::model::PrestoJob;
14570    /// let x = Job::new().set_presto_job(PrestoJob::default()/* use setters */);
14571    /// assert!(x.presto_job().is_some());
14572    /// assert!(x.hadoop_job().is_none());
14573    /// assert!(x.spark_job().is_none());
14574    /// assert!(x.pyspark_job().is_none());
14575    /// assert!(x.hive_job().is_none());
14576    /// assert!(x.pig_job().is_none());
14577    /// assert!(x.spark_r_job().is_none());
14578    /// assert!(x.spark_sql_job().is_none());
14579    /// assert!(x.trino_job().is_none());
14580    /// assert!(x.flink_job().is_none());
14581    /// ```
14582    pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
14583        mut self,
14584        v: T,
14585    ) -> Self {
14586        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::PrestoJob(v.into()));
14587        self
14588    }
14589
14590    /// The value of [type_job][crate::model::Job::type_job]
14591    /// if it holds a `TrinoJob`, `None` if the field is not set or
14592    /// holds a different branch.
14593    pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
14594        #[allow(unreachable_patterns)]
14595        self.type_job.as_ref().and_then(|v| match v {
14596            crate::model::job::TypeJob::TrinoJob(v) => std::option::Option::Some(v),
14597            _ => std::option::Option::None,
14598        })
14599    }
14600
14601    /// Sets the value of [type_job][crate::model::Job::type_job]
14602    /// to hold a `TrinoJob`.
14603    ///
14604    /// Note that all the setters affecting `type_job` are
14605    /// mutually exclusive.
14606    ///
14607    /// # Example
14608    /// ```ignore,no_run
14609    /// # use google_cloud_dataproc_v1::model::Job;
14610    /// use google_cloud_dataproc_v1::model::TrinoJob;
14611    /// let x = Job::new().set_trino_job(TrinoJob::default()/* use setters */);
14612    /// assert!(x.trino_job().is_some());
14613    /// assert!(x.hadoop_job().is_none());
14614    /// assert!(x.spark_job().is_none());
14615    /// assert!(x.pyspark_job().is_none());
14616    /// assert!(x.hive_job().is_none());
14617    /// assert!(x.pig_job().is_none());
14618    /// assert!(x.spark_r_job().is_none());
14619    /// assert!(x.spark_sql_job().is_none());
14620    /// assert!(x.presto_job().is_none());
14621    /// assert!(x.flink_job().is_none());
14622    /// ```
14623    pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
14624        mut self,
14625        v: T,
14626    ) -> Self {
14627        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::TrinoJob(v.into()));
14628        self
14629    }
14630
14631    /// The value of [type_job][crate::model::Job::type_job]
14632    /// if it holds a `FlinkJob`, `None` if the field is not set or
14633    /// holds a different branch.
14634    pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
14635        #[allow(unreachable_patterns)]
14636        self.type_job.as_ref().and_then(|v| match v {
14637            crate::model::job::TypeJob::FlinkJob(v) => std::option::Option::Some(v),
14638            _ => std::option::Option::None,
14639        })
14640    }
14641
14642    /// Sets the value of [type_job][crate::model::Job::type_job]
14643    /// to hold a `FlinkJob`.
14644    ///
14645    /// Note that all the setters affecting `type_job` are
14646    /// mutually exclusive.
14647    ///
14648    /// # Example
14649    /// ```ignore,no_run
14650    /// # use google_cloud_dataproc_v1::model::Job;
14651    /// use google_cloud_dataproc_v1::model::FlinkJob;
14652    /// let x = Job::new().set_flink_job(FlinkJob::default()/* use setters */);
14653    /// assert!(x.flink_job().is_some());
14654    /// assert!(x.hadoop_job().is_none());
14655    /// assert!(x.spark_job().is_none());
14656    /// assert!(x.pyspark_job().is_none());
14657    /// assert!(x.hive_job().is_none());
14658    /// assert!(x.pig_job().is_none());
14659    /// assert!(x.spark_r_job().is_none());
14660    /// assert!(x.spark_sql_job().is_none());
14661    /// assert!(x.presto_job().is_none());
14662    /// assert!(x.trino_job().is_none());
14663    /// ```
14664    pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
14665        mut self,
14666        v: T,
14667    ) -> Self {
14668        self.type_job = std::option::Option::Some(crate::model::job::TypeJob::FlinkJob(v.into()));
14669        self
14670    }
14671}
14672
14673impl wkt::message::Message for Job {
14674    fn typename() -> &'static str {
14675        "type.googleapis.com/google.cloud.dataproc.v1.Job"
14676    }
14677}
14678
14679/// Defines additional types related to [Job].
14680pub mod job {
14681    #[allow(unused_imports)]
14682    use super::*;
14683
14684    /// Required. The application/framework-specific portion of the job.
14685    #[derive(Clone, Debug, PartialEq)]
14686    #[non_exhaustive]
14687    pub enum TypeJob {
14688        /// Optional. Job is a Hadoop job.
14689        HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
14690        /// Optional. Job is a Spark job.
14691        SparkJob(std::boxed::Box<crate::model::SparkJob>),
14692        /// Optional. Job is a PySpark job.
14693        PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
14694        /// Optional. Job is a Hive job.
14695        HiveJob(std::boxed::Box<crate::model::HiveJob>),
14696        /// Optional. Job is a Pig job.
14697        PigJob(std::boxed::Box<crate::model::PigJob>),
14698        /// Optional. Job is a SparkR job.
14699        SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
14700        /// Optional. Job is a SparkSql job.
14701        SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
14702        /// Optional. Job is a Presto job.
14703        PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
14704        /// Optional. Job is a Trino job.
14705        TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
14706        /// Optional. Job is a Flink job.
14707        FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
14708    }
14709}
14710
14711/// Driver scheduling configuration.
14712#[derive(Clone, Default, PartialEq)]
14713#[non_exhaustive]
14714pub struct DriverSchedulingConfig {
14715    /// Required. The amount of memory in MB the driver is requesting.
14716    pub memory_mb: i32,
14717
14718    /// Required. The number of vCPUs the driver is requesting.
14719    pub vcores: i32,
14720
14721    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14722}
14723
14724impl DriverSchedulingConfig {
14725    pub fn new() -> Self {
14726        std::default::Default::default()
14727    }
14728
14729    /// Sets the value of [memory_mb][crate::model::DriverSchedulingConfig::memory_mb].
14730    ///
14731    /// # Example
14732    /// ```ignore,no_run
14733    /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14734    /// let x = DriverSchedulingConfig::new().set_memory_mb(42);
14735    /// ```
14736    pub fn set_memory_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14737        self.memory_mb = v.into();
14738        self
14739    }
14740
14741    /// Sets the value of [vcores][crate::model::DriverSchedulingConfig::vcores].
14742    ///
14743    /// # Example
14744    /// ```ignore,no_run
14745    /// # use google_cloud_dataproc_v1::model::DriverSchedulingConfig;
14746    /// let x = DriverSchedulingConfig::new().set_vcores(42);
14747    /// ```
14748    pub fn set_vcores<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14749        self.vcores = v.into();
14750        self
14751    }
14752}
14753
14754impl wkt::message::Message for DriverSchedulingConfig {
14755    fn typename() -> &'static str {
14756        "type.googleapis.com/google.cloud.dataproc.v1.DriverSchedulingConfig"
14757    }
14758}
14759
14760/// Job scheduling options.
14761#[derive(Clone, Default, PartialEq)]
14762#[non_exhaustive]
14763pub struct JobScheduling {
14764    /// Optional. Maximum number of times per hour a driver can be restarted as
14765    /// a result of driver exiting with non-zero code before job is
14766    /// reported failed.
14767    ///
14768    /// A job might be reported as thrashing if the driver exits with a non-zero
14769    /// code four times within a 10-minute window.
14770    ///
14771    /// Maximum value is 10.
14772    ///
14773    /// **Note:** This restartable job option is not supported in Dataproc
14774    /// [workflow templates]
14775    /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template>).
14776    pub max_failures_per_hour: i32,
14777
14778    /// Optional. Maximum total number of times a driver can be restarted as a
14779    /// result of the driver exiting with a non-zero code. After the maximum number
14780    /// is reached, the job will be reported as failed.
14781    ///
14782    /// Maximum value is 240.
14783    ///
14784    /// **Note:** Currently, this restartable job option is
14785    /// not supported in Dataproc
14786    /// [workflow
14787    /// templates](https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
14788    pub max_failures_total: i32,
14789
14790    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14791}
14792
14793impl JobScheduling {
14794    pub fn new() -> Self {
14795        std::default::Default::default()
14796    }
14797
14798    /// Sets the value of [max_failures_per_hour][crate::model::JobScheduling::max_failures_per_hour].
14799    ///
14800    /// # Example
14801    /// ```ignore,no_run
14802    /// # use google_cloud_dataproc_v1::model::JobScheduling;
14803    /// let x = JobScheduling::new().set_max_failures_per_hour(42);
14804    /// ```
14805    pub fn set_max_failures_per_hour<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14806        self.max_failures_per_hour = v.into();
14807        self
14808    }
14809
14810    /// Sets the value of [max_failures_total][crate::model::JobScheduling::max_failures_total].
14811    ///
14812    /// # Example
14813    /// ```ignore,no_run
14814    /// # use google_cloud_dataproc_v1::model::JobScheduling;
14815    /// let x = JobScheduling::new().set_max_failures_total(42);
14816    /// ```
14817    pub fn set_max_failures_total<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14818        self.max_failures_total = v.into();
14819        self
14820    }
14821}
14822
14823impl wkt::message::Message for JobScheduling {
14824    fn typename() -> &'static str {
14825        "type.googleapis.com/google.cloud.dataproc.v1.JobScheduling"
14826    }
14827}
14828
14829/// A request to submit a job.
14830#[derive(Clone, Default, PartialEq)]
14831#[non_exhaustive]
14832pub struct SubmitJobRequest {
14833    /// Required. The ID of the Google Cloud Platform project that the job
14834    /// belongs to.
14835    pub project_id: std::string::String,
14836
14837    /// Required. The Dataproc region in which to handle the request.
14838    pub region: std::string::String,
14839
14840    /// Required. The job resource.
14841    pub job: std::option::Option<crate::model::Job>,
14842
14843    /// Optional. A unique id used to identify the request. If the server
14844    /// receives two
14845    /// [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
14846    /// with the same id, then the second request will be ignored and the
14847    /// first [Job][google.cloud.dataproc.v1.Job] created and stored in the backend
14848    /// is returned.
14849    ///
14850    /// It is recommended to always set this value to a
14851    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
14852    ///
14853    /// The id must contain only letters (a-z, A-Z), numbers (0-9),
14854    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
14855    ///
14856    /// [google.cloud.dataproc.v1.Job]: crate::model::Job
14857    pub request_id: std::string::String,
14858
14859    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14860}
14861
14862impl SubmitJobRequest {
14863    pub fn new() -> Self {
14864        std::default::Default::default()
14865    }
14866
14867    /// Sets the value of [project_id][crate::model::SubmitJobRequest::project_id].
14868    ///
14869    /// # Example
14870    /// ```ignore,no_run
14871    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14872    /// let x = SubmitJobRequest::new().set_project_id("example");
14873    /// ```
14874    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14875        self.project_id = v.into();
14876        self
14877    }
14878
14879    /// Sets the value of [region][crate::model::SubmitJobRequest::region].
14880    ///
14881    /// # Example
14882    /// ```ignore,no_run
14883    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14884    /// let x = SubmitJobRequest::new().set_region("example");
14885    /// ```
14886    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14887        self.region = v.into();
14888        self
14889    }
14890
14891    /// Sets the value of [job][crate::model::SubmitJobRequest::job].
14892    ///
14893    /// # Example
14894    /// ```ignore,no_run
14895    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14896    /// use google_cloud_dataproc_v1::model::Job;
14897    /// let x = SubmitJobRequest::new().set_job(Job::default()/* use setters */);
14898    /// ```
14899    pub fn set_job<T>(mut self, v: T) -> Self
14900    where
14901        T: std::convert::Into<crate::model::Job>,
14902    {
14903        self.job = std::option::Option::Some(v.into());
14904        self
14905    }
14906
14907    /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
14908    ///
14909    /// # Example
14910    /// ```ignore,no_run
14911    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14912    /// use google_cloud_dataproc_v1::model::Job;
14913    /// let x = SubmitJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
14914    /// let x = SubmitJobRequest::new().set_or_clear_job(None::<Job>);
14915    /// ```
14916    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
14917    where
14918        T: std::convert::Into<crate::model::Job>,
14919    {
14920        self.job = v.map(|x| x.into());
14921        self
14922    }
14923
14924    /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
14925    ///
14926    /// # Example
14927    /// ```ignore,no_run
14928    /// # use google_cloud_dataproc_v1::model::SubmitJobRequest;
14929    /// let x = SubmitJobRequest::new().set_request_id("example");
14930    /// ```
14931    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14932        self.request_id = v.into();
14933        self
14934    }
14935}
14936
14937impl wkt::message::Message for SubmitJobRequest {
14938    fn typename() -> &'static str {
14939        "type.googleapis.com/google.cloud.dataproc.v1.SubmitJobRequest"
14940    }
14941}
14942
14943/// Job Operation metadata.
14944#[derive(Clone, Default, PartialEq)]
14945#[non_exhaustive]
14946pub struct JobMetadata {
14947    /// Output only. The job id.
14948    pub job_id: std::string::String,
14949
14950    /// Output only. Most recent job status.
14951    pub status: std::option::Option<crate::model::JobStatus>,
14952
14953    /// Output only. Operation type.
14954    pub operation_type: std::string::String,
14955
14956    /// Output only. Job submission time.
14957    pub start_time: std::option::Option<wkt::Timestamp>,
14958
14959    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14960}
14961
14962impl JobMetadata {
14963    pub fn new() -> Self {
14964        std::default::Default::default()
14965    }
14966
14967    /// Sets the value of [job_id][crate::model::JobMetadata::job_id].
14968    ///
14969    /// # Example
14970    /// ```ignore,no_run
14971    /// # use google_cloud_dataproc_v1::model::JobMetadata;
14972    /// let x = JobMetadata::new().set_job_id("example");
14973    /// ```
14974    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14975        self.job_id = v.into();
14976        self
14977    }
14978
14979    /// Sets the value of [status][crate::model::JobMetadata::status].
14980    ///
14981    /// # Example
14982    /// ```ignore,no_run
14983    /// # use google_cloud_dataproc_v1::model::JobMetadata;
14984    /// use google_cloud_dataproc_v1::model::JobStatus;
14985    /// let x = JobMetadata::new().set_status(JobStatus::default()/* use setters */);
14986    /// ```
14987    pub fn set_status<T>(mut self, v: T) -> Self
14988    where
14989        T: std::convert::Into<crate::model::JobStatus>,
14990    {
14991        self.status = std::option::Option::Some(v.into());
14992        self
14993    }
14994
14995    /// Sets or clears the value of [status][crate::model::JobMetadata::status].
14996    ///
14997    /// # Example
14998    /// ```ignore,no_run
14999    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15000    /// use google_cloud_dataproc_v1::model::JobStatus;
15001    /// let x = JobMetadata::new().set_or_clear_status(Some(JobStatus::default()/* use setters */));
15002    /// let x = JobMetadata::new().set_or_clear_status(None::<JobStatus>);
15003    /// ```
15004    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
15005    where
15006        T: std::convert::Into<crate::model::JobStatus>,
15007    {
15008        self.status = v.map(|x| x.into());
15009        self
15010    }
15011
15012    /// Sets the value of [operation_type][crate::model::JobMetadata::operation_type].
15013    ///
15014    /// # Example
15015    /// ```ignore,no_run
15016    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15017    /// let x = JobMetadata::new().set_operation_type("example");
15018    /// ```
15019    pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15020        self.operation_type = v.into();
15021        self
15022    }
15023
15024    /// Sets the value of [start_time][crate::model::JobMetadata::start_time].
15025    ///
15026    /// # Example
15027    /// ```ignore,no_run
15028    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15029    /// use wkt::Timestamp;
15030    /// let x = JobMetadata::new().set_start_time(Timestamp::default()/* use setters */);
15031    /// ```
15032    pub fn set_start_time<T>(mut self, v: T) -> Self
15033    where
15034        T: std::convert::Into<wkt::Timestamp>,
15035    {
15036        self.start_time = std::option::Option::Some(v.into());
15037        self
15038    }
15039
15040    /// Sets or clears the value of [start_time][crate::model::JobMetadata::start_time].
15041    ///
15042    /// # Example
15043    /// ```ignore,no_run
15044    /// # use google_cloud_dataproc_v1::model::JobMetadata;
15045    /// use wkt::Timestamp;
15046    /// let x = JobMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
15047    /// let x = JobMetadata::new().set_or_clear_start_time(None::<Timestamp>);
15048    /// ```
15049    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
15050    where
15051        T: std::convert::Into<wkt::Timestamp>,
15052    {
15053        self.start_time = v.map(|x| x.into());
15054        self
15055    }
15056}
15057
15058impl wkt::message::Message for JobMetadata {
15059    fn typename() -> &'static str {
15060        "type.googleapis.com/google.cloud.dataproc.v1.JobMetadata"
15061    }
15062}
15063
15064/// A request to get the resource representation for a job in a project.
15065#[derive(Clone, Default, PartialEq)]
15066#[non_exhaustive]
15067pub struct GetJobRequest {
15068    /// Required. The ID of the Google Cloud Platform project that the job
15069    /// belongs to.
15070    pub project_id: std::string::String,
15071
15072    /// Required. The Dataproc region in which to handle the request.
15073    pub region: std::string::String,
15074
15075    /// Required. The job ID.
15076    pub job_id: std::string::String,
15077
15078    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15079}
15080
15081impl GetJobRequest {
15082    pub fn new() -> Self {
15083        std::default::Default::default()
15084    }
15085
15086    /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
15087    ///
15088    /// # Example
15089    /// ```ignore,no_run
15090    /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15091    /// let x = GetJobRequest::new().set_project_id("example");
15092    /// ```
15093    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15094        self.project_id = v.into();
15095        self
15096    }
15097
15098    /// Sets the value of [region][crate::model::GetJobRequest::region].
15099    ///
15100    /// # Example
15101    /// ```ignore,no_run
15102    /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15103    /// let x = GetJobRequest::new().set_region("example");
15104    /// ```
15105    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15106        self.region = v.into();
15107        self
15108    }
15109
15110    /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
15111    ///
15112    /// # Example
15113    /// ```ignore,no_run
15114    /// # use google_cloud_dataproc_v1::model::GetJobRequest;
15115    /// let x = GetJobRequest::new().set_job_id("example");
15116    /// ```
15117    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15118        self.job_id = v.into();
15119        self
15120    }
15121}
15122
15123impl wkt::message::Message for GetJobRequest {
15124    fn typename() -> &'static str {
15125        "type.googleapis.com/google.cloud.dataproc.v1.GetJobRequest"
15126    }
15127}
15128
15129/// A request to list jobs in a project.
15130#[derive(Clone, Default, PartialEq)]
15131#[non_exhaustive]
15132pub struct ListJobsRequest {
15133    /// Required. The ID of the Google Cloud Platform project that the job
15134    /// belongs to.
15135    pub project_id: std::string::String,
15136
15137    /// Required. The Dataproc region in which to handle the request.
15138    pub region: std::string::String,
15139
15140    /// Optional. The number of results to return in each response.
15141    pub page_size: i32,
15142
15143    /// Optional. The page token, returned by a previous call, to request the
15144    /// next page of results.
15145    pub page_token: std::string::String,
15146
15147    /// Optional. If set, the returned jobs list includes only jobs that were
15148    /// submitted to the named cluster.
15149    pub cluster_name: std::string::String,
15150
15151    /// Optional. Specifies enumerated categories of jobs to list.
15152    /// (default = match ALL jobs).
15153    ///
15154    /// If `filter` is provided, `jobStateMatcher` will be ignored.
15155    pub job_state_matcher: crate::model::list_jobs_request::JobStateMatcher,
15156
15157    /// Optional. A filter constraining the jobs to list. Filters are
15158    /// case-sensitive and have the following syntax:
15159    ///
15160    /// [field = value] AND [field [= value]] ...
15161    ///
15162    /// where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label
15163    /// key. **value** can be `*` to match all values.
15164    /// `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
15165    /// Only the logical `AND` operator is supported; space-separated items are
15166    /// treated as having an implicit `AND` operator.
15167    ///
15168    /// Example filter:
15169    ///
15170    /// status.state = ACTIVE AND labels.env = staging AND labels.starred = *
15171    pub filter: std::string::String,
15172
15173    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15174}
15175
15176impl ListJobsRequest {
15177    pub fn new() -> Self {
15178        std::default::Default::default()
15179    }
15180
15181    /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
15182    ///
15183    /// # Example
15184    /// ```ignore,no_run
15185    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15186    /// let x = ListJobsRequest::new().set_project_id("example");
15187    /// ```
15188    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15189        self.project_id = v.into();
15190        self
15191    }
15192
15193    /// Sets the value of [region][crate::model::ListJobsRequest::region].
15194    ///
15195    /// # Example
15196    /// ```ignore,no_run
15197    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15198    /// let x = ListJobsRequest::new().set_region("example");
15199    /// ```
15200    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15201        self.region = v.into();
15202        self
15203    }
15204
15205    /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
15206    ///
15207    /// # Example
15208    /// ```ignore,no_run
15209    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15210    /// let x = ListJobsRequest::new().set_page_size(42);
15211    /// ```
15212    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15213        self.page_size = v.into();
15214        self
15215    }
15216
15217    /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
15218    ///
15219    /// # Example
15220    /// ```ignore,no_run
15221    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15222    /// let x = ListJobsRequest::new().set_page_token("example");
15223    /// ```
15224    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15225        self.page_token = v.into();
15226        self
15227    }
15228
15229    /// Sets the value of [cluster_name][crate::model::ListJobsRequest::cluster_name].
15230    ///
15231    /// # Example
15232    /// ```ignore,no_run
15233    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15234    /// let x = ListJobsRequest::new().set_cluster_name("example");
15235    /// ```
15236    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15237        self.cluster_name = v.into();
15238        self
15239    }
15240
15241    /// Sets the value of [job_state_matcher][crate::model::ListJobsRequest::job_state_matcher].
15242    ///
15243    /// # Example
15244    /// ```ignore,no_run
15245    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15246    /// use google_cloud_dataproc_v1::model::list_jobs_request::JobStateMatcher;
15247    /// let x0 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::Active);
15248    /// let x1 = ListJobsRequest::new().set_job_state_matcher(JobStateMatcher::NonActive);
15249    /// ```
15250    pub fn set_job_state_matcher<
15251        T: std::convert::Into<crate::model::list_jobs_request::JobStateMatcher>,
15252    >(
15253        mut self,
15254        v: T,
15255    ) -> Self {
15256        self.job_state_matcher = v.into();
15257        self
15258    }
15259
15260    /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
15261    ///
15262    /// # Example
15263    /// ```ignore,no_run
15264    /// # use google_cloud_dataproc_v1::model::ListJobsRequest;
15265    /// let x = ListJobsRequest::new().set_filter("example");
15266    /// ```
15267    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15268        self.filter = v.into();
15269        self
15270    }
15271}
15272
15273impl wkt::message::Message for ListJobsRequest {
15274    fn typename() -> &'static str {
15275        "type.googleapis.com/google.cloud.dataproc.v1.ListJobsRequest"
15276    }
15277}
15278
15279/// Defines additional types related to [ListJobsRequest].
15280pub mod list_jobs_request {
15281    #[allow(unused_imports)]
15282    use super::*;
15283
15284    /// A matcher that specifies categories of job states.
15285    ///
15286    /// # Working with unknown values
15287    ///
15288    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15289    /// additional enum variants at any time. Adding new variants is not considered
15290    /// a breaking change. Applications should write their code in anticipation of:
15291    ///
15292    /// - New values appearing in future releases of the client library, **and**
15293    /// - New values received dynamically, without application changes.
15294    ///
15295    /// Please consult the [Working with enums] section in the user guide for some
15296    /// guidelines.
15297    ///
15298    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15299    #[derive(Clone, Debug, PartialEq)]
15300    #[non_exhaustive]
15301    pub enum JobStateMatcher {
15302        /// Match all jobs, regardless of state.
15303        All,
15304        /// Only match jobs in non-terminal states: PENDING, RUNNING, or
15305        /// CANCEL_PENDING.
15306        Active,
15307        /// Only match jobs in terminal states: CANCELLED, DONE, or ERROR.
15308        NonActive,
15309        /// If set, the enum was initialized with an unknown value.
15310        ///
15311        /// Applications can examine the value using [JobStateMatcher::value] or
15312        /// [JobStateMatcher::name].
15313        UnknownValue(job_state_matcher::UnknownValue),
15314    }
15315
15316    #[doc(hidden)]
15317    pub mod job_state_matcher {
15318        #[allow(unused_imports)]
15319        use super::*;
15320        #[derive(Clone, Debug, PartialEq)]
15321        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15322    }
15323
15324    impl JobStateMatcher {
15325        /// Gets the enum value.
15326        ///
15327        /// Returns `None` if the enum contains an unknown value deserialized from
15328        /// the string representation of enums.
15329        pub fn value(&self) -> std::option::Option<i32> {
15330            match self {
15331                Self::All => std::option::Option::Some(0),
15332                Self::Active => std::option::Option::Some(1),
15333                Self::NonActive => std::option::Option::Some(2),
15334                Self::UnknownValue(u) => u.0.value(),
15335            }
15336        }
15337
15338        /// Gets the enum value as a string.
15339        ///
15340        /// Returns `None` if the enum contains an unknown value deserialized from
15341        /// the integer representation of enums.
15342        pub fn name(&self) -> std::option::Option<&str> {
15343            match self {
15344                Self::All => std::option::Option::Some("ALL"),
15345                Self::Active => std::option::Option::Some("ACTIVE"),
15346                Self::NonActive => std::option::Option::Some("NON_ACTIVE"),
15347                Self::UnknownValue(u) => u.0.name(),
15348            }
15349        }
15350    }
15351
15352    impl std::default::Default for JobStateMatcher {
15353        fn default() -> Self {
15354            use std::convert::From;
15355            Self::from(0)
15356        }
15357    }
15358
15359    impl std::fmt::Display for JobStateMatcher {
15360        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15361            wkt::internal::display_enum(f, self.name(), self.value())
15362        }
15363    }
15364
15365    impl std::convert::From<i32> for JobStateMatcher {
15366        fn from(value: i32) -> Self {
15367            match value {
15368                0 => Self::All,
15369                1 => Self::Active,
15370                2 => Self::NonActive,
15371                _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15372                    wkt::internal::UnknownEnumValue::Integer(value),
15373                )),
15374            }
15375        }
15376    }
15377
15378    impl std::convert::From<&str> for JobStateMatcher {
15379        fn from(value: &str) -> Self {
15380            use std::string::ToString;
15381            match value {
15382                "ALL" => Self::All,
15383                "ACTIVE" => Self::Active,
15384                "NON_ACTIVE" => Self::NonActive,
15385                _ => Self::UnknownValue(job_state_matcher::UnknownValue(
15386                    wkt::internal::UnknownEnumValue::String(value.to_string()),
15387                )),
15388            }
15389        }
15390    }
15391
15392    impl serde::ser::Serialize for JobStateMatcher {
15393        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15394        where
15395            S: serde::Serializer,
15396        {
15397            match self {
15398                Self::All => serializer.serialize_i32(0),
15399                Self::Active => serializer.serialize_i32(1),
15400                Self::NonActive => serializer.serialize_i32(2),
15401                Self::UnknownValue(u) => u.0.serialize(serializer),
15402            }
15403        }
15404    }
15405
15406    impl<'de> serde::de::Deserialize<'de> for JobStateMatcher {
15407        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15408        where
15409            D: serde::Deserializer<'de>,
15410        {
15411            deserializer.deserialize_any(wkt::internal::EnumVisitor::<JobStateMatcher>::new(
15412                ".google.cloud.dataproc.v1.ListJobsRequest.JobStateMatcher",
15413            ))
15414        }
15415    }
15416}
15417
15418/// A request to update a job.
15419#[derive(Clone, Default, PartialEq)]
15420#[non_exhaustive]
15421pub struct UpdateJobRequest {
15422    /// Required. The ID of the Google Cloud Platform project that the job
15423    /// belongs to.
15424    pub project_id: std::string::String,
15425
15426    /// Required. The Dataproc region in which to handle the request.
15427    pub region: std::string::String,
15428
15429    /// Required. The job ID.
15430    pub job_id: std::string::String,
15431
15432    /// Required. The changes to the job.
15433    pub job: std::option::Option<crate::model::Job>,
15434
15435    /// Required. Specifies the path, relative to \<code\>Job\</code\>, of
15436    /// the field to update. For example, to update the labels of a Job the
15437    /// \<code\>update_mask\</code\> parameter would be specified as
15438    /// \<code\>labels\</code\>, and the `PATCH` request body would specify the new
15439    /// value. \<strong\>Note:\</strong\> Currently, \<code\>labels\</code\> is the only
15440    /// field that can be updated.
15441    pub update_mask: std::option::Option<wkt::FieldMask>,
15442
15443    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15444}
15445
15446impl UpdateJobRequest {
15447    pub fn new() -> Self {
15448        std::default::Default::default()
15449    }
15450
15451    /// Sets the value of [project_id][crate::model::UpdateJobRequest::project_id].
15452    ///
15453    /// # Example
15454    /// ```ignore,no_run
15455    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15456    /// let x = UpdateJobRequest::new().set_project_id("example");
15457    /// ```
15458    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15459        self.project_id = v.into();
15460        self
15461    }
15462
15463    /// Sets the value of [region][crate::model::UpdateJobRequest::region].
15464    ///
15465    /// # Example
15466    /// ```ignore,no_run
15467    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15468    /// let x = UpdateJobRequest::new().set_region("example");
15469    /// ```
15470    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15471        self.region = v.into();
15472        self
15473    }
15474
15475    /// Sets the value of [job_id][crate::model::UpdateJobRequest::job_id].
15476    ///
15477    /// # Example
15478    /// ```ignore,no_run
15479    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15480    /// let x = UpdateJobRequest::new().set_job_id("example");
15481    /// ```
15482    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15483        self.job_id = v.into();
15484        self
15485    }
15486
15487    /// Sets the value of [job][crate::model::UpdateJobRequest::job].
15488    ///
15489    /// # Example
15490    /// ```ignore,no_run
15491    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15492    /// use google_cloud_dataproc_v1::model::Job;
15493    /// let x = UpdateJobRequest::new().set_job(Job::default()/* use setters */);
15494    /// ```
15495    pub fn set_job<T>(mut self, v: T) -> Self
15496    where
15497        T: std::convert::Into<crate::model::Job>,
15498    {
15499        self.job = std::option::Option::Some(v.into());
15500        self
15501    }
15502
15503    /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
15504    ///
15505    /// # Example
15506    /// ```ignore,no_run
15507    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15508    /// use google_cloud_dataproc_v1::model::Job;
15509    /// let x = UpdateJobRequest::new().set_or_clear_job(Some(Job::default()/* use setters */));
15510    /// let x = UpdateJobRequest::new().set_or_clear_job(None::<Job>);
15511    /// ```
15512    pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
15513    where
15514        T: std::convert::Into<crate::model::Job>,
15515    {
15516        self.job = v.map(|x| x.into());
15517        self
15518    }
15519
15520    /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15521    ///
15522    /// # Example
15523    /// ```ignore,no_run
15524    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15525    /// use wkt::FieldMask;
15526    /// let x = UpdateJobRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15527    /// ```
15528    pub fn set_update_mask<T>(mut self, v: T) -> Self
15529    where
15530        T: std::convert::Into<wkt::FieldMask>,
15531    {
15532        self.update_mask = std::option::Option::Some(v.into());
15533        self
15534    }
15535
15536    /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
15537    ///
15538    /// # Example
15539    /// ```ignore,no_run
15540    /// # use google_cloud_dataproc_v1::model::UpdateJobRequest;
15541    /// use wkt::FieldMask;
15542    /// let x = UpdateJobRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15543    /// let x = UpdateJobRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15544    /// ```
15545    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15546    where
15547        T: std::convert::Into<wkt::FieldMask>,
15548    {
15549        self.update_mask = v.map(|x| x.into());
15550        self
15551    }
15552}
15553
15554impl wkt::message::Message for UpdateJobRequest {
15555    fn typename() -> &'static str {
15556        "type.googleapis.com/google.cloud.dataproc.v1.UpdateJobRequest"
15557    }
15558}
15559
15560/// A list of jobs in a project.
15561#[derive(Clone, Default, PartialEq)]
15562#[non_exhaustive]
15563pub struct ListJobsResponse {
15564    /// Output only. Jobs list.
15565    pub jobs: std::vec::Vec<crate::model::Job>,
15566
15567    /// Optional. This token is included in the response if there are more results
15568    /// to fetch. To fetch additional results, provide this value as the
15569    /// `page_token` in a subsequent \<code\>ListJobsRequest\</code\>.
15570    pub next_page_token: std::string::String,
15571
15572    /// Output only. List of jobs with
15573    /// [kms_key][google.cloud.dataproc.v1.EncryptionConfig.kms_key]-encrypted
15574    /// parameters that could not be decrypted. A response to a `jobs.get` request
15575    /// may indicate the reason for the decryption failure for a specific job.
15576    ///
15577    /// [google.cloud.dataproc.v1.EncryptionConfig.kms_key]: crate::model::EncryptionConfig::kms_key
15578    pub unreachable: std::vec::Vec<std::string::String>,
15579
15580    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15581}
15582
15583impl ListJobsResponse {
15584    pub fn new() -> Self {
15585        std::default::Default::default()
15586    }
15587
15588    /// Sets the value of [jobs][crate::model::ListJobsResponse::jobs].
15589    ///
15590    /// # Example
15591    /// ```ignore,no_run
15592    /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15593    /// use google_cloud_dataproc_v1::model::Job;
15594    /// let x = ListJobsResponse::new()
15595    ///     .set_jobs([
15596    ///         Job::default()/* use setters */,
15597    ///         Job::default()/* use (different) setters */,
15598    ///     ]);
15599    /// ```
15600    pub fn set_jobs<T, V>(mut self, v: T) -> Self
15601    where
15602        T: std::iter::IntoIterator<Item = V>,
15603        V: std::convert::Into<crate::model::Job>,
15604    {
15605        use std::iter::Iterator;
15606        self.jobs = v.into_iter().map(|i| i.into()).collect();
15607        self
15608    }
15609
15610    /// Sets the value of [next_page_token][crate::model::ListJobsResponse::next_page_token].
15611    ///
15612    /// # Example
15613    /// ```ignore,no_run
15614    /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15615    /// let x = ListJobsResponse::new().set_next_page_token("example");
15616    /// ```
15617    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15618        self.next_page_token = v.into();
15619        self
15620    }
15621
15622    /// Sets the value of [unreachable][crate::model::ListJobsResponse::unreachable].
15623    ///
15624    /// # Example
15625    /// ```ignore,no_run
15626    /// # use google_cloud_dataproc_v1::model::ListJobsResponse;
15627    /// let x = ListJobsResponse::new().set_unreachable(["a", "b", "c"]);
15628    /// ```
15629    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
15630    where
15631        T: std::iter::IntoIterator<Item = V>,
15632        V: std::convert::Into<std::string::String>,
15633    {
15634        use std::iter::Iterator;
15635        self.unreachable = v.into_iter().map(|i| i.into()).collect();
15636        self
15637    }
15638}
15639
15640impl wkt::message::Message for ListJobsResponse {
15641    fn typename() -> &'static str {
15642        "type.googleapis.com/google.cloud.dataproc.v1.ListJobsResponse"
15643    }
15644}
15645
15646#[doc(hidden)]
15647impl google_cloud_gax::paginator::internal::PageableResponse for ListJobsResponse {
15648    type PageItem = crate::model::Job;
15649
15650    fn items(self) -> std::vec::Vec<Self::PageItem> {
15651        self.jobs
15652    }
15653
15654    fn next_page_token(&self) -> std::string::String {
15655        use std::clone::Clone;
15656        self.next_page_token.clone()
15657    }
15658}
15659
15660/// A request to cancel a job.
15661#[derive(Clone, Default, PartialEq)]
15662#[non_exhaustive]
15663pub struct CancelJobRequest {
15664    /// Required. The ID of the Google Cloud Platform project that the job
15665    /// belongs to.
15666    pub project_id: std::string::String,
15667
15668    /// Required. The Dataproc region in which to handle the request.
15669    pub region: std::string::String,
15670
15671    /// Required. The job ID.
15672    pub job_id: std::string::String,
15673
15674    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15675}
15676
15677impl CancelJobRequest {
15678    pub fn new() -> Self {
15679        std::default::Default::default()
15680    }
15681
15682    /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
15683    ///
15684    /// # Example
15685    /// ```ignore,no_run
15686    /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15687    /// let x = CancelJobRequest::new().set_project_id("example");
15688    /// ```
15689    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15690        self.project_id = v.into();
15691        self
15692    }
15693
15694    /// Sets the value of [region][crate::model::CancelJobRequest::region].
15695    ///
15696    /// # Example
15697    /// ```ignore,no_run
15698    /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15699    /// let x = CancelJobRequest::new().set_region("example");
15700    /// ```
15701    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15702        self.region = v.into();
15703        self
15704    }
15705
15706    /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
15707    ///
15708    /// # Example
15709    /// ```ignore,no_run
15710    /// # use google_cloud_dataproc_v1::model::CancelJobRequest;
15711    /// let x = CancelJobRequest::new().set_job_id("example");
15712    /// ```
15713    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15714        self.job_id = v.into();
15715        self
15716    }
15717}
15718
15719impl wkt::message::Message for CancelJobRequest {
15720    fn typename() -> &'static str {
15721        "type.googleapis.com/google.cloud.dataproc.v1.CancelJobRequest"
15722    }
15723}
15724
15725/// A request to delete a job.
15726#[derive(Clone, Default, PartialEq)]
15727#[non_exhaustive]
15728pub struct DeleteJobRequest {
15729    /// Required. The ID of the Google Cloud Platform project that the job
15730    /// belongs to.
15731    pub project_id: std::string::String,
15732
15733    /// Required. The Dataproc region in which to handle the request.
15734    pub region: std::string::String,
15735
15736    /// Required. The job ID.
15737    pub job_id: std::string::String,
15738
15739    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15740}
15741
15742impl DeleteJobRequest {
15743    pub fn new() -> Self {
15744        std::default::Default::default()
15745    }
15746
15747    /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
15748    ///
15749    /// # Example
15750    /// ```ignore,no_run
15751    /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15752    /// let x = DeleteJobRequest::new().set_project_id("example");
15753    /// ```
15754    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15755        self.project_id = v.into();
15756        self
15757    }
15758
15759    /// Sets the value of [region][crate::model::DeleteJobRequest::region].
15760    ///
15761    /// # Example
15762    /// ```ignore,no_run
15763    /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15764    /// let x = DeleteJobRequest::new().set_region("example");
15765    /// ```
15766    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15767        self.region = v.into();
15768        self
15769    }
15770
15771    /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
15772    ///
15773    /// # Example
15774    /// ```ignore,no_run
15775    /// # use google_cloud_dataproc_v1::model::DeleteJobRequest;
15776    /// let x = DeleteJobRequest::new().set_job_id("example");
15777    /// ```
15778    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15779        self.job_id = v.into();
15780        self
15781    }
15782}
15783
15784impl wkt::message::Message for DeleteJobRequest {
15785    fn typename() -> &'static str {
15786        "type.googleapis.com/google.cloud.dataproc.v1.DeleteJobRequest"
15787    }
15788}
15789
15790/// A request to create a node group.
15791#[derive(Clone, Default, PartialEq)]
15792#[non_exhaustive]
15793pub struct CreateNodeGroupRequest {
15794    /// Required. The parent resource where this node group will be created.
15795    /// Format: `projects/{project}/regions/{region}/clusters/{cluster}`
15796    pub parent: std::string::String,
15797
15798    /// Required. The node group to create.
15799    pub node_group: std::option::Option<crate::model::NodeGroup>,
15800
15801    /// Optional. An optional node group ID. Generated if not specified.
15802    ///
15803    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15804    /// underscores (_), and hyphens (-). Cannot begin or end with underscore
15805    /// or hyphen. Must consist of from 3 to 33 characters.
15806    pub node_group_id: std::string::String,
15807
15808    /// Optional. A unique ID used to identify the request. If the server receives
15809    /// two
15810    /// [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests)
15811    /// with the same ID, the second request is ignored and the
15812    /// first [google.longrunning.Operation][google.longrunning.Operation] created
15813    /// and stored in the backend is returned.
15814    ///
15815    /// Recommendation: Set this value to a
15816    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15817    ///
15818    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15819    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15820    ///
15821    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
15822    pub request_id: std::string::String,
15823
15824    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15825}
15826
15827impl CreateNodeGroupRequest {
15828    pub fn new() -> Self {
15829        std::default::Default::default()
15830    }
15831
15832    /// Sets the value of [parent][crate::model::CreateNodeGroupRequest::parent].
15833    ///
15834    /// # Example
15835    /// ```ignore,no_run
15836    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15837    /// let x = CreateNodeGroupRequest::new().set_parent("example");
15838    /// ```
15839    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15840        self.parent = v.into();
15841        self
15842    }
15843
15844    /// Sets the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
15845    ///
15846    /// # Example
15847    /// ```ignore,no_run
15848    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15849    /// use google_cloud_dataproc_v1::model::NodeGroup;
15850    /// let x = CreateNodeGroupRequest::new().set_node_group(NodeGroup::default()/* use setters */);
15851    /// ```
15852    pub fn set_node_group<T>(mut self, v: T) -> Self
15853    where
15854        T: std::convert::Into<crate::model::NodeGroup>,
15855    {
15856        self.node_group = std::option::Option::Some(v.into());
15857        self
15858    }
15859
15860    /// Sets or clears the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
15861    ///
15862    /// # Example
15863    /// ```ignore,no_run
15864    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15865    /// use google_cloud_dataproc_v1::model::NodeGroup;
15866    /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(Some(NodeGroup::default()/* use setters */));
15867    /// let x = CreateNodeGroupRequest::new().set_or_clear_node_group(None::<NodeGroup>);
15868    /// ```
15869    pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
15870    where
15871        T: std::convert::Into<crate::model::NodeGroup>,
15872    {
15873        self.node_group = v.map(|x| x.into());
15874        self
15875    }
15876
15877    /// Sets the value of [node_group_id][crate::model::CreateNodeGroupRequest::node_group_id].
15878    ///
15879    /// # Example
15880    /// ```ignore,no_run
15881    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15882    /// let x = CreateNodeGroupRequest::new().set_node_group_id("example");
15883    /// ```
15884    pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15885        self.node_group_id = v.into();
15886        self
15887    }
15888
15889    /// Sets the value of [request_id][crate::model::CreateNodeGroupRequest::request_id].
15890    ///
15891    /// # Example
15892    /// ```ignore,no_run
15893    /// # use google_cloud_dataproc_v1::model::CreateNodeGroupRequest;
15894    /// let x = CreateNodeGroupRequest::new().set_request_id("example");
15895    /// ```
15896    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15897        self.request_id = v.into();
15898        self
15899    }
15900}
15901
15902impl wkt::message::Message for CreateNodeGroupRequest {
15903    fn typename() -> &'static str {
15904        "type.googleapis.com/google.cloud.dataproc.v1.CreateNodeGroupRequest"
15905    }
15906}
15907
15908/// A request to resize a node group.
15909#[derive(Clone, Default, PartialEq)]
15910#[non_exhaustive]
15911pub struct ResizeNodeGroupRequest {
15912    /// Required. The name of the node group to resize.
15913    /// Format:
15914    /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
15915    pub name: std::string::String,
15916
15917    /// Required. The number of running instances for the node group to maintain.
15918    /// The group adds or removes instances to maintain the number of instances
15919    /// specified by this parameter.
15920    pub size: i32,
15921
15922    /// Optional. A unique ID used to identify the request. If the server receives
15923    /// two
15924    /// [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests)
15925    /// with the same ID, the second request is ignored and the
15926    /// first [google.longrunning.Operation][google.longrunning.Operation] created
15927    /// and stored in the backend is returned.
15928    ///
15929    /// Recommendation: Set this value to a
15930    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
15931    ///
15932    /// The ID must contain only letters (a-z, A-Z), numbers (0-9),
15933    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
15934    ///
15935    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
15936    pub request_id: std::string::String,
15937
15938    /// Optional. Timeout for graceful YARN decommissioning. [Graceful
15939    /// decommissioning]
15940    /// (<https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning>)
15941    /// allows the removal of nodes from the Compute Engine node group
15942    /// without interrupting jobs in progress. This timeout specifies how long to
15943    /// wait for jobs in progress to finish before forcefully removing nodes (and
15944    /// potentially interrupting jobs). Default timeout is 0 (for forceful
15945    /// decommission), and the maximum allowed timeout is 1 day. (see JSON
15946    /// representation of
15947    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
15948    ///
15949    /// Only supported on Dataproc image versions 1.2 and higher.
15950    pub graceful_decommission_timeout: std::option::Option<wkt::Duration>,
15951
15952    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15953}
15954
15955impl ResizeNodeGroupRequest {
15956    pub fn new() -> Self {
15957        std::default::Default::default()
15958    }
15959
15960    /// Sets the value of [name][crate::model::ResizeNodeGroupRequest::name].
15961    ///
15962    /// # Example
15963    /// ```ignore,no_run
15964    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15965    /// let x = ResizeNodeGroupRequest::new().set_name("example");
15966    /// ```
15967    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15968        self.name = v.into();
15969        self
15970    }
15971
15972    /// Sets the value of [size][crate::model::ResizeNodeGroupRequest::size].
15973    ///
15974    /// # Example
15975    /// ```ignore,no_run
15976    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15977    /// let x = ResizeNodeGroupRequest::new().set_size(42);
15978    /// ```
15979    pub fn set_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15980        self.size = v.into();
15981        self
15982    }
15983
15984    /// Sets the value of [request_id][crate::model::ResizeNodeGroupRequest::request_id].
15985    ///
15986    /// # Example
15987    /// ```ignore,no_run
15988    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
15989    /// let x = ResizeNodeGroupRequest::new().set_request_id("example");
15990    /// ```
15991    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15992        self.request_id = v.into();
15993        self
15994    }
15995
15996    /// Sets the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
15997    ///
15998    /// # Example
15999    /// ```ignore,no_run
16000    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16001    /// use wkt::Duration;
16002    /// let x = ResizeNodeGroupRequest::new().set_graceful_decommission_timeout(Duration::default()/* use setters */);
16003    /// ```
16004    pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
16005    where
16006        T: std::convert::Into<wkt::Duration>,
16007    {
16008        self.graceful_decommission_timeout = std::option::Option::Some(v.into());
16009        self
16010    }
16011
16012    /// Sets or clears the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
16013    ///
16014    /// # Example
16015    /// ```ignore,no_run
16016    /// # use google_cloud_dataproc_v1::model::ResizeNodeGroupRequest;
16017    /// use wkt::Duration;
16018    /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(Some(Duration::default()/* use setters */));
16019    /// let x = ResizeNodeGroupRequest::new().set_or_clear_graceful_decommission_timeout(None::<Duration>);
16020    /// ```
16021    pub fn set_or_clear_graceful_decommission_timeout<T>(
16022        mut self,
16023        v: std::option::Option<T>,
16024    ) -> Self
16025    where
16026        T: std::convert::Into<wkt::Duration>,
16027    {
16028        self.graceful_decommission_timeout = v.map(|x| x.into());
16029        self
16030    }
16031}
16032
16033impl wkt::message::Message for ResizeNodeGroupRequest {
16034    fn typename() -> &'static str {
16035        "type.googleapis.com/google.cloud.dataproc.v1.ResizeNodeGroupRequest"
16036    }
16037}
16038
16039/// A request to get a node group .
16040#[derive(Clone, Default, PartialEq)]
16041#[non_exhaustive]
16042pub struct GetNodeGroupRequest {
16043    /// Required. The name of the node group to retrieve.
16044    /// Format:
16045    /// `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
16046    pub name: std::string::String,
16047
16048    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16049}
16050
16051impl GetNodeGroupRequest {
16052    pub fn new() -> Self {
16053        std::default::Default::default()
16054    }
16055
16056    /// Sets the value of [name][crate::model::GetNodeGroupRequest::name].
16057    ///
16058    /// # Example
16059    /// ```ignore,no_run
16060    /// # use google_cloud_dataproc_v1::model::GetNodeGroupRequest;
16061    /// let x = GetNodeGroupRequest::new().set_name("example");
16062    /// ```
16063    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16064        self.name = v.into();
16065        self
16066    }
16067}
16068
16069impl wkt::message::Message for GetNodeGroupRequest {
16070    fn typename() -> &'static str {
16071        "type.googleapis.com/google.cloud.dataproc.v1.GetNodeGroupRequest"
16072    }
16073}
16074
16075/// Metadata describing the Batch operation.
16076#[derive(Clone, Default, PartialEq)]
16077#[non_exhaustive]
16078pub struct BatchOperationMetadata {
16079    /// Name of the batch for the operation.
16080    pub batch: std::string::String,
16081
16082    /// Batch UUID for the operation.
16083    pub batch_uuid: std::string::String,
16084
16085    /// The time when the operation was created.
16086    pub create_time: std::option::Option<wkt::Timestamp>,
16087
16088    /// The time when the operation finished.
16089    pub done_time: std::option::Option<wkt::Timestamp>,
16090
16091    /// The operation type.
16092    pub operation_type: crate::model::batch_operation_metadata::BatchOperationType,
16093
16094    /// Short description of the operation.
16095    pub description: std::string::String,
16096
16097    /// Labels associated with the operation.
16098    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16099
16100    /// Warnings encountered during operation execution.
16101    pub warnings: std::vec::Vec<std::string::String>,
16102
16103    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16104}
16105
16106impl BatchOperationMetadata {
16107    pub fn new() -> Self {
16108        std::default::Default::default()
16109    }
16110
16111    /// Sets the value of [batch][crate::model::BatchOperationMetadata::batch].
16112    ///
16113    /// # Example
16114    /// ```ignore,no_run
16115    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16116    /// let x = BatchOperationMetadata::new().set_batch("example");
16117    /// ```
16118    pub fn set_batch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16119        self.batch = v.into();
16120        self
16121    }
16122
16123    /// Sets the value of [batch_uuid][crate::model::BatchOperationMetadata::batch_uuid].
16124    ///
16125    /// # Example
16126    /// ```ignore,no_run
16127    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16128    /// let x = BatchOperationMetadata::new().set_batch_uuid("example");
16129    /// ```
16130    pub fn set_batch_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16131        self.batch_uuid = v.into();
16132        self
16133    }
16134
16135    /// Sets the value of [create_time][crate::model::BatchOperationMetadata::create_time].
16136    ///
16137    /// # Example
16138    /// ```ignore,no_run
16139    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16140    /// use wkt::Timestamp;
16141    /// let x = BatchOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16142    /// ```
16143    pub fn set_create_time<T>(mut self, v: T) -> Self
16144    where
16145        T: std::convert::Into<wkt::Timestamp>,
16146    {
16147        self.create_time = std::option::Option::Some(v.into());
16148        self
16149    }
16150
16151    /// Sets or clears the value of [create_time][crate::model::BatchOperationMetadata::create_time].
16152    ///
16153    /// # Example
16154    /// ```ignore,no_run
16155    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16156    /// use wkt::Timestamp;
16157    /// let x = BatchOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16158    /// let x = BatchOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16159    /// ```
16160    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16161    where
16162        T: std::convert::Into<wkt::Timestamp>,
16163    {
16164        self.create_time = v.map(|x| x.into());
16165        self
16166    }
16167
16168    /// Sets the value of [done_time][crate::model::BatchOperationMetadata::done_time].
16169    ///
16170    /// # Example
16171    /// ```ignore,no_run
16172    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16173    /// use wkt::Timestamp;
16174    /// let x = BatchOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16175    /// ```
16176    pub fn set_done_time<T>(mut self, v: T) -> Self
16177    where
16178        T: std::convert::Into<wkt::Timestamp>,
16179    {
16180        self.done_time = std::option::Option::Some(v.into());
16181        self
16182    }
16183
16184    /// Sets or clears the value of [done_time][crate::model::BatchOperationMetadata::done_time].
16185    ///
16186    /// # Example
16187    /// ```ignore,no_run
16188    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16189    /// use wkt::Timestamp;
16190    /// let x = BatchOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16191    /// let x = BatchOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16192    /// ```
16193    pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16194    where
16195        T: std::convert::Into<wkt::Timestamp>,
16196    {
16197        self.done_time = v.map(|x| x.into());
16198        self
16199    }
16200
16201    /// Sets the value of [operation_type][crate::model::BatchOperationMetadata::operation_type].
16202    ///
16203    /// # Example
16204    /// ```ignore,no_run
16205    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16206    /// use google_cloud_dataproc_v1::model::batch_operation_metadata::BatchOperationType;
16207    /// let x0 = BatchOperationMetadata::new().set_operation_type(BatchOperationType::Batch);
16208    /// ```
16209    pub fn set_operation_type<
16210        T: std::convert::Into<crate::model::batch_operation_metadata::BatchOperationType>,
16211    >(
16212        mut self,
16213        v: T,
16214    ) -> Self {
16215        self.operation_type = v.into();
16216        self
16217    }
16218
16219    /// Sets the value of [description][crate::model::BatchOperationMetadata::description].
16220    ///
16221    /// # Example
16222    /// ```ignore,no_run
16223    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16224    /// let x = BatchOperationMetadata::new().set_description("example");
16225    /// ```
16226    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16227        self.description = v.into();
16228        self
16229    }
16230
16231    /// Sets the value of [labels][crate::model::BatchOperationMetadata::labels].
16232    ///
16233    /// # Example
16234    /// ```ignore,no_run
16235    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16236    /// let x = BatchOperationMetadata::new().set_labels([
16237    ///     ("key0", "abc"),
16238    ///     ("key1", "xyz"),
16239    /// ]);
16240    /// ```
16241    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16242    where
16243        T: std::iter::IntoIterator<Item = (K, V)>,
16244        K: std::convert::Into<std::string::String>,
16245        V: std::convert::Into<std::string::String>,
16246    {
16247        use std::iter::Iterator;
16248        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16249        self
16250    }
16251
16252    /// Sets the value of [warnings][crate::model::BatchOperationMetadata::warnings].
16253    ///
16254    /// # Example
16255    /// ```ignore,no_run
16256    /// # use google_cloud_dataproc_v1::model::BatchOperationMetadata;
16257    /// let x = BatchOperationMetadata::new().set_warnings(["a", "b", "c"]);
16258    /// ```
16259    pub fn set_warnings<T, V>(mut self, v: T) -> Self
16260    where
16261        T: std::iter::IntoIterator<Item = V>,
16262        V: std::convert::Into<std::string::String>,
16263    {
16264        use std::iter::Iterator;
16265        self.warnings = v.into_iter().map(|i| i.into()).collect();
16266        self
16267    }
16268}
16269
16270impl wkt::message::Message for BatchOperationMetadata {
16271    fn typename() -> &'static str {
16272        "type.googleapis.com/google.cloud.dataproc.v1.BatchOperationMetadata"
16273    }
16274}
16275
16276/// Defines additional types related to [BatchOperationMetadata].
16277pub mod batch_operation_metadata {
16278    #[allow(unused_imports)]
16279    use super::*;
16280
16281    /// Operation type for Batch resources
16282    ///
16283    /// # Working with unknown values
16284    ///
16285    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16286    /// additional enum variants at any time. Adding new variants is not considered
16287    /// a breaking change. Applications should write their code in anticipation of:
16288    ///
16289    /// - New values appearing in future releases of the client library, **and**
16290    /// - New values received dynamically, without application changes.
16291    ///
16292    /// Please consult the [Working with enums] section in the user guide for some
16293    /// guidelines.
16294    ///
16295    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16296    #[derive(Clone, Debug, PartialEq)]
16297    #[non_exhaustive]
16298    pub enum BatchOperationType {
16299        /// Batch operation type is unknown.
16300        Unspecified,
16301        /// Batch operation type.
16302        Batch,
16303        /// If set, the enum was initialized with an unknown value.
16304        ///
16305        /// Applications can examine the value using [BatchOperationType::value] or
16306        /// [BatchOperationType::name].
16307        UnknownValue(batch_operation_type::UnknownValue),
16308    }
16309
16310    #[doc(hidden)]
16311    pub mod batch_operation_type {
16312        #[allow(unused_imports)]
16313        use super::*;
16314        #[derive(Clone, Debug, PartialEq)]
16315        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16316    }
16317
16318    impl BatchOperationType {
16319        /// Gets the enum value.
16320        ///
16321        /// Returns `None` if the enum contains an unknown value deserialized from
16322        /// the string representation of enums.
16323        pub fn value(&self) -> std::option::Option<i32> {
16324            match self {
16325                Self::Unspecified => std::option::Option::Some(0),
16326                Self::Batch => std::option::Option::Some(1),
16327                Self::UnknownValue(u) => u.0.value(),
16328            }
16329        }
16330
16331        /// Gets the enum value as a string.
16332        ///
16333        /// Returns `None` if the enum contains an unknown value deserialized from
16334        /// the integer representation of enums.
16335        pub fn name(&self) -> std::option::Option<&str> {
16336            match self {
16337                Self::Unspecified => std::option::Option::Some("BATCH_OPERATION_TYPE_UNSPECIFIED"),
16338                Self::Batch => std::option::Option::Some("BATCH"),
16339                Self::UnknownValue(u) => u.0.name(),
16340            }
16341        }
16342    }
16343
16344    impl std::default::Default for BatchOperationType {
16345        fn default() -> Self {
16346            use std::convert::From;
16347            Self::from(0)
16348        }
16349    }
16350
16351    impl std::fmt::Display for BatchOperationType {
16352        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16353            wkt::internal::display_enum(f, self.name(), self.value())
16354        }
16355    }
16356
16357    impl std::convert::From<i32> for BatchOperationType {
16358        fn from(value: i32) -> Self {
16359            match value {
16360                0 => Self::Unspecified,
16361                1 => Self::Batch,
16362                _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16363                    wkt::internal::UnknownEnumValue::Integer(value),
16364                )),
16365            }
16366        }
16367    }
16368
16369    impl std::convert::From<&str> for BatchOperationType {
16370        fn from(value: &str) -> Self {
16371            use std::string::ToString;
16372            match value {
16373                "BATCH_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16374                "BATCH" => Self::Batch,
16375                _ => Self::UnknownValue(batch_operation_type::UnknownValue(
16376                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16377                )),
16378            }
16379        }
16380    }
16381
16382    impl serde::ser::Serialize for BatchOperationType {
16383        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16384        where
16385            S: serde::Serializer,
16386        {
16387            match self {
16388                Self::Unspecified => serializer.serialize_i32(0),
16389                Self::Batch => serializer.serialize_i32(1),
16390                Self::UnknownValue(u) => u.0.serialize(serializer),
16391            }
16392        }
16393    }
16394
16395    impl<'de> serde::de::Deserialize<'de> for BatchOperationType {
16396        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16397        where
16398            D: serde::Deserializer<'de>,
16399        {
16400            deserializer.deserialize_any(wkt::internal::EnumVisitor::<BatchOperationType>::new(
16401                ".google.cloud.dataproc.v1.BatchOperationMetadata.BatchOperationType",
16402            ))
16403        }
16404    }
16405}
16406
16407/// Metadata describing the Session operation.
16408#[derive(Clone, Default, PartialEq)]
16409#[non_exhaustive]
16410pub struct SessionOperationMetadata {
16411    /// Name of the session for the operation.
16412    pub session: std::string::String,
16413
16414    /// Session UUID for the operation.
16415    pub session_uuid: std::string::String,
16416
16417    /// The time when the operation was created.
16418    pub create_time: std::option::Option<wkt::Timestamp>,
16419
16420    /// The time when the operation was finished.
16421    pub done_time: std::option::Option<wkt::Timestamp>,
16422
16423    /// The operation type.
16424    pub operation_type: crate::model::session_operation_metadata::SessionOperationType,
16425
16426    /// Short description of the operation.
16427    pub description: std::string::String,
16428
16429    /// Labels associated with the operation.
16430    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16431
16432    /// Warnings encountered during operation execution.
16433    pub warnings: std::vec::Vec<std::string::String>,
16434
16435    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16436}
16437
16438impl SessionOperationMetadata {
16439    pub fn new() -> Self {
16440        std::default::Default::default()
16441    }
16442
16443    /// Sets the value of [session][crate::model::SessionOperationMetadata::session].
16444    ///
16445    /// # Example
16446    /// ```ignore,no_run
16447    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16448    /// let x = SessionOperationMetadata::new().set_session("example");
16449    /// ```
16450    pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16451        self.session = v.into();
16452        self
16453    }
16454
16455    /// Sets the value of [session_uuid][crate::model::SessionOperationMetadata::session_uuid].
16456    ///
16457    /// # Example
16458    /// ```ignore,no_run
16459    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16460    /// let x = SessionOperationMetadata::new().set_session_uuid("example");
16461    /// ```
16462    pub fn set_session_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16463        self.session_uuid = v.into();
16464        self
16465    }
16466
16467    /// Sets the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16468    ///
16469    /// # Example
16470    /// ```ignore,no_run
16471    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16472    /// use wkt::Timestamp;
16473    /// let x = SessionOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16474    /// ```
16475    pub fn set_create_time<T>(mut self, v: T) -> Self
16476    where
16477        T: std::convert::Into<wkt::Timestamp>,
16478    {
16479        self.create_time = std::option::Option::Some(v.into());
16480        self
16481    }
16482
16483    /// Sets or clears the value of [create_time][crate::model::SessionOperationMetadata::create_time].
16484    ///
16485    /// # Example
16486    /// ```ignore,no_run
16487    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16488    /// use wkt::Timestamp;
16489    /// let x = SessionOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16490    /// let x = SessionOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16491    /// ```
16492    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16493    where
16494        T: std::convert::Into<wkt::Timestamp>,
16495    {
16496        self.create_time = v.map(|x| x.into());
16497        self
16498    }
16499
16500    /// Sets the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16501    ///
16502    /// # Example
16503    /// ```ignore,no_run
16504    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16505    /// use wkt::Timestamp;
16506    /// let x = SessionOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
16507    /// ```
16508    pub fn set_done_time<T>(mut self, v: T) -> Self
16509    where
16510        T: std::convert::Into<wkt::Timestamp>,
16511    {
16512        self.done_time = std::option::Option::Some(v.into());
16513        self
16514    }
16515
16516    /// Sets or clears the value of [done_time][crate::model::SessionOperationMetadata::done_time].
16517    ///
16518    /// # Example
16519    /// ```ignore,no_run
16520    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16521    /// use wkt::Timestamp;
16522    /// let x = SessionOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
16523    /// let x = SessionOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
16524    /// ```
16525    pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
16526    where
16527        T: std::convert::Into<wkt::Timestamp>,
16528    {
16529        self.done_time = v.map(|x| x.into());
16530        self
16531    }
16532
16533    /// Sets the value of [operation_type][crate::model::SessionOperationMetadata::operation_type].
16534    ///
16535    /// # Example
16536    /// ```ignore,no_run
16537    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16538    /// use google_cloud_dataproc_v1::model::session_operation_metadata::SessionOperationType;
16539    /// let x0 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Create);
16540    /// let x1 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Terminate);
16541    /// let x2 = SessionOperationMetadata::new().set_operation_type(SessionOperationType::Delete);
16542    /// ```
16543    pub fn set_operation_type<
16544        T: std::convert::Into<crate::model::session_operation_metadata::SessionOperationType>,
16545    >(
16546        mut self,
16547        v: T,
16548    ) -> Self {
16549        self.operation_type = v.into();
16550        self
16551    }
16552
16553    /// Sets the value of [description][crate::model::SessionOperationMetadata::description].
16554    ///
16555    /// # Example
16556    /// ```ignore,no_run
16557    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16558    /// let x = SessionOperationMetadata::new().set_description("example");
16559    /// ```
16560    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16561        self.description = v.into();
16562        self
16563    }
16564
16565    /// Sets the value of [labels][crate::model::SessionOperationMetadata::labels].
16566    ///
16567    /// # Example
16568    /// ```ignore,no_run
16569    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16570    /// let x = SessionOperationMetadata::new().set_labels([
16571    ///     ("key0", "abc"),
16572    ///     ("key1", "xyz"),
16573    /// ]);
16574    /// ```
16575    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16576    where
16577        T: std::iter::IntoIterator<Item = (K, V)>,
16578        K: std::convert::Into<std::string::String>,
16579        V: std::convert::Into<std::string::String>,
16580    {
16581        use std::iter::Iterator;
16582        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16583        self
16584    }
16585
16586    /// Sets the value of [warnings][crate::model::SessionOperationMetadata::warnings].
16587    ///
16588    /// # Example
16589    /// ```ignore,no_run
16590    /// # use google_cloud_dataproc_v1::model::SessionOperationMetadata;
16591    /// let x = SessionOperationMetadata::new().set_warnings(["a", "b", "c"]);
16592    /// ```
16593    pub fn set_warnings<T, V>(mut self, v: T) -> Self
16594    where
16595        T: std::iter::IntoIterator<Item = V>,
16596        V: std::convert::Into<std::string::String>,
16597    {
16598        use std::iter::Iterator;
16599        self.warnings = v.into_iter().map(|i| i.into()).collect();
16600        self
16601    }
16602}
16603
16604impl wkt::message::Message for SessionOperationMetadata {
16605    fn typename() -> &'static str {
16606        "type.googleapis.com/google.cloud.dataproc.v1.SessionOperationMetadata"
16607    }
16608}
16609
16610/// Defines additional types related to [SessionOperationMetadata].
16611pub mod session_operation_metadata {
16612    #[allow(unused_imports)]
16613    use super::*;
16614
16615    /// Operation type for Session resources
16616    ///
16617    /// # Working with unknown values
16618    ///
16619    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16620    /// additional enum variants at any time. Adding new variants is not considered
16621    /// a breaking change. Applications should write their code in anticipation of:
16622    ///
16623    /// - New values appearing in future releases of the client library, **and**
16624    /// - New values received dynamically, without application changes.
16625    ///
16626    /// Please consult the [Working with enums] section in the user guide for some
16627    /// guidelines.
16628    ///
16629    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16630    #[derive(Clone, Debug, PartialEq)]
16631    #[non_exhaustive]
16632    pub enum SessionOperationType {
16633        /// Session operation type is unknown.
16634        Unspecified,
16635        /// Create Session operation type.
16636        Create,
16637        /// Terminate Session operation type.
16638        Terminate,
16639        /// Delete Session operation type.
16640        Delete,
16641        /// If set, the enum was initialized with an unknown value.
16642        ///
16643        /// Applications can examine the value using [SessionOperationType::value] or
16644        /// [SessionOperationType::name].
16645        UnknownValue(session_operation_type::UnknownValue),
16646    }
16647
16648    #[doc(hidden)]
16649    pub mod session_operation_type {
16650        #[allow(unused_imports)]
16651        use super::*;
16652        #[derive(Clone, Debug, PartialEq)]
16653        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16654    }
16655
16656    impl SessionOperationType {
16657        /// Gets the enum value.
16658        ///
16659        /// Returns `None` if the enum contains an unknown value deserialized from
16660        /// the string representation of enums.
16661        pub fn value(&self) -> std::option::Option<i32> {
16662            match self {
16663                Self::Unspecified => std::option::Option::Some(0),
16664                Self::Create => std::option::Option::Some(1),
16665                Self::Terminate => std::option::Option::Some(2),
16666                Self::Delete => std::option::Option::Some(3),
16667                Self::UnknownValue(u) => u.0.value(),
16668            }
16669        }
16670
16671        /// Gets the enum value as a string.
16672        ///
16673        /// Returns `None` if the enum contains an unknown value deserialized from
16674        /// the integer representation of enums.
16675        pub fn name(&self) -> std::option::Option<&str> {
16676            match self {
16677                Self::Unspecified => {
16678                    std::option::Option::Some("SESSION_OPERATION_TYPE_UNSPECIFIED")
16679                }
16680                Self::Create => std::option::Option::Some("CREATE"),
16681                Self::Terminate => std::option::Option::Some("TERMINATE"),
16682                Self::Delete => std::option::Option::Some("DELETE"),
16683                Self::UnknownValue(u) => u.0.name(),
16684            }
16685        }
16686    }
16687
16688    impl std::default::Default for SessionOperationType {
16689        fn default() -> Self {
16690            use std::convert::From;
16691            Self::from(0)
16692        }
16693    }
16694
16695    impl std::fmt::Display for SessionOperationType {
16696        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16697            wkt::internal::display_enum(f, self.name(), self.value())
16698        }
16699    }
16700
16701    impl std::convert::From<i32> for SessionOperationType {
16702        fn from(value: i32) -> Self {
16703            match value {
16704                0 => Self::Unspecified,
16705                1 => Self::Create,
16706                2 => Self::Terminate,
16707                3 => Self::Delete,
16708                _ => Self::UnknownValue(session_operation_type::UnknownValue(
16709                    wkt::internal::UnknownEnumValue::Integer(value),
16710                )),
16711            }
16712        }
16713    }
16714
16715    impl std::convert::From<&str> for SessionOperationType {
16716        fn from(value: &str) -> Self {
16717            use std::string::ToString;
16718            match value {
16719                "SESSION_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
16720                "CREATE" => Self::Create,
16721                "TERMINATE" => Self::Terminate,
16722                "DELETE" => Self::Delete,
16723                _ => Self::UnknownValue(session_operation_type::UnknownValue(
16724                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16725                )),
16726            }
16727        }
16728    }
16729
16730    impl serde::ser::Serialize for SessionOperationType {
16731        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16732        where
16733            S: serde::Serializer,
16734        {
16735            match self {
16736                Self::Unspecified => serializer.serialize_i32(0),
16737                Self::Create => serializer.serialize_i32(1),
16738                Self::Terminate => serializer.serialize_i32(2),
16739                Self::Delete => serializer.serialize_i32(3),
16740                Self::UnknownValue(u) => u.0.serialize(serializer),
16741            }
16742        }
16743    }
16744
16745    impl<'de> serde::de::Deserialize<'de> for SessionOperationType {
16746        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16747        where
16748            D: serde::Deserializer<'de>,
16749        {
16750            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SessionOperationType>::new(
16751                ".google.cloud.dataproc.v1.SessionOperationMetadata.SessionOperationType",
16752            ))
16753        }
16754    }
16755}
16756
16757/// The status of the operation.
16758#[derive(Clone, Default, PartialEq)]
16759#[non_exhaustive]
16760pub struct ClusterOperationStatus {
16761    /// Output only. A message containing the operation state.
16762    pub state: crate::model::cluster_operation_status::State,
16763
16764    /// Output only. A message containing the detailed operation state.
16765    pub inner_state: std::string::String,
16766
16767    /// Output only. A message containing any operation metadata details.
16768    pub details: std::string::String,
16769
16770    /// Output only. The time this state was entered.
16771    pub state_start_time: std::option::Option<wkt::Timestamp>,
16772
16773    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16774}
16775
16776impl ClusterOperationStatus {
16777    pub fn new() -> Self {
16778        std::default::Default::default()
16779    }
16780
16781    /// Sets the value of [state][crate::model::ClusterOperationStatus::state].
16782    ///
16783    /// # Example
16784    /// ```ignore,no_run
16785    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16786    /// use google_cloud_dataproc_v1::model::cluster_operation_status::State;
16787    /// let x0 = ClusterOperationStatus::new().set_state(State::Pending);
16788    /// let x1 = ClusterOperationStatus::new().set_state(State::Running);
16789    /// let x2 = ClusterOperationStatus::new().set_state(State::Done);
16790    /// ```
16791    pub fn set_state<T: std::convert::Into<crate::model::cluster_operation_status::State>>(
16792        mut self,
16793        v: T,
16794    ) -> Self {
16795        self.state = v.into();
16796        self
16797    }
16798
16799    /// Sets the value of [inner_state][crate::model::ClusterOperationStatus::inner_state].
16800    ///
16801    /// # Example
16802    /// ```ignore,no_run
16803    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16804    /// let x = ClusterOperationStatus::new().set_inner_state("example");
16805    /// ```
16806    pub fn set_inner_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16807        self.inner_state = v.into();
16808        self
16809    }
16810
16811    /// Sets the value of [details][crate::model::ClusterOperationStatus::details].
16812    ///
16813    /// # Example
16814    /// ```ignore,no_run
16815    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16816    /// let x = ClusterOperationStatus::new().set_details("example");
16817    /// ```
16818    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16819        self.details = v.into();
16820        self
16821    }
16822
16823    /// Sets the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
16824    ///
16825    /// # Example
16826    /// ```ignore,no_run
16827    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16828    /// use wkt::Timestamp;
16829    /// let x = ClusterOperationStatus::new().set_state_start_time(Timestamp::default()/* use setters */);
16830    /// ```
16831    pub fn set_state_start_time<T>(mut self, v: T) -> Self
16832    where
16833        T: std::convert::Into<wkt::Timestamp>,
16834    {
16835        self.state_start_time = std::option::Option::Some(v.into());
16836        self
16837    }
16838
16839    /// Sets or clears the value of [state_start_time][crate::model::ClusterOperationStatus::state_start_time].
16840    ///
16841    /// # Example
16842    /// ```ignore,no_run
16843    /// # use google_cloud_dataproc_v1::model::ClusterOperationStatus;
16844    /// use wkt::Timestamp;
16845    /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
16846    /// let x = ClusterOperationStatus::new().set_or_clear_state_start_time(None::<Timestamp>);
16847    /// ```
16848    pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
16849    where
16850        T: std::convert::Into<wkt::Timestamp>,
16851    {
16852        self.state_start_time = v.map(|x| x.into());
16853        self
16854    }
16855}
16856
16857impl wkt::message::Message for ClusterOperationStatus {
16858    fn typename() -> &'static str {
16859        "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationStatus"
16860    }
16861}
16862
16863/// Defines additional types related to [ClusterOperationStatus].
16864pub mod cluster_operation_status {
16865    #[allow(unused_imports)]
16866    use super::*;
16867
16868    /// The operation state.
16869    ///
16870    /// # Working with unknown values
16871    ///
16872    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16873    /// additional enum variants at any time. Adding new variants is not considered
16874    /// a breaking change. Applications should write their code in anticipation of:
16875    ///
16876    /// - New values appearing in future releases of the client library, **and**
16877    /// - New values received dynamically, without application changes.
16878    ///
16879    /// Please consult the [Working with enums] section in the user guide for some
16880    /// guidelines.
16881    ///
16882    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16883    #[derive(Clone, Debug, PartialEq)]
16884    #[non_exhaustive]
16885    pub enum State {
16886        /// Unused.
16887        Unknown,
16888        /// The operation has been created.
16889        Pending,
16890        /// The operation is running.
16891        Running,
16892        /// The operation is done; either cancelled or completed.
16893        Done,
16894        /// If set, the enum was initialized with an unknown value.
16895        ///
16896        /// Applications can examine the value using [State::value] or
16897        /// [State::name].
16898        UnknownValue(state::UnknownValue),
16899    }
16900
16901    #[doc(hidden)]
16902    pub mod state {
16903        #[allow(unused_imports)]
16904        use super::*;
16905        #[derive(Clone, Debug, PartialEq)]
16906        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16907    }
16908
16909    impl State {
16910        /// Gets the enum value.
16911        ///
16912        /// Returns `None` if the enum contains an unknown value deserialized from
16913        /// the string representation of enums.
16914        pub fn value(&self) -> std::option::Option<i32> {
16915            match self {
16916                Self::Unknown => std::option::Option::Some(0),
16917                Self::Pending => std::option::Option::Some(1),
16918                Self::Running => std::option::Option::Some(2),
16919                Self::Done => std::option::Option::Some(3),
16920                Self::UnknownValue(u) => u.0.value(),
16921            }
16922        }
16923
16924        /// Gets the enum value as a string.
16925        ///
16926        /// Returns `None` if the enum contains an unknown value deserialized from
16927        /// the integer representation of enums.
16928        pub fn name(&self) -> std::option::Option<&str> {
16929            match self {
16930                Self::Unknown => std::option::Option::Some("UNKNOWN"),
16931                Self::Pending => std::option::Option::Some("PENDING"),
16932                Self::Running => std::option::Option::Some("RUNNING"),
16933                Self::Done => std::option::Option::Some("DONE"),
16934                Self::UnknownValue(u) => u.0.name(),
16935            }
16936        }
16937    }
16938
16939    impl std::default::Default for State {
16940        fn default() -> Self {
16941            use std::convert::From;
16942            Self::from(0)
16943        }
16944    }
16945
16946    impl std::fmt::Display for State {
16947        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16948            wkt::internal::display_enum(f, self.name(), self.value())
16949        }
16950    }
16951
16952    impl std::convert::From<i32> for State {
16953        fn from(value: i32) -> Self {
16954            match value {
16955                0 => Self::Unknown,
16956                1 => Self::Pending,
16957                2 => Self::Running,
16958                3 => Self::Done,
16959                _ => Self::UnknownValue(state::UnknownValue(
16960                    wkt::internal::UnknownEnumValue::Integer(value),
16961                )),
16962            }
16963        }
16964    }
16965
16966    impl std::convert::From<&str> for State {
16967        fn from(value: &str) -> Self {
16968            use std::string::ToString;
16969            match value {
16970                "UNKNOWN" => Self::Unknown,
16971                "PENDING" => Self::Pending,
16972                "RUNNING" => Self::Running,
16973                "DONE" => Self::Done,
16974                _ => Self::UnknownValue(state::UnknownValue(
16975                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16976                )),
16977            }
16978        }
16979    }
16980
16981    impl serde::ser::Serialize for State {
16982        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16983        where
16984            S: serde::Serializer,
16985        {
16986            match self {
16987                Self::Unknown => serializer.serialize_i32(0),
16988                Self::Pending => serializer.serialize_i32(1),
16989                Self::Running => serializer.serialize_i32(2),
16990                Self::Done => serializer.serialize_i32(3),
16991                Self::UnknownValue(u) => u.0.serialize(serializer),
16992            }
16993        }
16994    }
16995
16996    impl<'de> serde::de::Deserialize<'de> for State {
16997        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16998        where
16999            D: serde::Deserializer<'de>,
17000        {
17001            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17002                ".google.cloud.dataproc.v1.ClusterOperationStatus.State",
17003            ))
17004        }
17005    }
17006}
17007
17008/// Metadata describing the operation.
17009#[derive(Clone, Default, PartialEq)]
17010#[non_exhaustive]
17011pub struct ClusterOperationMetadata {
17012    /// Output only. Name of the cluster for the operation.
17013    pub cluster_name: std::string::String,
17014
17015    /// Output only. Cluster UUID for the operation.
17016    pub cluster_uuid: std::string::String,
17017
17018    /// Output only. Current operation status.
17019    pub status: std::option::Option<crate::model::ClusterOperationStatus>,
17020
17021    /// Output only. The previous operation status.
17022    pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
17023
17024    /// Output only. The operation type.
17025    pub operation_type: std::string::String,
17026
17027    /// Output only. Short description of operation.
17028    pub description: std::string::String,
17029
17030    /// Output only. Labels associated with the operation
17031    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17032
17033    /// Output only. Errors encountered during operation execution.
17034    pub warnings: std::vec::Vec<std::string::String>,
17035
17036    /// Output only. Child operation ids
17037    pub child_operation_ids: std::vec::Vec<std::string::String>,
17038
17039    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17040}
17041
17042impl ClusterOperationMetadata {
17043    pub fn new() -> Self {
17044        std::default::Default::default()
17045    }
17046
17047    /// Sets the value of [cluster_name][crate::model::ClusterOperationMetadata::cluster_name].
17048    ///
17049    /// # Example
17050    /// ```ignore,no_run
17051    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17052    /// let x = ClusterOperationMetadata::new().set_cluster_name("example");
17053    /// ```
17054    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17055        self.cluster_name = v.into();
17056        self
17057    }
17058
17059    /// Sets the value of [cluster_uuid][crate::model::ClusterOperationMetadata::cluster_uuid].
17060    ///
17061    /// # Example
17062    /// ```ignore,no_run
17063    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17064    /// let x = ClusterOperationMetadata::new().set_cluster_uuid("example");
17065    /// ```
17066    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17067        self.cluster_uuid = v.into();
17068        self
17069    }
17070
17071    /// Sets the value of [status][crate::model::ClusterOperationMetadata::status].
17072    ///
17073    /// # Example
17074    /// ```ignore,no_run
17075    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17076    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17077    /// let x = ClusterOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
17078    /// ```
17079    pub fn set_status<T>(mut self, v: T) -> Self
17080    where
17081        T: std::convert::Into<crate::model::ClusterOperationStatus>,
17082    {
17083        self.status = std::option::Option::Some(v.into());
17084        self
17085    }
17086
17087    /// Sets or clears the value of [status][crate::model::ClusterOperationMetadata::status].
17088    ///
17089    /// # Example
17090    /// ```ignore,no_run
17091    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17092    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17093    /// let x = ClusterOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
17094    /// let x = ClusterOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
17095    /// ```
17096    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
17097    where
17098        T: std::convert::Into<crate::model::ClusterOperationStatus>,
17099    {
17100        self.status = v.map(|x| x.into());
17101        self
17102    }
17103
17104    /// Sets the value of [status_history][crate::model::ClusterOperationMetadata::status_history].
17105    ///
17106    /// # Example
17107    /// ```ignore,no_run
17108    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17109    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17110    /// let x = ClusterOperationMetadata::new()
17111    ///     .set_status_history([
17112    ///         ClusterOperationStatus::default()/* use setters */,
17113    ///         ClusterOperationStatus::default()/* use (different) setters */,
17114    ///     ]);
17115    /// ```
17116    pub fn set_status_history<T, V>(mut self, v: T) -> Self
17117    where
17118        T: std::iter::IntoIterator<Item = V>,
17119        V: std::convert::Into<crate::model::ClusterOperationStatus>,
17120    {
17121        use std::iter::Iterator;
17122        self.status_history = v.into_iter().map(|i| i.into()).collect();
17123        self
17124    }
17125
17126    /// Sets the value of [operation_type][crate::model::ClusterOperationMetadata::operation_type].
17127    ///
17128    /// # Example
17129    /// ```ignore,no_run
17130    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17131    /// let x = ClusterOperationMetadata::new().set_operation_type("example");
17132    /// ```
17133    pub fn set_operation_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17134        self.operation_type = v.into();
17135        self
17136    }
17137
17138    /// Sets the value of [description][crate::model::ClusterOperationMetadata::description].
17139    ///
17140    /// # Example
17141    /// ```ignore,no_run
17142    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17143    /// let x = ClusterOperationMetadata::new().set_description("example");
17144    /// ```
17145    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17146        self.description = v.into();
17147        self
17148    }
17149
17150    /// Sets the value of [labels][crate::model::ClusterOperationMetadata::labels].
17151    ///
17152    /// # Example
17153    /// ```ignore,no_run
17154    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17155    /// let x = ClusterOperationMetadata::new().set_labels([
17156    ///     ("key0", "abc"),
17157    ///     ("key1", "xyz"),
17158    /// ]);
17159    /// ```
17160    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17161    where
17162        T: std::iter::IntoIterator<Item = (K, V)>,
17163        K: std::convert::Into<std::string::String>,
17164        V: std::convert::Into<std::string::String>,
17165    {
17166        use std::iter::Iterator;
17167        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17168        self
17169    }
17170
17171    /// Sets the value of [warnings][crate::model::ClusterOperationMetadata::warnings].
17172    ///
17173    /// # Example
17174    /// ```ignore,no_run
17175    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17176    /// let x = ClusterOperationMetadata::new().set_warnings(["a", "b", "c"]);
17177    /// ```
17178    pub fn set_warnings<T, V>(mut self, v: T) -> Self
17179    where
17180        T: std::iter::IntoIterator<Item = V>,
17181        V: std::convert::Into<std::string::String>,
17182    {
17183        use std::iter::Iterator;
17184        self.warnings = v.into_iter().map(|i| i.into()).collect();
17185        self
17186    }
17187
17188    /// Sets the value of [child_operation_ids][crate::model::ClusterOperationMetadata::child_operation_ids].
17189    ///
17190    /// # Example
17191    /// ```ignore,no_run
17192    /// # use google_cloud_dataproc_v1::model::ClusterOperationMetadata;
17193    /// let x = ClusterOperationMetadata::new().set_child_operation_ids(["a", "b", "c"]);
17194    /// ```
17195    pub fn set_child_operation_ids<T, V>(mut self, v: T) -> Self
17196    where
17197        T: std::iter::IntoIterator<Item = V>,
17198        V: std::convert::Into<std::string::String>,
17199    {
17200        use std::iter::Iterator;
17201        self.child_operation_ids = v.into_iter().map(|i| i.into()).collect();
17202        self
17203    }
17204}
17205
17206impl wkt::message::Message for ClusterOperationMetadata {
17207    fn typename() -> &'static str {
17208        "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperationMetadata"
17209    }
17210}
17211
17212/// Metadata describing the node group operation.
17213#[derive(Clone, Default, PartialEq)]
17214#[non_exhaustive]
17215pub struct NodeGroupOperationMetadata {
17216    /// Output only. Node group ID for the operation.
17217    pub node_group_id: std::string::String,
17218
17219    /// Output only. Cluster UUID associated with the node group operation.
17220    pub cluster_uuid: std::string::String,
17221
17222    /// Output only. Current operation status.
17223    pub status: std::option::Option<crate::model::ClusterOperationStatus>,
17224
17225    /// Output only. The previous operation status.
17226    pub status_history: std::vec::Vec<crate::model::ClusterOperationStatus>,
17227
17228    /// The operation type.
17229    pub operation_type: crate::model::node_group_operation_metadata::NodeGroupOperationType,
17230
17231    /// Output only. Short description of operation.
17232    pub description: std::string::String,
17233
17234    /// Output only. Labels associated with the operation.
17235    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17236
17237    /// Output only. Errors encountered during operation execution.
17238    pub warnings: std::vec::Vec<std::string::String>,
17239
17240    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17241}
17242
17243impl NodeGroupOperationMetadata {
17244    pub fn new() -> Self {
17245        std::default::Default::default()
17246    }
17247
17248    /// Sets the value of [node_group_id][crate::model::NodeGroupOperationMetadata::node_group_id].
17249    ///
17250    /// # Example
17251    /// ```ignore,no_run
17252    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17253    /// let x = NodeGroupOperationMetadata::new().set_node_group_id("example");
17254    /// ```
17255    pub fn set_node_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17256        self.node_group_id = v.into();
17257        self
17258    }
17259
17260    /// Sets the value of [cluster_uuid][crate::model::NodeGroupOperationMetadata::cluster_uuid].
17261    ///
17262    /// # Example
17263    /// ```ignore,no_run
17264    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17265    /// let x = NodeGroupOperationMetadata::new().set_cluster_uuid("example");
17266    /// ```
17267    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17268        self.cluster_uuid = v.into();
17269        self
17270    }
17271
17272    /// Sets the value of [status][crate::model::NodeGroupOperationMetadata::status].
17273    ///
17274    /// # Example
17275    /// ```ignore,no_run
17276    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17277    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17278    /// let x = NodeGroupOperationMetadata::new().set_status(ClusterOperationStatus::default()/* use setters */);
17279    /// ```
17280    pub fn set_status<T>(mut self, v: T) -> Self
17281    where
17282        T: std::convert::Into<crate::model::ClusterOperationStatus>,
17283    {
17284        self.status = std::option::Option::Some(v.into());
17285        self
17286    }
17287
17288    /// Sets or clears the value of [status][crate::model::NodeGroupOperationMetadata::status].
17289    ///
17290    /// # Example
17291    /// ```ignore,no_run
17292    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17293    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17294    /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(Some(ClusterOperationStatus::default()/* use setters */));
17295    /// let x = NodeGroupOperationMetadata::new().set_or_clear_status(None::<ClusterOperationStatus>);
17296    /// ```
17297    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
17298    where
17299        T: std::convert::Into<crate::model::ClusterOperationStatus>,
17300    {
17301        self.status = v.map(|x| x.into());
17302        self
17303    }
17304
17305    /// Sets the value of [status_history][crate::model::NodeGroupOperationMetadata::status_history].
17306    ///
17307    /// # Example
17308    /// ```ignore,no_run
17309    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17310    /// use google_cloud_dataproc_v1::model::ClusterOperationStatus;
17311    /// let x = NodeGroupOperationMetadata::new()
17312    ///     .set_status_history([
17313    ///         ClusterOperationStatus::default()/* use setters */,
17314    ///         ClusterOperationStatus::default()/* use (different) setters */,
17315    ///     ]);
17316    /// ```
17317    pub fn set_status_history<T, V>(mut self, v: T) -> Self
17318    where
17319        T: std::iter::IntoIterator<Item = V>,
17320        V: std::convert::Into<crate::model::ClusterOperationStatus>,
17321    {
17322        use std::iter::Iterator;
17323        self.status_history = v.into_iter().map(|i| i.into()).collect();
17324        self
17325    }
17326
17327    /// Sets the value of [operation_type][crate::model::NodeGroupOperationMetadata::operation_type].
17328    ///
17329    /// # Example
17330    /// ```ignore,no_run
17331    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17332    /// use google_cloud_dataproc_v1::model::node_group_operation_metadata::NodeGroupOperationType;
17333    /// let x0 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Create);
17334    /// let x1 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Update);
17335    /// let x2 = NodeGroupOperationMetadata::new().set_operation_type(NodeGroupOperationType::Delete);
17336    /// ```
17337    pub fn set_operation_type<
17338        T: std::convert::Into<crate::model::node_group_operation_metadata::NodeGroupOperationType>,
17339    >(
17340        mut self,
17341        v: T,
17342    ) -> Self {
17343        self.operation_type = v.into();
17344        self
17345    }
17346
17347    /// Sets the value of [description][crate::model::NodeGroupOperationMetadata::description].
17348    ///
17349    /// # Example
17350    /// ```ignore,no_run
17351    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17352    /// let x = NodeGroupOperationMetadata::new().set_description("example");
17353    /// ```
17354    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17355        self.description = v.into();
17356        self
17357    }
17358
17359    /// Sets the value of [labels][crate::model::NodeGroupOperationMetadata::labels].
17360    ///
17361    /// # Example
17362    /// ```ignore,no_run
17363    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17364    /// let x = NodeGroupOperationMetadata::new().set_labels([
17365    ///     ("key0", "abc"),
17366    ///     ("key1", "xyz"),
17367    /// ]);
17368    /// ```
17369    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17370    where
17371        T: std::iter::IntoIterator<Item = (K, V)>,
17372        K: std::convert::Into<std::string::String>,
17373        V: std::convert::Into<std::string::String>,
17374    {
17375        use std::iter::Iterator;
17376        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17377        self
17378    }
17379
17380    /// Sets the value of [warnings][crate::model::NodeGroupOperationMetadata::warnings].
17381    ///
17382    /// # Example
17383    /// ```ignore,no_run
17384    /// # use google_cloud_dataproc_v1::model::NodeGroupOperationMetadata;
17385    /// let x = NodeGroupOperationMetadata::new().set_warnings(["a", "b", "c"]);
17386    /// ```
17387    pub fn set_warnings<T, V>(mut self, v: T) -> Self
17388    where
17389        T: std::iter::IntoIterator<Item = V>,
17390        V: std::convert::Into<std::string::String>,
17391    {
17392        use std::iter::Iterator;
17393        self.warnings = v.into_iter().map(|i| i.into()).collect();
17394        self
17395    }
17396}
17397
17398impl wkt::message::Message for NodeGroupOperationMetadata {
17399    fn typename() -> &'static str {
17400        "type.googleapis.com/google.cloud.dataproc.v1.NodeGroupOperationMetadata"
17401    }
17402}
17403
17404/// Defines additional types related to [NodeGroupOperationMetadata].
17405pub mod node_group_operation_metadata {
17406    #[allow(unused_imports)]
17407    use super::*;
17408
17409    /// Operation type for node group resources.
17410    ///
17411    /// # Working with unknown values
17412    ///
17413    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17414    /// additional enum variants at any time. Adding new variants is not considered
17415    /// a breaking change. Applications should write their code in anticipation of:
17416    ///
17417    /// - New values appearing in future releases of the client library, **and**
17418    /// - New values received dynamically, without application changes.
17419    ///
17420    /// Please consult the [Working with enums] section in the user guide for some
17421    /// guidelines.
17422    ///
17423    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17424    #[derive(Clone, Debug, PartialEq)]
17425    #[non_exhaustive]
17426    pub enum NodeGroupOperationType {
17427        /// Node group operation type is unknown.
17428        Unspecified,
17429        /// Create node group operation type.
17430        Create,
17431        /// Update node group operation type.
17432        Update,
17433        /// Delete node group operation type.
17434        Delete,
17435        /// Resize node group operation type.
17436        Resize,
17437        /// If set, the enum was initialized with an unknown value.
17438        ///
17439        /// Applications can examine the value using [NodeGroupOperationType::value] or
17440        /// [NodeGroupOperationType::name].
17441        UnknownValue(node_group_operation_type::UnknownValue),
17442    }
17443
17444    #[doc(hidden)]
17445    pub mod node_group_operation_type {
17446        #[allow(unused_imports)]
17447        use super::*;
17448        #[derive(Clone, Debug, PartialEq)]
17449        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17450    }
17451
17452    impl NodeGroupOperationType {
17453        /// Gets the enum value.
17454        ///
17455        /// Returns `None` if the enum contains an unknown value deserialized from
17456        /// the string representation of enums.
17457        pub fn value(&self) -> std::option::Option<i32> {
17458            match self {
17459                Self::Unspecified => std::option::Option::Some(0),
17460                Self::Create => std::option::Option::Some(1),
17461                Self::Update => std::option::Option::Some(2),
17462                Self::Delete => std::option::Option::Some(3),
17463                Self::Resize => std::option::Option::Some(4),
17464                Self::UnknownValue(u) => u.0.value(),
17465            }
17466        }
17467
17468        /// Gets the enum value as a string.
17469        ///
17470        /// Returns `None` if the enum contains an unknown value deserialized from
17471        /// the integer representation of enums.
17472        pub fn name(&self) -> std::option::Option<&str> {
17473            match self {
17474                Self::Unspecified => {
17475                    std::option::Option::Some("NODE_GROUP_OPERATION_TYPE_UNSPECIFIED")
17476                }
17477                Self::Create => std::option::Option::Some("CREATE"),
17478                Self::Update => std::option::Option::Some("UPDATE"),
17479                Self::Delete => std::option::Option::Some("DELETE"),
17480                Self::Resize => std::option::Option::Some("RESIZE"),
17481                Self::UnknownValue(u) => u.0.name(),
17482            }
17483        }
17484    }
17485
17486    impl std::default::Default for NodeGroupOperationType {
17487        fn default() -> Self {
17488            use std::convert::From;
17489            Self::from(0)
17490        }
17491    }
17492
17493    impl std::fmt::Display for NodeGroupOperationType {
17494        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17495            wkt::internal::display_enum(f, self.name(), self.value())
17496        }
17497    }
17498
17499    impl std::convert::From<i32> for NodeGroupOperationType {
17500        fn from(value: i32) -> Self {
17501            match value {
17502                0 => Self::Unspecified,
17503                1 => Self::Create,
17504                2 => Self::Update,
17505                3 => Self::Delete,
17506                4 => Self::Resize,
17507                _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17508                    wkt::internal::UnknownEnumValue::Integer(value),
17509                )),
17510            }
17511        }
17512    }
17513
17514    impl std::convert::From<&str> for NodeGroupOperationType {
17515        fn from(value: &str) -> Self {
17516            use std::string::ToString;
17517            match value {
17518                "NODE_GROUP_OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17519                "CREATE" => Self::Create,
17520                "UPDATE" => Self::Update,
17521                "DELETE" => Self::Delete,
17522                "RESIZE" => Self::Resize,
17523                _ => Self::UnknownValue(node_group_operation_type::UnknownValue(
17524                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17525                )),
17526            }
17527        }
17528    }
17529
17530    impl serde::ser::Serialize for NodeGroupOperationType {
17531        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17532        where
17533            S: serde::Serializer,
17534        {
17535            match self {
17536                Self::Unspecified => serializer.serialize_i32(0),
17537                Self::Create => serializer.serialize_i32(1),
17538                Self::Update => serializer.serialize_i32(2),
17539                Self::Delete => serializer.serialize_i32(3),
17540                Self::Resize => serializer.serialize_i32(4),
17541                Self::UnknownValue(u) => u.0.serialize(serializer),
17542            }
17543        }
17544    }
17545
17546    impl<'de> serde::de::Deserialize<'de> for NodeGroupOperationType {
17547        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17548        where
17549            D: serde::Deserializer<'de>,
17550        {
17551            deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeGroupOperationType>::new(
17552                ".google.cloud.dataproc.v1.NodeGroupOperationMetadata.NodeGroupOperationType",
17553            ))
17554        }
17555    }
17556}
17557
17558/// A request to create a session template.
17559#[derive(Clone, Default, PartialEq)]
17560#[non_exhaustive]
17561pub struct CreateSessionTemplateRequest {
17562    /// Required. The parent resource where this session template will be created.
17563    pub parent: std::string::String,
17564
17565    /// Required. The session template to create.
17566    pub session_template: std::option::Option<crate::model::SessionTemplate>,
17567
17568    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17569}
17570
17571impl CreateSessionTemplateRequest {
17572    pub fn new() -> Self {
17573        std::default::Default::default()
17574    }
17575
17576    /// Sets the value of [parent][crate::model::CreateSessionTemplateRequest::parent].
17577    ///
17578    /// # Example
17579    /// ```ignore,no_run
17580    /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17581    /// let x = CreateSessionTemplateRequest::new().set_parent("example");
17582    /// ```
17583    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17584        self.parent = v.into();
17585        self
17586    }
17587
17588    /// Sets the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
17589    ///
17590    /// # Example
17591    /// ```ignore,no_run
17592    /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17593    /// use google_cloud_dataproc_v1::model::SessionTemplate;
17594    /// let x = CreateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
17595    /// ```
17596    pub fn set_session_template<T>(mut self, v: T) -> Self
17597    where
17598        T: std::convert::Into<crate::model::SessionTemplate>,
17599    {
17600        self.session_template = std::option::Option::Some(v.into());
17601        self
17602    }
17603
17604    /// Sets or clears the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
17605    ///
17606    /// # Example
17607    /// ```ignore,no_run
17608    /// # use google_cloud_dataproc_v1::model::CreateSessionTemplateRequest;
17609    /// use google_cloud_dataproc_v1::model::SessionTemplate;
17610    /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
17611    /// let x = CreateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
17612    /// ```
17613    pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
17614    where
17615        T: std::convert::Into<crate::model::SessionTemplate>,
17616    {
17617        self.session_template = v.map(|x| x.into());
17618        self
17619    }
17620}
17621
17622impl wkt::message::Message for CreateSessionTemplateRequest {
17623    fn typename() -> &'static str {
17624        "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionTemplateRequest"
17625    }
17626}
17627
17628/// A request to update a session template.
17629#[derive(Clone, Default, PartialEq)]
17630#[non_exhaustive]
17631pub struct UpdateSessionTemplateRequest {
17632    /// Required. The updated session template.
17633    pub session_template: std::option::Option<crate::model::SessionTemplate>,
17634
17635    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17636}
17637
17638impl UpdateSessionTemplateRequest {
17639    pub fn new() -> Self {
17640        std::default::Default::default()
17641    }
17642
17643    /// Sets the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
17644    ///
17645    /// # Example
17646    /// ```ignore,no_run
17647    /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
17648    /// use google_cloud_dataproc_v1::model::SessionTemplate;
17649    /// let x = UpdateSessionTemplateRequest::new().set_session_template(SessionTemplate::default()/* use setters */);
17650    /// ```
17651    pub fn set_session_template<T>(mut self, v: T) -> Self
17652    where
17653        T: std::convert::Into<crate::model::SessionTemplate>,
17654    {
17655        self.session_template = std::option::Option::Some(v.into());
17656        self
17657    }
17658
17659    /// Sets or clears the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
17660    ///
17661    /// # Example
17662    /// ```ignore,no_run
17663    /// # use google_cloud_dataproc_v1::model::UpdateSessionTemplateRequest;
17664    /// use google_cloud_dataproc_v1::model::SessionTemplate;
17665    /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(Some(SessionTemplate::default()/* use setters */));
17666    /// let x = UpdateSessionTemplateRequest::new().set_or_clear_session_template(None::<SessionTemplate>);
17667    /// ```
17668    pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
17669    where
17670        T: std::convert::Into<crate::model::SessionTemplate>,
17671    {
17672        self.session_template = v.map(|x| x.into());
17673        self
17674    }
17675}
17676
17677impl wkt::message::Message for UpdateSessionTemplateRequest {
17678    fn typename() -> &'static str {
17679        "type.googleapis.com/google.cloud.dataproc.v1.UpdateSessionTemplateRequest"
17680    }
17681}
17682
17683/// A request to get the resource representation for a session template.
17684#[derive(Clone, Default, PartialEq)]
17685#[non_exhaustive]
17686pub struct GetSessionTemplateRequest {
17687    /// Required. The name of the session template to retrieve.
17688    pub name: std::string::String,
17689
17690    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17691}
17692
17693impl GetSessionTemplateRequest {
17694    pub fn new() -> Self {
17695        std::default::Default::default()
17696    }
17697
17698    /// Sets the value of [name][crate::model::GetSessionTemplateRequest::name].
17699    ///
17700    /// # Example
17701    /// ```ignore,no_run
17702    /// # use google_cloud_dataproc_v1::model::GetSessionTemplateRequest;
17703    /// let x = GetSessionTemplateRequest::new().set_name("example");
17704    /// ```
17705    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17706        self.name = v.into();
17707        self
17708    }
17709}
17710
17711impl wkt::message::Message for GetSessionTemplateRequest {
17712    fn typename() -> &'static str {
17713        "type.googleapis.com/google.cloud.dataproc.v1.GetSessionTemplateRequest"
17714    }
17715}
17716
17717/// A request to list session templates in a project.
17718#[derive(Clone, Default, PartialEq)]
17719#[non_exhaustive]
17720pub struct ListSessionTemplatesRequest {
17721    /// Required. The parent that owns this collection of session templates.
17722    pub parent: std::string::String,
17723
17724    /// Optional. The maximum number of sessions to return in each response.
17725    /// The service may return fewer than this value.
17726    pub page_size: i32,
17727
17728    /// Optional. A page token received from a previous `ListSessions` call.
17729    /// Provide this token to retrieve the subsequent page.
17730    pub page_token: std::string::String,
17731
17732    /// Optional. A filter for the session templates to return in the response.
17733    /// Filters are case sensitive and have the following syntax:
17734    ///
17735    /// [field = value] AND [field [= value]] ...
17736    pub filter: std::string::String,
17737
17738    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17739}
17740
17741impl ListSessionTemplatesRequest {
17742    pub fn new() -> Self {
17743        std::default::Default::default()
17744    }
17745
17746    /// Sets the value of [parent][crate::model::ListSessionTemplatesRequest::parent].
17747    ///
17748    /// # Example
17749    /// ```ignore,no_run
17750    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17751    /// let x = ListSessionTemplatesRequest::new().set_parent("example");
17752    /// ```
17753    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17754        self.parent = v.into();
17755        self
17756    }
17757
17758    /// Sets the value of [page_size][crate::model::ListSessionTemplatesRequest::page_size].
17759    ///
17760    /// # Example
17761    /// ```ignore,no_run
17762    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17763    /// let x = ListSessionTemplatesRequest::new().set_page_size(42);
17764    /// ```
17765    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17766        self.page_size = v.into();
17767        self
17768    }
17769
17770    /// Sets the value of [page_token][crate::model::ListSessionTemplatesRequest::page_token].
17771    ///
17772    /// # Example
17773    /// ```ignore,no_run
17774    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17775    /// let x = ListSessionTemplatesRequest::new().set_page_token("example");
17776    /// ```
17777    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17778        self.page_token = v.into();
17779        self
17780    }
17781
17782    /// Sets the value of [filter][crate::model::ListSessionTemplatesRequest::filter].
17783    ///
17784    /// # Example
17785    /// ```ignore,no_run
17786    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesRequest;
17787    /// let x = ListSessionTemplatesRequest::new().set_filter("example");
17788    /// ```
17789    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17790        self.filter = v.into();
17791        self
17792    }
17793}
17794
17795impl wkt::message::Message for ListSessionTemplatesRequest {
17796    fn typename() -> &'static str {
17797        "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesRequest"
17798    }
17799}
17800
17801/// A list of session templates.
17802#[derive(Clone, Default, PartialEq)]
17803#[non_exhaustive]
17804pub struct ListSessionTemplatesResponse {
17805    /// Output only. Session template list
17806    pub session_templates: std::vec::Vec<crate::model::SessionTemplate>,
17807
17808    /// A token, which can be sent as `page_token` to retrieve the next page.
17809    /// If this field is omitted, there are no subsequent pages.
17810    pub next_page_token: std::string::String,
17811
17812    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17813}
17814
17815impl ListSessionTemplatesResponse {
17816    pub fn new() -> Self {
17817        std::default::Default::default()
17818    }
17819
17820    /// Sets the value of [session_templates][crate::model::ListSessionTemplatesResponse::session_templates].
17821    ///
17822    /// # Example
17823    /// ```ignore,no_run
17824    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
17825    /// use google_cloud_dataproc_v1::model::SessionTemplate;
17826    /// let x = ListSessionTemplatesResponse::new()
17827    ///     .set_session_templates([
17828    ///         SessionTemplate::default()/* use setters */,
17829    ///         SessionTemplate::default()/* use (different) setters */,
17830    ///     ]);
17831    /// ```
17832    pub fn set_session_templates<T, V>(mut self, v: T) -> Self
17833    where
17834        T: std::iter::IntoIterator<Item = V>,
17835        V: std::convert::Into<crate::model::SessionTemplate>,
17836    {
17837        use std::iter::Iterator;
17838        self.session_templates = v.into_iter().map(|i| i.into()).collect();
17839        self
17840    }
17841
17842    /// Sets the value of [next_page_token][crate::model::ListSessionTemplatesResponse::next_page_token].
17843    ///
17844    /// # Example
17845    /// ```ignore,no_run
17846    /// # use google_cloud_dataproc_v1::model::ListSessionTemplatesResponse;
17847    /// let x = ListSessionTemplatesResponse::new().set_next_page_token("example");
17848    /// ```
17849    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17850        self.next_page_token = v.into();
17851        self
17852    }
17853}
17854
17855impl wkt::message::Message for ListSessionTemplatesResponse {
17856    fn typename() -> &'static str {
17857        "type.googleapis.com/google.cloud.dataproc.v1.ListSessionTemplatesResponse"
17858    }
17859}
17860
17861#[doc(hidden)]
17862impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionTemplatesResponse {
17863    type PageItem = crate::model::SessionTemplate;
17864
17865    fn items(self) -> std::vec::Vec<Self::PageItem> {
17866        self.session_templates
17867    }
17868
17869    fn next_page_token(&self) -> std::string::String {
17870        use std::clone::Clone;
17871        self.next_page_token.clone()
17872    }
17873}
17874
17875/// A request to delete a session template.
17876#[derive(Clone, Default, PartialEq)]
17877#[non_exhaustive]
17878pub struct DeleteSessionTemplateRequest {
17879    /// Required. The name of the session template resource to delete.
17880    pub name: std::string::String,
17881
17882    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17883}
17884
17885impl DeleteSessionTemplateRequest {
17886    pub fn new() -> Self {
17887        std::default::Default::default()
17888    }
17889
17890    /// Sets the value of [name][crate::model::DeleteSessionTemplateRequest::name].
17891    ///
17892    /// # Example
17893    /// ```ignore,no_run
17894    /// # use google_cloud_dataproc_v1::model::DeleteSessionTemplateRequest;
17895    /// let x = DeleteSessionTemplateRequest::new().set_name("example");
17896    /// ```
17897    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17898        self.name = v.into();
17899        self
17900    }
17901}
17902
17903impl wkt::message::Message for DeleteSessionTemplateRequest {
17904    fn typename() -> &'static str {
17905        "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionTemplateRequest"
17906    }
17907}
17908
17909/// A representation of a session template.
17910#[derive(Clone, Default, PartialEq)]
17911#[non_exhaustive]
17912pub struct SessionTemplate {
17913    /// Required. The resource name of the session template.
17914    pub name: std::string::String,
17915
17916    /// Optional. Brief description of the template.
17917    pub description: std::string::String,
17918
17919    /// Output only. The time when the template was created.
17920    pub create_time: std::option::Option<wkt::Timestamp>,
17921
17922    /// Output only. The email address of the user who created the template.
17923    pub creator: std::string::String,
17924
17925    /// Optional. Labels to associate with sessions created using this template.
17926    /// Label **keys** must contain 1 to 63 characters, and must conform to
17927    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
17928    /// Label **values** can be empty, but, if present, must contain 1 to 63
17929    /// characters and conform to [RFC
17930    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
17931    /// associated with a session.
17932    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17933
17934    /// Optional. Runtime configuration for session execution.
17935    pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
17936
17937    /// Optional. Environment configuration for session execution.
17938    pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
17939
17940    /// Output only. The time the template was last updated.
17941    pub update_time: std::option::Option<wkt::Timestamp>,
17942
17943    /// Output only. A session template UUID (Unique Universal Identifier). The
17944    /// service generates this value when it creates the session template.
17945    pub uuid: std::string::String,
17946
17947    /// The session configuration.
17948    pub session_config: std::option::Option<crate::model::session_template::SessionConfig>,
17949
17950    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17951}
17952
17953impl SessionTemplate {
17954    pub fn new() -> Self {
17955        std::default::Default::default()
17956    }
17957
17958    /// Sets the value of [name][crate::model::SessionTemplate::name].
17959    ///
17960    /// # Example
17961    /// ```ignore,no_run
17962    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17963    /// let x = SessionTemplate::new().set_name("example");
17964    /// ```
17965    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17966        self.name = v.into();
17967        self
17968    }
17969
17970    /// Sets the value of [description][crate::model::SessionTemplate::description].
17971    ///
17972    /// # Example
17973    /// ```ignore,no_run
17974    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17975    /// let x = SessionTemplate::new().set_description("example");
17976    /// ```
17977    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17978        self.description = v.into();
17979        self
17980    }
17981
17982    /// Sets the value of [create_time][crate::model::SessionTemplate::create_time].
17983    ///
17984    /// # Example
17985    /// ```ignore,no_run
17986    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
17987    /// use wkt::Timestamp;
17988    /// let x = SessionTemplate::new().set_create_time(Timestamp::default()/* use setters */);
17989    /// ```
17990    pub fn set_create_time<T>(mut self, v: T) -> Self
17991    where
17992        T: std::convert::Into<wkt::Timestamp>,
17993    {
17994        self.create_time = std::option::Option::Some(v.into());
17995        self
17996    }
17997
17998    /// Sets or clears the value of [create_time][crate::model::SessionTemplate::create_time].
17999    ///
18000    /// # Example
18001    /// ```ignore,no_run
18002    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18003    /// use wkt::Timestamp;
18004    /// let x = SessionTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18005    /// let x = SessionTemplate::new().set_or_clear_create_time(None::<Timestamp>);
18006    /// ```
18007    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18008    where
18009        T: std::convert::Into<wkt::Timestamp>,
18010    {
18011        self.create_time = v.map(|x| x.into());
18012        self
18013    }
18014
18015    /// Sets the value of [creator][crate::model::SessionTemplate::creator].
18016    ///
18017    /// # Example
18018    /// ```ignore,no_run
18019    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18020    /// let x = SessionTemplate::new().set_creator("example");
18021    /// ```
18022    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18023        self.creator = v.into();
18024        self
18025    }
18026
18027    /// Sets the value of [labels][crate::model::SessionTemplate::labels].
18028    ///
18029    /// # Example
18030    /// ```ignore,no_run
18031    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18032    /// let x = SessionTemplate::new().set_labels([
18033    ///     ("key0", "abc"),
18034    ///     ("key1", "xyz"),
18035    /// ]);
18036    /// ```
18037    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18038    where
18039        T: std::iter::IntoIterator<Item = (K, V)>,
18040        K: std::convert::Into<std::string::String>,
18041        V: std::convert::Into<std::string::String>,
18042    {
18043        use std::iter::Iterator;
18044        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18045        self
18046    }
18047
18048    /// Sets the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
18049    ///
18050    /// # Example
18051    /// ```ignore,no_run
18052    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18053    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18054    /// let x = SessionTemplate::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
18055    /// ```
18056    pub fn set_runtime_config<T>(mut self, v: T) -> Self
18057    where
18058        T: std::convert::Into<crate::model::RuntimeConfig>,
18059    {
18060        self.runtime_config = std::option::Option::Some(v.into());
18061        self
18062    }
18063
18064    /// Sets or clears the value of [runtime_config][crate::model::SessionTemplate::runtime_config].
18065    ///
18066    /// # Example
18067    /// ```ignore,no_run
18068    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18069    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18070    /// let x = SessionTemplate::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
18071    /// let x = SessionTemplate::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
18072    /// ```
18073    pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
18074    where
18075        T: std::convert::Into<crate::model::RuntimeConfig>,
18076    {
18077        self.runtime_config = v.map(|x| x.into());
18078        self
18079    }
18080
18081    /// Sets the value of [environment_config][crate::model::SessionTemplate::environment_config].
18082    ///
18083    /// # Example
18084    /// ```ignore,no_run
18085    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18086    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18087    /// let x = SessionTemplate::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
18088    /// ```
18089    pub fn set_environment_config<T>(mut self, v: T) -> Self
18090    where
18091        T: std::convert::Into<crate::model::EnvironmentConfig>,
18092    {
18093        self.environment_config = std::option::Option::Some(v.into());
18094        self
18095    }
18096
18097    /// Sets or clears the value of [environment_config][crate::model::SessionTemplate::environment_config].
18098    ///
18099    /// # Example
18100    /// ```ignore,no_run
18101    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18102    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
18103    /// let x = SessionTemplate::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
18104    /// let x = SessionTemplate::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
18105    /// ```
18106    pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
18107    where
18108        T: std::convert::Into<crate::model::EnvironmentConfig>,
18109    {
18110        self.environment_config = v.map(|x| x.into());
18111        self
18112    }
18113
18114    /// Sets the value of [update_time][crate::model::SessionTemplate::update_time].
18115    ///
18116    /// # Example
18117    /// ```ignore,no_run
18118    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18119    /// use wkt::Timestamp;
18120    /// let x = SessionTemplate::new().set_update_time(Timestamp::default()/* use setters */);
18121    /// ```
18122    pub fn set_update_time<T>(mut self, v: T) -> Self
18123    where
18124        T: std::convert::Into<wkt::Timestamp>,
18125    {
18126        self.update_time = std::option::Option::Some(v.into());
18127        self
18128    }
18129
18130    /// Sets or clears the value of [update_time][crate::model::SessionTemplate::update_time].
18131    ///
18132    /// # Example
18133    /// ```ignore,no_run
18134    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18135    /// use wkt::Timestamp;
18136    /// let x = SessionTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
18137    /// let x = SessionTemplate::new().set_or_clear_update_time(None::<Timestamp>);
18138    /// ```
18139    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
18140    where
18141        T: std::convert::Into<wkt::Timestamp>,
18142    {
18143        self.update_time = v.map(|x| x.into());
18144        self
18145    }
18146
18147    /// Sets the value of [uuid][crate::model::SessionTemplate::uuid].
18148    ///
18149    /// # Example
18150    /// ```ignore,no_run
18151    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18152    /// let x = SessionTemplate::new().set_uuid("example");
18153    /// ```
18154    pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18155        self.uuid = v.into();
18156        self
18157    }
18158
18159    /// Sets the value of [session_config][crate::model::SessionTemplate::session_config].
18160    ///
18161    /// Note that all the setters affecting `session_config` are mutually
18162    /// exclusive.
18163    ///
18164    /// # Example
18165    /// ```ignore,no_run
18166    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18167    /// use google_cloud_dataproc_v1::model::JupyterConfig;
18168    /// let x = SessionTemplate::new().set_session_config(Some(
18169    ///     google_cloud_dataproc_v1::model::session_template::SessionConfig::JupyterSession(JupyterConfig::default().into())));
18170    /// ```
18171    pub fn set_session_config<
18172        T: std::convert::Into<std::option::Option<crate::model::session_template::SessionConfig>>,
18173    >(
18174        mut self,
18175        v: T,
18176    ) -> Self {
18177        self.session_config = v.into();
18178        self
18179    }
18180
18181    /// The value of [session_config][crate::model::SessionTemplate::session_config]
18182    /// if it holds a `JupyterSession`, `None` if the field is not set or
18183    /// holds a different branch.
18184    pub fn jupyter_session(
18185        &self,
18186    ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
18187        #[allow(unreachable_patterns)]
18188        self.session_config.as_ref().and_then(|v| match v {
18189            crate::model::session_template::SessionConfig::JupyterSession(v) => {
18190                std::option::Option::Some(v)
18191            }
18192            _ => std::option::Option::None,
18193        })
18194    }
18195
18196    /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
18197    /// to hold a `JupyterSession`.
18198    ///
18199    /// Note that all the setters affecting `session_config` are
18200    /// mutually exclusive.
18201    ///
18202    /// # Example
18203    /// ```ignore,no_run
18204    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18205    /// use google_cloud_dataproc_v1::model::JupyterConfig;
18206    /// let x = SessionTemplate::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
18207    /// assert!(x.jupyter_session().is_some());
18208    /// assert!(x.spark_connect_session().is_none());
18209    /// ```
18210    pub fn set_jupyter_session<
18211        T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
18212    >(
18213        mut self,
18214        v: T,
18215    ) -> Self {
18216        self.session_config = std::option::Option::Some(
18217            crate::model::session_template::SessionConfig::JupyterSession(v.into()),
18218        );
18219        self
18220    }
18221
18222    /// The value of [session_config][crate::model::SessionTemplate::session_config]
18223    /// if it holds a `SparkConnectSession`, `None` if the field is not set or
18224    /// holds a different branch.
18225    pub fn spark_connect_session(
18226        &self,
18227    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
18228        #[allow(unreachable_patterns)]
18229        self.session_config.as_ref().and_then(|v| match v {
18230            crate::model::session_template::SessionConfig::SparkConnectSession(v) => {
18231                std::option::Option::Some(v)
18232            }
18233            _ => std::option::Option::None,
18234        })
18235    }
18236
18237    /// Sets the value of [session_config][crate::model::SessionTemplate::session_config]
18238    /// to hold a `SparkConnectSession`.
18239    ///
18240    /// Note that all the setters affecting `session_config` are
18241    /// mutually exclusive.
18242    ///
18243    /// # Example
18244    /// ```ignore,no_run
18245    /// # use google_cloud_dataproc_v1::model::SessionTemplate;
18246    /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
18247    /// let x = SessionTemplate::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
18248    /// assert!(x.spark_connect_session().is_some());
18249    /// assert!(x.jupyter_session().is_none());
18250    /// ```
18251    pub fn set_spark_connect_session<
18252        T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
18253    >(
18254        mut self,
18255        v: T,
18256    ) -> Self {
18257        self.session_config = std::option::Option::Some(
18258            crate::model::session_template::SessionConfig::SparkConnectSession(v.into()),
18259        );
18260        self
18261    }
18262}
18263
18264impl wkt::message::Message for SessionTemplate {
18265    fn typename() -> &'static str {
18266        "type.googleapis.com/google.cloud.dataproc.v1.SessionTemplate"
18267    }
18268}
18269
18270/// Defines additional types related to [SessionTemplate].
18271pub mod session_template {
18272    #[allow(unused_imports)]
18273    use super::*;
18274
18275    /// The session configuration.
18276    #[derive(Clone, Debug, PartialEq)]
18277    #[non_exhaustive]
18278    pub enum SessionConfig {
18279        /// Optional. Jupyter session config.
18280        JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
18281        /// Optional. Spark Connect session config.
18282        SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
18283    }
18284}
18285
18286/// A request to create a session.
18287#[derive(Clone, Default, PartialEq)]
18288#[non_exhaustive]
18289pub struct CreateSessionRequest {
18290    /// Required. The parent resource where this session will be created.
18291    pub parent: std::string::String,
18292
18293    /// Required. The interactive session to create.
18294    pub session: std::option::Option<crate::model::Session>,
18295
18296    /// Required. The ID to use for the session, which becomes the final component
18297    /// of the session's resource name.
18298    ///
18299    /// This value must be 4-63 characters. Valid characters
18300    /// are /[a-z][0-9]-/.
18301    pub session_id: std::string::String,
18302
18303    /// Optional. A unique ID used to identify the request. If the service
18304    /// receives two
18305    /// [CreateSessionRequests](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
18306    /// with the same ID, the second request is ignored, and the
18307    /// first [Session][google.cloud.dataproc.v1.Session] is created and stored in
18308    /// the backend.
18309    ///
18310    /// Recommendation: Set this value to a
18311    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18312    ///
18313    /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18314    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18315    ///
18316    /// [google.cloud.dataproc.v1.Session]: crate::model::Session
18317    pub request_id: std::string::String,
18318
18319    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18320}
18321
18322impl CreateSessionRequest {
18323    pub fn new() -> Self {
18324        std::default::Default::default()
18325    }
18326
18327    /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
18328    ///
18329    /// # Example
18330    /// ```ignore,no_run
18331    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18332    /// let x = CreateSessionRequest::new().set_parent("example");
18333    /// ```
18334    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18335        self.parent = v.into();
18336        self
18337    }
18338
18339    /// Sets the value of [session][crate::model::CreateSessionRequest::session].
18340    ///
18341    /// # Example
18342    /// ```ignore,no_run
18343    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18344    /// use google_cloud_dataproc_v1::model::Session;
18345    /// let x = CreateSessionRequest::new().set_session(Session::default()/* use setters */);
18346    /// ```
18347    pub fn set_session<T>(mut self, v: T) -> Self
18348    where
18349        T: std::convert::Into<crate::model::Session>,
18350    {
18351        self.session = std::option::Option::Some(v.into());
18352        self
18353    }
18354
18355    /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
18356    ///
18357    /// # Example
18358    /// ```ignore,no_run
18359    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18360    /// use google_cloud_dataproc_v1::model::Session;
18361    /// let x = CreateSessionRequest::new().set_or_clear_session(Some(Session::default()/* use setters */));
18362    /// let x = CreateSessionRequest::new().set_or_clear_session(None::<Session>);
18363    /// ```
18364    pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
18365    where
18366        T: std::convert::Into<crate::model::Session>,
18367    {
18368        self.session = v.map(|x| x.into());
18369        self
18370    }
18371
18372    /// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
18373    ///
18374    /// # Example
18375    /// ```ignore,no_run
18376    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18377    /// let x = CreateSessionRequest::new().set_session_id("example");
18378    /// ```
18379    pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18380        self.session_id = v.into();
18381        self
18382    }
18383
18384    /// Sets the value of [request_id][crate::model::CreateSessionRequest::request_id].
18385    ///
18386    /// # Example
18387    /// ```ignore,no_run
18388    /// # use google_cloud_dataproc_v1::model::CreateSessionRequest;
18389    /// let x = CreateSessionRequest::new().set_request_id("example");
18390    /// ```
18391    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18392        self.request_id = v.into();
18393        self
18394    }
18395}
18396
18397impl wkt::message::Message for CreateSessionRequest {
18398    fn typename() -> &'static str {
18399        "type.googleapis.com/google.cloud.dataproc.v1.CreateSessionRequest"
18400    }
18401}
18402
18403/// A request to get the resource representation for a session.
18404#[derive(Clone, Default, PartialEq)]
18405#[non_exhaustive]
18406pub struct GetSessionRequest {
18407    /// Required. The name of the session to retrieve.
18408    pub name: std::string::String,
18409
18410    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18411}
18412
18413impl GetSessionRequest {
18414    pub fn new() -> Self {
18415        std::default::Default::default()
18416    }
18417
18418    /// Sets the value of [name][crate::model::GetSessionRequest::name].
18419    ///
18420    /// # Example
18421    /// ```ignore,no_run
18422    /// # use google_cloud_dataproc_v1::model::GetSessionRequest;
18423    /// let x = GetSessionRequest::new().set_name("example");
18424    /// ```
18425    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18426        self.name = v.into();
18427        self
18428    }
18429}
18430
18431impl wkt::message::Message for GetSessionRequest {
18432    fn typename() -> &'static str {
18433        "type.googleapis.com/google.cloud.dataproc.v1.GetSessionRequest"
18434    }
18435}
18436
18437/// A request to list sessions in a project.
18438#[derive(Clone, Default, PartialEq)]
18439#[non_exhaustive]
18440pub struct ListSessionsRequest {
18441    /// Required. The parent, which owns this collection of sessions.
18442    pub parent: std::string::String,
18443
18444    /// Optional. The maximum number of sessions to return in each response.
18445    /// The service may return fewer than this value.
18446    pub page_size: i32,
18447
18448    /// Optional. A page token received from a previous `ListSessions` call.
18449    /// Provide this token to retrieve the subsequent page.
18450    pub page_token: std::string::String,
18451
18452    /// Optional. A filter for the sessions to return in the response.
18453    ///
18454    /// A filter is a logical expression constraining the values of various fields
18455    /// in each session resource. Filters are case sensitive, and may contain
18456    /// multiple clauses combined with logical operators (AND, OR).
18457    /// Supported fields are `session_id`, `session_uuid`, `state`, `create_time`,
18458    /// and `labels`.
18459    ///
18460    /// Example: `state = ACTIVE and create_time < "2023-01-01T00:00:00Z"`
18461    /// is a filter for sessions in an ACTIVE state that were created before
18462    /// 2023-01-01. `state = ACTIVE and labels.environment=production` is a filter
18463    /// for sessions in an ACTIVE state that have a production environment label.
18464    ///
18465    /// See <https://google.aip.dev/assets/misc/ebnf-filtering.txt> for a detailed
18466    /// description of the filter syntax and a list of supported comparators.
18467    pub filter: std::string::String,
18468
18469    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18470}
18471
18472impl ListSessionsRequest {
18473    pub fn new() -> Self {
18474        std::default::Default::default()
18475    }
18476
18477    /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
18478    ///
18479    /// # Example
18480    /// ```ignore,no_run
18481    /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18482    /// let x = ListSessionsRequest::new().set_parent("example");
18483    /// ```
18484    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18485        self.parent = v.into();
18486        self
18487    }
18488
18489    /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
18490    ///
18491    /// # Example
18492    /// ```ignore,no_run
18493    /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18494    /// let x = ListSessionsRequest::new().set_page_size(42);
18495    /// ```
18496    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18497        self.page_size = v.into();
18498        self
18499    }
18500
18501    /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
18502    ///
18503    /// # Example
18504    /// ```ignore,no_run
18505    /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18506    /// let x = ListSessionsRequest::new().set_page_token("example");
18507    /// ```
18508    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18509        self.page_token = v.into();
18510        self
18511    }
18512
18513    /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
18514    ///
18515    /// # Example
18516    /// ```ignore,no_run
18517    /// # use google_cloud_dataproc_v1::model::ListSessionsRequest;
18518    /// let x = ListSessionsRequest::new().set_filter("example");
18519    /// ```
18520    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18521        self.filter = v.into();
18522        self
18523    }
18524}
18525
18526impl wkt::message::Message for ListSessionsRequest {
18527    fn typename() -> &'static str {
18528        "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsRequest"
18529    }
18530}
18531
18532/// A list of interactive sessions.
18533#[derive(Clone, Default, PartialEq)]
18534#[non_exhaustive]
18535pub struct ListSessionsResponse {
18536    /// Output only. The sessions from the specified collection.
18537    pub sessions: std::vec::Vec<crate::model::Session>,
18538
18539    /// A token, which can be sent as `page_token`, to retrieve the next page.
18540    /// If this field is omitted, there are no subsequent pages.
18541    pub next_page_token: std::string::String,
18542
18543    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18544}
18545
18546impl ListSessionsResponse {
18547    pub fn new() -> Self {
18548        std::default::Default::default()
18549    }
18550
18551    /// Sets the value of [sessions][crate::model::ListSessionsResponse::sessions].
18552    ///
18553    /// # Example
18554    /// ```ignore,no_run
18555    /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18556    /// use google_cloud_dataproc_v1::model::Session;
18557    /// let x = ListSessionsResponse::new()
18558    ///     .set_sessions([
18559    ///         Session::default()/* use setters */,
18560    ///         Session::default()/* use (different) setters */,
18561    ///     ]);
18562    /// ```
18563    pub fn set_sessions<T, V>(mut self, v: T) -> Self
18564    where
18565        T: std::iter::IntoIterator<Item = V>,
18566        V: std::convert::Into<crate::model::Session>,
18567    {
18568        use std::iter::Iterator;
18569        self.sessions = v.into_iter().map(|i| i.into()).collect();
18570        self
18571    }
18572
18573    /// Sets the value of [next_page_token][crate::model::ListSessionsResponse::next_page_token].
18574    ///
18575    /// # Example
18576    /// ```ignore,no_run
18577    /// # use google_cloud_dataproc_v1::model::ListSessionsResponse;
18578    /// let x = ListSessionsResponse::new().set_next_page_token("example");
18579    /// ```
18580    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18581        self.next_page_token = v.into();
18582        self
18583    }
18584}
18585
18586impl wkt::message::Message for ListSessionsResponse {
18587    fn typename() -> &'static str {
18588        "type.googleapis.com/google.cloud.dataproc.v1.ListSessionsResponse"
18589    }
18590}
18591
18592#[doc(hidden)]
18593impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionsResponse {
18594    type PageItem = crate::model::Session;
18595
18596    fn items(self) -> std::vec::Vec<Self::PageItem> {
18597        self.sessions
18598    }
18599
18600    fn next_page_token(&self) -> std::string::String {
18601        use std::clone::Clone;
18602        self.next_page_token.clone()
18603    }
18604}
18605
18606/// A request to terminate an interactive session.
18607#[derive(Clone, Default, PartialEq)]
18608#[non_exhaustive]
18609pub struct TerminateSessionRequest {
18610    /// Required. The name of the session resource to terminate.
18611    pub name: std::string::String,
18612
18613    /// Optional. A unique ID used to identify the request. If the service
18614    /// receives two
18615    /// [TerminateSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s
18616    /// with the same ID, the second request is ignored.
18617    ///
18618    /// Recommendation: Set this value to a
18619    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18620    ///
18621    /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18622    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18623    pub request_id: std::string::String,
18624
18625    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18626}
18627
18628impl TerminateSessionRequest {
18629    pub fn new() -> Self {
18630        std::default::Default::default()
18631    }
18632
18633    /// Sets the value of [name][crate::model::TerminateSessionRequest::name].
18634    ///
18635    /// # Example
18636    /// ```ignore,no_run
18637    /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
18638    /// let x = TerminateSessionRequest::new().set_name("example");
18639    /// ```
18640    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18641        self.name = v.into();
18642        self
18643    }
18644
18645    /// Sets the value of [request_id][crate::model::TerminateSessionRequest::request_id].
18646    ///
18647    /// # Example
18648    /// ```ignore,no_run
18649    /// # use google_cloud_dataproc_v1::model::TerminateSessionRequest;
18650    /// let x = TerminateSessionRequest::new().set_request_id("example");
18651    /// ```
18652    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18653        self.request_id = v.into();
18654        self
18655    }
18656}
18657
18658impl wkt::message::Message for TerminateSessionRequest {
18659    fn typename() -> &'static str {
18660        "type.googleapis.com/google.cloud.dataproc.v1.TerminateSessionRequest"
18661    }
18662}
18663
18664/// A request to delete a session.
18665#[derive(Clone, Default, PartialEq)]
18666#[non_exhaustive]
18667pub struct DeleteSessionRequest {
18668    /// Required. The name of the session resource to delete.
18669    pub name: std::string::String,
18670
18671    /// Optional. A unique ID used to identify the request. If the service
18672    /// receives two
18673    /// [DeleteSessionRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s
18674    /// with the same ID, the second request is ignored.
18675    ///
18676    /// Recommendation: Set this value to a
18677    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
18678    ///
18679    /// The value must contain only letters (a-z, A-Z), numbers (0-9),
18680    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
18681    pub request_id: std::string::String,
18682
18683    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18684}
18685
18686impl DeleteSessionRequest {
18687    pub fn new() -> Self {
18688        std::default::Default::default()
18689    }
18690
18691    /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
18692    ///
18693    /// # Example
18694    /// ```ignore,no_run
18695    /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
18696    /// let x = DeleteSessionRequest::new().set_name("example");
18697    /// ```
18698    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18699        self.name = v.into();
18700        self
18701    }
18702
18703    /// Sets the value of [request_id][crate::model::DeleteSessionRequest::request_id].
18704    ///
18705    /// # Example
18706    /// ```ignore,no_run
18707    /// # use google_cloud_dataproc_v1::model::DeleteSessionRequest;
18708    /// let x = DeleteSessionRequest::new().set_request_id("example");
18709    /// ```
18710    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18711        self.request_id = v.into();
18712        self
18713    }
18714}
18715
18716impl wkt::message::Message for DeleteSessionRequest {
18717    fn typename() -> &'static str {
18718        "type.googleapis.com/google.cloud.dataproc.v1.DeleteSessionRequest"
18719    }
18720}
18721
18722/// A representation of a session.
18723#[derive(Clone, Default, PartialEq)]
18724#[non_exhaustive]
18725pub struct Session {
18726    /// Required. The resource name of the session.
18727    pub name: std::string::String,
18728
18729    /// Output only. A session UUID (Unique Universal Identifier). The service
18730    /// generates this value when it creates the session.
18731    pub uuid: std::string::String,
18732
18733    /// Output only. The time when the session was created.
18734    pub create_time: std::option::Option<wkt::Timestamp>,
18735
18736    /// Output only. Runtime information about session execution.
18737    pub runtime_info: std::option::Option<crate::model::RuntimeInfo>,
18738
18739    /// Output only. A state of the session.
18740    pub state: crate::model::session::State,
18741
18742    /// Output only. Session state details, such as the failure
18743    /// description if the state is `FAILED`.
18744    pub state_message: std::string::String,
18745
18746    /// Output only. The time when the session entered the current state.
18747    pub state_time: std::option::Option<wkt::Timestamp>,
18748
18749    /// Output only. The email address of the user who created the session.
18750    pub creator: std::string::String,
18751
18752    /// Optional. The labels to associate with the session.
18753    /// Label **keys** must contain 1 to 63 characters, and must conform to
18754    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
18755    /// Label **values** may be empty, but, if present, must contain 1 to 63
18756    /// characters, and must conform to [RFC
18757    /// 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
18758    /// associated with a session.
18759    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18760
18761    /// Optional. Runtime configuration for the session execution.
18762    pub runtime_config: std::option::Option<crate::model::RuntimeConfig>,
18763
18764    /// Optional. Environment configuration for the session execution.
18765    pub environment_config: std::option::Option<crate::model::EnvironmentConfig>,
18766
18767    /// Optional. The email address of the user who owns the session.
18768    pub user: std::string::String,
18769
18770    /// Output only. Historical state information for the session.
18771    pub state_history: std::vec::Vec<crate::model::session::SessionStateHistory>,
18772
18773    /// Optional. The session template used by the session.
18774    ///
18775    /// Only resource names, including project ID and location, are valid.
18776    ///
18777    /// Example:
18778    ///
18779    /// * `<https://www.googleapis.com/compute/v1/projects/>[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
18780    /// * `projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]`
18781    ///
18782    /// The template must be in the same project and Dataproc region as the
18783    /// session.
18784    pub session_template: std::string::String,
18785
18786    /// The session configuration.
18787    pub session_config: std::option::Option<crate::model::session::SessionConfig>,
18788
18789    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18790}
18791
18792impl Session {
18793    pub fn new() -> Self {
18794        std::default::Default::default()
18795    }
18796
18797    /// Sets the value of [name][crate::model::Session::name].
18798    ///
18799    /// # Example
18800    /// ```ignore,no_run
18801    /// # use google_cloud_dataproc_v1::model::Session;
18802    /// let x = Session::new().set_name("example");
18803    /// ```
18804    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18805        self.name = v.into();
18806        self
18807    }
18808
18809    /// Sets the value of [uuid][crate::model::Session::uuid].
18810    ///
18811    /// # Example
18812    /// ```ignore,no_run
18813    /// # use google_cloud_dataproc_v1::model::Session;
18814    /// let x = Session::new().set_uuid("example");
18815    /// ```
18816    pub fn set_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18817        self.uuid = v.into();
18818        self
18819    }
18820
18821    /// Sets the value of [create_time][crate::model::Session::create_time].
18822    ///
18823    /// # Example
18824    /// ```ignore,no_run
18825    /// # use google_cloud_dataproc_v1::model::Session;
18826    /// use wkt::Timestamp;
18827    /// let x = Session::new().set_create_time(Timestamp::default()/* use setters */);
18828    /// ```
18829    pub fn set_create_time<T>(mut self, v: T) -> Self
18830    where
18831        T: std::convert::Into<wkt::Timestamp>,
18832    {
18833        self.create_time = std::option::Option::Some(v.into());
18834        self
18835    }
18836
18837    /// Sets or clears the value of [create_time][crate::model::Session::create_time].
18838    ///
18839    /// # Example
18840    /// ```ignore,no_run
18841    /// # use google_cloud_dataproc_v1::model::Session;
18842    /// use wkt::Timestamp;
18843    /// let x = Session::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18844    /// let x = Session::new().set_or_clear_create_time(None::<Timestamp>);
18845    /// ```
18846    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18847    where
18848        T: std::convert::Into<wkt::Timestamp>,
18849    {
18850        self.create_time = v.map(|x| x.into());
18851        self
18852    }
18853
18854    /// Sets the value of [runtime_info][crate::model::Session::runtime_info].
18855    ///
18856    /// # Example
18857    /// ```ignore,no_run
18858    /// # use google_cloud_dataproc_v1::model::Session;
18859    /// use google_cloud_dataproc_v1::model::RuntimeInfo;
18860    /// let x = Session::new().set_runtime_info(RuntimeInfo::default()/* use setters */);
18861    /// ```
18862    pub fn set_runtime_info<T>(mut self, v: T) -> Self
18863    where
18864        T: std::convert::Into<crate::model::RuntimeInfo>,
18865    {
18866        self.runtime_info = std::option::Option::Some(v.into());
18867        self
18868    }
18869
18870    /// Sets or clears the value of [runtime_info][crate::model::Session::runtime_info].
18871    ///
18872    /// # Example
18873    /// ```ignore,no_run
18874    /// # use google_cloud_dataproc_v1::model::Session;
18875    /// use google_cloud_dataproc_v1::model::RuntimeInfo;
18876    /// let x = Session::new().set_or_clear_runtime_info(Some(RuntimeInfo::default()/* use setters */));
18877    /// let x = Session::new().set_or_clear_runtime_info(None::<RuntimeInfo>);
18878    /// ```
18879    pub fn set_or_clear_runtime_info<T>(mut self, v: std::option::Option<T>) -> Self
18880    where
18881        T: std::convert::Into<crate::model::RuntimeInfo>,
18882    {
18883        self.runtime_info = v.map(|x| x.into());
18884        self
18885    }
18886
18887    /// Sets the value of [state][crate::model::Session::state].
18888    ///
18889    /// # Example
18890    /// ```ignore,no_run
18891    /// # use google_cloud_dataproc_v1::model::Session;
18892    /// use google_cloud_dataproc_v1::model::session::State;
18893    /// let x0 = Session::new().set_state(State::Creating);
18894    /// let x1 = Session::new().set_state(State::Active);
18895    /// let x2 = Session::new().set_state(State::Terminating);
18896    /// ```
18897    pub fn set_state<T: std::convert::Into<crate::model::session::State>>(mut self, v: T) -> Self {
18898        self.state = v.into();
18899        self
18900    }
18901
18902    /// Sets the value of [state_message][crate::model::Session::state_message].
18903    ///
18904    /// # Example
18905    /// ```ignore,no_run
18906    /// # use google_cloud_dataproc_v1::model::Session;
18907    /// let x = Session::new().set_state_message("example");
18908    /// ```
18909    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18910        self.state_message = v.into();
18911        self
18912    }
18913
18914    /// Sets the value of [state_time][crate::model::Session::state_time].
18915    ///
18916    /// # Example
18917    /// ```ignore,no_run
18918    /// # use google_cloud_dataproc_v1::model::Session;
18919    /// use wkt::Timestamp;
18920    /// let x = Session::new().set_state_time(Timestamp::default()/* use setters */);
18921    /// ```
18922    pub fn set_state_time<T>(mut self, v: T) -> Self
18923    where
18924        T: std::convert::Into<wkt::Timestamp>,
18925    {
18926        self.state_time = std::option::Option::Some(v.into());
18927        self
18928    }
18929
18930    /// Sets or clears the value of [state_time][crate::model::Session::state_time].
18931    ///
18932    /// # Example
18933    /// ```ignore,no_run
18934    /// # use google_cloud_dataproc_v1::model::Session;
18935    /// use wkt::Timestamp;
18936    /// let x = Session::new().set_or_clear_state_time(Some(Timestamp::default()/* use setters */));
18937    /// let x = Session::new().set_or_clear_state_time(None::<Timestamp>);
18938    /// ```
18939    pub fn set_or_clear_state_time<T>(mut self, v: std::option::Option<T>) -> Self
18940    where
18941        T: std::convert::Into<wkt::Timestamp>,
18942    {
18943        self.state_time = v.map(|x| x.into());
18944        self
18945    }
18946
18947    /// Sets the value of [creator][crate::model::Session::creator].
18948    ///
18949    /// # Example
18950    /// ```ignore,no_run
18951    /// # use google_cloud_dataproc_v1::model::Session;
18952    /// let x = Session::new().set_creator("example");
18953    /// ```
18954    pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18955        self.creator = v.into();
18956        self
18957    }
18958
18959    /// Sets the value of [labels][crate::model::Session::labels].
18960    ///
18961    /// # Example
18962    /// ```ignore,no_run
18963    /// # use google_cloud_dataproc_v1::model::Session;
18964    /// let x = Session::new().set_labels([
18965    ///     ("key0", "abc"),
18966    ///     ("key1", "xyz"),
18967    /// ]);
18968    /// ```
18969    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18970    where
18971        T: std::iter::IntoIterator<Item = (K, V)>,
18972        K: std::convert::Into<std::string::String>,
18973        V: std::convert::Into<std::string::String>,
18974    {
18975        use std::iter::Iterator;
18976        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18977        self
18978    }
18979
18980    /// Sets the value of [runtime_config][crate::model::Session::runtime_config].
18981    ///
18982    /// # Example
18983    /// ```ignore,no_run
18984    /// # use google_cloud_dataproc_v1::model::Session;
18985    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
18986    /// let x = Session::new().set_runtime_config(RuntimeConfig::default()/* use setters */);
18987    /// ```
18988    pub fn set_runtime_config<T>(mut self, v: T) -> Self
18989    where
18990        T: std::convert::Into<crate::model::RuntimeConfig>,
18991    {
18992        self.runtime_config = std::option::Option::Some(v.into());
18993        self
18994    }
18995
18996    /// Sets or clears the value of [runtime_config][crate::model::Session::runtime_config].
18997    ///
18998    /// # Example
18999    /// ```ignore,no_run
19000    /// # use google_cloud_dataproc_v1::model::Session;
19001    /// use google_cloud_dataproc_v1::model::RuntimeConfig;
19002    /// let x = Session::new().set_or_clear_runtime_config(Some(RuntimeConfig::default()/* use setters */));
19003    /// let x = Session::new().set_or_clear_runtime_config(None::<RuntimeConfig>);
19004    /// ```
19005    pub fn set_or_clear_runtime_config<T>(mut self, v: std::option::Option<T>) -> Self
19006    where
19007        T: std::convert::Into<crate::model::RuntimeConfig>,
19008    {
19009        self.runtime_config = v.map(|x| x.into());
19010        self
19011    }
19012
19013    /// Sets the value of [environment_config][crate::model::Session::environment_config].
19014    ///
19015    /// # Example
19016    /// ```ignore,no_run
19017    /// # use google_cloud_dataproc_v1::model::Session;
19018    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19019    /// let x = Session::new().set_environment_config(EnvironmentConfig::default()/* use setters */);
19020    /// ```
19021    pub fn set_environment_config<T>(mut self, v: T) -> Self
19022    where
19023        T: std::convert::Into<crate::model::EnvironmentConfig>,
19024    {
19025        self.environment_config = std::option::Option::Some(v.into());
19026        self
19027    }
19028
19029    /// Sets or clears the value of [environment_config][crate::model::Session::environment_config].
19030    ///
19031    /// # Example
19032    /// ```ignore,no_run
19033    /// # use google_cloud_dataproc_v1::model::Session;
19034    /// use google_cloud_dataproc_v1::model::EnvironmentConfig;
19035    /// let x = Session::new().set_or_clear_environment_config(Some(EnvironmentConfig::default()/* use setters */));
19036    /// let x = Session::new().set_or_clear_environment_config(None::<EnvironmentConfig>);
19037    /// ```
19038    pub fn set_or_clear_environment_config<T>(mut self, v: std::option::Option<T>) -> Self
19039    where
19040        T: std::convert::Into<crate::model::EnvironmentConfig>,
19041    {
19042        self.environment_config = v.map(|x| x.into());
19043        self
19044    }
19045
19046    /// Sets the value of [user][crate::model::Session::user].
19047    ///
19048    /// # Example
19049    /// ```ignore,no_run
19050    /// # use google_cloud_dataproc_v1::model::Session;
19051    /// let x = Session::new().set_user("example");
19052    /// ```
19053    pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19054        self.user = v.into();
19055        self
19056    }
19057
19058    /// Sets the value of [state_history][crate::model::Session::state_history].
19059    ///
19060    /// # Example
19061    /// ```ignore,no_run
19062    /// # use google_cloud_dataproc_v1::model::Session;
19063    /// use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19064    /// let x = Session::new()
19065    ///     .set_state_history([
19066    ///         SessionStateHistory::default()/* use setters */,
19067    ///         SessionStateHistory::default()/* use (different) setters */,
19068    ///     ]);
19069    /// ```
19070    pub fn set_state_history<T, V>(mut self, v: T) -> Self
19071    where
19072        T: std::iter::IntoIterator<Item = V>,
19073        V: std::convert::Into<crate::model::session::SessionStateHistory>,
19074    {
19075        use std::iter::Iterator;
19076        self.state_history = v.into_iter().map(|i| i.into()).collect();
19077        self
19078    }
19079
19080    /// Sets the value of [session_template][crate::model::Session::session_template].
19081    ///
19082    /// # Example
19083    /// ```ignore,no_run
19084    /// # use google_cloud_dataproc_v1::model::Session;
19085    /// let x = Session::new().set_session_template("example");
19086    /// ```
19087    pub fn set_session_template<T: std::convert::Into<std::string::String>>(
19088        mut self,
19089        v: T,
19090    ) -> Self {
19091        self.session_template = v.into();
19092        self
19093    }
19094
19095    /// Sets the value of [session_config][crate::model::Session::session_config].
19096    ///
19097    /// Note that all the setters affecting `session_config` are mutually
19098    /// exclusive.
19099    ///
19100    /// # Example
19101    /// ```ignore,no_run
19102    /// # use google_cloud_dataproc_v1::model::Session;
19103    /// use google_cloud_dataproc_v1::model::JupyterConfig;
19104    /// let x = Session::new().set_session_config(Some(
19105    ///     google_cloud_dataproc_v1::model::session::SessionConfig::JupyterSession(JupyterConfig::default().into())));
19106    /// ```
19107    pub fn set_session_config<
19108        T: std::convert::Into<std::option::Option<crate::model::session::SessionConfig>>,
19109    >(
19110        mut self,
19111        v: T,
19112    ) -> Self {
19113        self.session_config = v.into();
19114        self
19115    }
19116
19117    /// The value of [session_config][crate::model::Session::session_config]
19118    /// if it holds a `JupyterSession`, `None` if the field is not set or
19119    /// holds a different branch.
19120    pub fn jupyter_session(
19121        &self,
19122    ) -> std::option::Option<&std::boxed::Box<crate::model::JupyterConfig>> {
19123        #[allow(unreachable_patterns)]
19124        self.session_config.as_ref().and_then(|v| match v {
19125            crate::model::session::SessionConfig::JupyterSession(v) => std::option::Option::Some(v),
19126            _ => std::option::Option::None,
19127        })
19128    }
19129
19130    /// Sets the value of [session_config][crate::model::Session::session_config]
19131    /// to hold a `JupyterSession`.
19132    ///
19133    /// Note that all the setters affecting `session_config` are
19134    /// mutually exclusive.
19135    ///
19136    /// # Example
19137    /// ```ignore,no_run
19138    /// # use google_cloud_dataproc_v1::model::Session;
19139    /// use google_cloud_dataproc_v1::model::JupyterConfig;
19140    /// let x = Session::new().set_jupyter_session(JupyterConfig::default()/* use setters */);
19141    /// assert!(x.jupyter_session().is_some());
19142    /// assert!(x.spark_connect_session().is_none());
19143    /// ```
19144    pub fn set_jupyter_session<
19145        T: std::convert::Into<std::boxed::Box<crate::model::JupyterConfig>>,
19146    >(
19147        mut self,
19148        v: T,
19149    ) -> Self {
19150        self.session_config = std::option::Option::Some(
19151            crate::model::session::SessionConfig::JupyterSession(v.into()),
19152        );
19153        self
19154    }
19155
19156    /// The value of [session_config][crate::model::Session::session_config]
19157    /// if it holds a `SparkConnectSession`, `None` if the field is not set or
19158    /// holds a different branch.
19159    pub fn spark_connect_session(
19160        &self,
19161    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkConnectConfig>> {
19162        #[allow(unreachable_patterns)]
19163        self.session_config.as_ref().and_then(|v| match v {
19164            crate::model::session::SessionConfig::SparkConnectSession(v) => {
19165                std::option::Option::Some(v)
19166            }
19167            _ => std::option::Option::None,
19168        })
19169    }
19170
19171    /// Sets the value of [session_config][crate::model::Session::session_config]
19172    /// to hold a `SparkConnectSession`.
19173    ///
19174    /// Note that all the setters affecting `session_config` are
19175    /// mutually exclusive.
19176    ///
19177    /// # Example
19178    /// ```ignore,no_run
19179    /// # use google_cloud_dataproc_v1::model::Session;
19180    /// use google_cloud_dataproc_v1::model::SparkConnectConfig;
19181    /// let x = Session::new().set_spark_connect_session(SparkConnectConfig::default()/* use setters */);
19182    /// assert!(x.spark_connect_session().is_some());
19183    /// assert!(x.jupyter_session().is_none());
19184    /// ```
19185    pub fn set_spark_connect_session<
19186        T: std::convert::Into<std::boxed::Box<crate::model::SparkConnectConfig>>,
19187    >(
19188        mut self,
19189        v: T,
19190    ) -> Self {
19191        self.session_config = std::option::Option::Some(
19192            crate::model::session::SessionConfig::SparkConnectSession(v.into()),
19193        );
19194        self
19195    }
19196}
19197
19198impl wkt::message::Message for Session {
19199    fn typename() -> &'static str {
19200        "type.googleapis.com/google.cloud.dataproc.v1.Session"
19201    }
19202}
19203
19204/// Defines additional types related to [Session].
19205pub mod session {
19206    #[allow(unused_imports)]
19207    use super::*;
19208
19209    /// Historical state information.
19210    #[derive(Clone, Default, PartialEq)]
19211    #[non_exhaustive]
19212    pub struct SessionStateHistory {
19213        /// Output only. The state of the session at this point in the session
19214        /// history.
19215        pub state: crate::model::session::State,
19216
19217        /// Output only. Details about the state at this point in the session
19218        /// history.
19219        pub state_message: std::string::String,
19220
19221        /// Output only. The time when the session entered the historical state.
19222        pub state_start_time: std::option::Option<wkt::Timestamp>,
19223
19224        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19225    }
19226
19227    impl SessionStateHistory {
19228        pub fn new() -> Self {
19229            std::default::Default::default()
19230        }
19231
19232        /// Sets the value of [state][crate::model::session::SessionStateHistory::state].
19233        ///
19234        /// # Example
19235        /// ```ignore,no_run
19236        /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19237        /// use google_cloud_dataproc_v1::model::session::State;
19238        /// let x0 = SessionStateHistory::new().set_state(State::Creating);
19239        /// let x1 = SessionStateHistory::new().set_state(State::Active);
19240        /// let x2 = SessionStateHistory::new().set_state(State::Terminating);
19241        /// ```
19242        pub fn set_state<T: std::convert::Into<crate::model::session::State>>(
19243            mut self,
19244            v: T,
19245        ) -> Self {
19246            self.state = v.into();
19247            self
19248        }
19249
19250        /// Sets the value of [state_message][crate::model::session::SessionStateHistory::state_message].
19251        ///
19252        /// # Example
19253        /// ```ignore,no_run
19254        /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19255        /// let x = SessionStateHistory::new().set_state_message("example");
19256        /// ```
19257        pub fn set_state_message<T: std::convert::Into<std::string::String>>(
19258            mut self,
19259            v: T,
19260        ) -> Self {
19261            self.state_message = v.into();
19262            self
19263        }
19264
19265        /// Sets the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
19266        ///
19267        /// # Example
19268        /// ```ignore,no_run
19269        /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19270        /// use wkt::Timestamp;
19271        /// let x = SessionStateHistory::new().set_state_start_time(Timestamp::default()/* use setters */);
19272        /// ```
19273        pub fn set_state_start_time<T>(mut self, v: T) -> Self
19274        where
19275            T: std::convert::Into<wkt::Timestamp>,
19276        {
19277            self.state_start_time = std::option::Option::Some(v.into());
19278            self
19279        }
19280
19281        /// Sets or clears the value of [state_start_time][crate::model::session::SessionStateHistory::state_start_time].
19282        ///
19283        /// # Example
19284        /// ```ignore,no_run
19285        /// # use google_cloud_dataproc_v1::model::session::SessionStateHistory;
19286        /// use wkt::Timestamp;
19287        /// let x = SessionStateHistory::new().set_or_clear_state_start_time(Some(Timestamp::default()/* use setters */));
19288        /// let x = SessionStateHistory::new().set_or_clear_state_start_time(None::<Timestamp>);
19289        /// ```
19290        pub fn set_or_clear_state_start_time<T>(mut self, v: std::option::Option<T>) -> Self
19291        where
19292            T: std::convert::Into<wkt::Timestamp>,
19293        {
19294            self.state_start_time = v.map(|x| x.into());
19295            self
19296        }
19297    }
19298
19299    impl wkt::message::Message for SessionStateHistory {
19300        fn typename() -> &'static str {
19301            "type.googleapis.com/google.cloud.dataproc.v1.Session.SessionStateHistory"
19302        }
19303    }
19304
19305    /// The session state.
19306    ///
19307    /// # Working with unknown values
19308    ///
19309    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19310    /// additional enum variants at any time. Adding new variants is not considered
19311    /// a breaking change. Applications should write their code in anticipation of:
19312    ///
19313    /// - New values appearing in future releases of the client library, **and**
19314    /// - New values received dynamically, without application changes.
19315    ///
19316    /// Please consult the [Working with enums] section in the user guide for some
19317    /// guidelines.
19318    ///
19319    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19320    #[derive(Clone, Debug, PartialEq)]
19321    #[non_exhaustive]
19322    pub enum State {
19323        /// The session state is unknown.
19324        Unspecified,
19325        /// The session is created prior to running.
19326        Creating,
19327        /// The session is running.
19328        Active,
19329        /// The session is terminating.
19330        Terminating,
19331        /// The session is terminated successfully.
19332        Terminated,
19333        /// The session is no longer running due to an error.
19334        Failed,
19335        /// If set, the enum was initialized with an unknown value.
19336        ///
19337        /// Applications can examine the value using [State::value] or
19338        /// [State::name].
19339        UnknownValue(state::UnknownValue),
19340    }
19341
19342    #[doc(hidden)]
19343    pub mod state {
19344        #[allow(unused_imports)]
19345        use super::*;
19346        #[derive(Clone, Debug, PartialEq)]
19347        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19348    }
19349
19350    impl State {
19351        /// Gets the enum value.
19352        ///
19353        /// Returns `None` if the enum contains an unknown value deserialized from
19354        /// the string representation of enums.
19355        pub fn value(&self) -> std::option::Option<i32> {
19356            match self {
19357                Self::Unspecified => std::option::Option::Some(0),
19358                Self::Creating => std::option::Option::Some(1),
19359                Self::Active => std::option::Option::Some(2),
19360                Self::Terminating => std::option::Option::Some(3),
19361                Self::Terminated => std::option::Option::Some(4),
19362                Self::Failed => std::option::Option::Some(5),
19363                Self::UnknownValue(u) => u.0.value(),
19364            }
19365        }
19366
19367        /// Gets the enum value as a string.
19368        ///
19369        /// Returns `None` if the enum contains an unknown value deserialized from
19370        /// the integer representation of enums.
19371        pub fn name(&self) -> std::option::Option<&str> {
19372            match self {
19373                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19374                Self::Creating => std::option::Option::Some("CREATING"),
19375                Self::Active => std::option::Option::Some("ACTIVE"),
19376                Self::Terminating => std::option::Option::Some("TERMINATING"),
19377                Self::Terminated => std::option::Option::Some("TERMINATED"),
19378                Self::Failed => std::option::Option::Some("FAILED"),
19379                Self::UnknownValue(u) => u.0.name(),
19380            }
19381        }
19382    }
19383
19384    impl std::default::Default for State {
19385        fn default() -> Self {
19386            use std::convert::From;
19387            Self::from(0)
19388        }
19389    }
19390
19391    impl std::fmt::Display for State {
19392        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19393            wkt::internal::display_enum(f, self.name(), self.value())
19394        }
19395    }
19396
19397    impl std::convert::From<i32> for State {
19398        fn from(value: i32) -> Self {
19399            match value {
19400                0 => Self::Unspecified,
19401                1 => Self::Creating,
19402                2 => Self::Active,
19403                3 => Self::Terminating,
19404                4 => Self::Terminated,
19405                5 => Self::Failed,
19406                _ => Self::UnknownValue(state::UnknownValue(
19407                    wkt::internal::UnknownEnumValue::Integer(value),
19408                )),
19409            }
19410        }
19411    }
19412
19413    impl std::convert::From<&str> for State {
19414        fn from(value: &str) -> Self {
19415            use std::string::ToString;
19416            match value {
19417                "STATE_UNSPECIFIED" => Self::Unspecified,
19418                "CREATING" => Self::Creating,
19419                "ACTIVE" => Self::Active,
19420                "TERMINATING" => Self::Terminating,
19421                "TERMINATED" => Self::Terminated,
19422                "FAILED" => Self::Failed,
19423                _ => Self::UnknownValue(state::UnknownValue(
19424                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19425                )),
19426            }
19427        }
19428    }
19429
19430    impl serde::ser::Serialize for State {
19431        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19432        where
19433            S: serde::Serializer,
19434        {
19435            match self {
19436                Self::Unspecified => serializer.serialize_i32(0),
19437                Self::Creating => serializer.serialize_i32(1),
19438                Self::Active => serializer.serialize_i32(2),
19439                Self::Terminating => serializer.serialize_i32(3),
19440                Self::Terminated => serializer.serialize_i32(4),
19441                Self::Failed => serializer.serialize_i32(5),
19442                Self::UnknownValue(u) => u.0.serialize(serializer),
19443            }
19444        }
19445    }
19446
19447    impl<'de> serde::de::Deserialize<'de> for State {
19448        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19449        where
19450            D: serde::Deserializer<'de>,
19451        {
19452            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19453                ".google.cloud.dataproc.v1.Session.State",
19454            ))
19455        }
19456    }
19457
19458    /// The session configuration.
19459    #[derive(Clone, Debug, PartialEq)]
19460    #[non_exhaustive]
19461    pub enum SessionConfig {
19462        /// Optional. Jupyter session config.
19463        JupyterSession(std::boxed::Box<crate::model::JupyterConfig>),
19464        /// Optional. Spark Connect session config.
19465        SparkConnectSession(std::boxed::Box<crate::model::SparkConnectConfig>),
19466    }
19467}
19468
19469/// Jupyter configuration for an interactive session.
19470#[derive(Clone, Default, PartialEq)]
19471#[non_exhaustive]
19472pub struct JupyterConfig {
19473    /// Optional. Kernel
19474    pub kernel: crate::model::jupyter_config::Kernel,
19475
19476    /// Optional. Display name, shown in the Jupyter kernelspec card.
19477    pub display_name: std::string::String,
19478
19479    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19480}
19481
19482impl JupyterConfig {
19483    pub fn new() -> Self {
19484        std::default::Default::default()
19485    }
19486
19487    /// Sets the value of [kernel][crate::model::JupyterConfig::kernel].
19488    ///
19489    /// # Example
19490    /// ```ignore,no_run
19491    /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19492    /// use google_cloud_dataproc_v1::model::jupyter_config::Kernel;
19493    /// let x0 = JupyterConfig::new().set_kernel(Kernel::Python);
19494    /// let x1 = JupyterConfig::new().set_kernel(Kernel::Scala);
19495    /// ```
19496    pub fn set_kernel<T: std::convert::Into<crate::model::jupyter_config::Kernel>>(
19497        mut self,
19498        v: T,
19499    ) -> Self {
19500        self.kernel = v.into();
19501        self
19502    }
19503
19504    /// Sets the value of [display_name][crate::model::JupyterConfig::display_name].
19505    ///
19506    /// # Example
19507    /// ```ignore,no_run
19508    /// # use google_cloud_dataproc_v1::model::JupyterConfig;
19509    /// let x = JupyterConfig::new().set_display_name("example");
19510    /// ```
19511    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19512        self.display_name = v.into();
19513        self
19514    }
19515}
19516
19517impl wkt::message::Message for JupyterConfig {
19518    fn typename() -> &'static str {
19519        "type.googleapis.com/google.cloud.dataproc.v1.JupyterConfig"
19520    }
19521}
19522
19523/// Defines additional types related to [JupyterConfig].
19524pub mod jupyter_config {
19525    #[allow(unused_imports)]
19526    use super::*;
19527
19528    /// Jupyter kernel types.
19529    ///
19530    /// # Working with unknown values
19531    ///
19532    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19533    /// additional enum variants at any time. Adding new variants is not considered
19534    /// a breaking change. Applications should write their code in anticipation of:
19535    ///
19536    /// - New values appearing in future releases of the client library, **and**
19537    /// - New values received dynamically, without application changes.
19538    ///
19539    /// Please consult the [Working with enums] section in the user guide for some
19540    /// guidelines.
19541    ///
19542    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19543    #[derive(Clone, Debug, PartialEq)]
19544    #[non_exhaustive]
19545    pub enum Kernel {
19546        /// The kernel is unknown.
19547        Unspecified,
19548        /// Python kernel.
19549        Python,
19550        /// Scala kernel.
19551        Scala,
19552        /// If set, the enum was initialized with an unknown value.
19553        ///
19554        /// Applications can examine the value using [Kernel::value] or
19555        /// [Kernel::name].
19556        UnknownValue(kernel::UnknownValue),
19557    }
19558
19559    #[doc(hidden)]
19560    pub mod kernel {
19561        #[allow(unused_imports)]
19562        use super::*;
19563        #[derive(Clone, Debug, PartialEq)]
19564        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19565    }
19566
19567    impl Kernel {
19568        /// Gets the enum value.
19569        ///
19570        /// Returns `None` if the enum contains an unknown value deserialized from
19571        /// the string representation of enums.
19572        pub fn value(&self) -> std::option::Option<i32> {
19573            match self {
19574                Self::Unspecified => std::option::Option::Some(0),
19575                Self::Python => std::option::Option::Some(1),
19576                Self::Scala => std::option::Option::Some(2),
19577                Self::UnknownValue(u) => u.0.value(),
19578            }
19579        }
19580
19581        /// Gets the enum value as a string.
19582        ///
19583        /// Returns `None` if the enum contains an unknown value deserialized from
19584        /// the integer representation of enums.
19585        pub fn name(&self) -> std::option::Option<&str> {
19586            match self {
19587                Self::Unspecified => std::option::Option::Some("KERNEL_UNSPECIFIED"),
19588                Self::Python => std::option::Option::Some("PYTHON"),
19589                Self::Scala => std::option::Option::Some("SCALA"),
19590                Self::UnknownValue(u) => u.0.name(),
19591            }
19592        }
19593    }
19594
19595    impl std::default::Default for Kernel {
19596        fn default() -> Self {
19597            use std::convert::From;
19598            Self::from(0)
19599        }
19600    }
19601
19602    impl std::fmt::Display for Kernel {
19603        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19604            wkt::internal::display_enum(f, self.name(), self.value())
19605        }
19606    }
19607
19608    impl std::convert::From<i32> for Kernel {
19609        fn from(value: i32) -> Self {
19610            match value {
19611                0 => Self::Unspecified,
19612                1 => Self::Python,
19613                2 => Self::Scala,
19614                _ => Self::UnknownValue(kernel::UnknownValue(
19615                    wkt::internal::UnknownEnumValue::Integer(value),
19616                )),
19617            }
19618        }
19619    }
19620
19621    impl std::convert::From<&str> for Kernel {
19622        fn from(value: &str) -> Self {
19623            use std::string::ToString;
19624            match value {
19625                "KERNEL_UNSPECIFIED" => Self::Unspecified,
19626                "PYTHON" => Self::Python,
19627                "SCALA" => Self::Scala,
19628                _ => Self::UnknownValue(kernel::UnknownValue(
19629                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19630                )),
19631            }
19632        }
19633    }
19634
19635    impl serde::ser::Serialize for Kernel {
19636        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19637        where
19638            S: serde::Serializer,
19639        {
19640            match self {
19641                Self::Unspecified => serializer.serialize_i32(0),
19642                Self::Python => serializer.serialize_i32(1),
19643                Self::Scala => serializer.serialize_i32(2),
19644                Self::UnknownValue(u) => u.0.serialize(serializer),
19645            }
19646        }
19647    }
19648
19649    impl<'de> serde::de::Deserialize<'de> for Kernel {
19650        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19651        where
19652            D: serde::Deserializer<'de>,
19653        {
19654            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kernel>::new(
19655                ".google.cloud.dataproc.v1.JupyterConfig.Kernel",
19656            ))
19657        }
19658    }
19659}
19660
19661/// Spark Connect configuration for an interactive session.
19662#[derive(Clone, Default, PartialEq)]
19663#[non_exhaustive]
19664pub struct SparkConnectConfig {
19665    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19666}
19667
19668impl SparkConnectConfig {
19669    pub fn new() -> Self {
19670        std::default::Default::default()
19671    }
19672}
19673
19674impl wkt::message::Message for SparkConnectConfig {
19675    fn typename() -> &'static str {
19676        "type.googleapis.com/google.cloud.dataproc.v1.SparkConnectConfig"
19677    }
19678}
19679
19680/// Runtime configuration for a workload.
19681#[derive(Clone, Default, PartialEq)]
19682#[non_exhaustive]
19683pub struct RuntimeConfig {
19684    /// Optional. Version of the batch runtime.
19685    pub version: std::string::String,
19686
19687    /// Optional. Optional custom container image for the job runtime environment.
19688    /// If not specified, a default container image will be used.
19689    pub container_image: std::string::String,
19690
19691    /// Optional. A mapping of property names to values, which are used to
19692    /// configure workload execution.
19693    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
19694
19695    /// Optional. Dependency repository configuration.
19696    pub repository_config: std::option::Option<crate::model::RepositoryConfig>,
19697
19698    /// Optional. Autotuning configuration of the workload.
19699    pub autotuning_config: std::option::Option<crate::model::AutotuningConfig>,
19700
19701    /// Optional. Cohort identifier. Identifies families of the workloads having
19702    /// the same shape, e.g. daily ETL jobs.
19703    pub cohort: std::string::String,
19704
19705    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19706}
19707
19708impl RuntimeConfig {
19709    pub fn new() -> Self {
19710        std::default::Default::default()
19711    }
19712
19713    /// Sets the value of [version][crate::model::RuntimeConfig::version].
19714    ///
19715    /// # Example
19716    /// ```ignore,no_run
19717    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19718    /// let x = RuntimeConfig::new().set_version("example");
19719    /// ```
19720    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19721        self.version = v.into();
19722        self
19723    }
19724
19725    /// Sets the value of [container_image][crate::model::RuntimeConfig::container_image].
19726    ///
19727    /// # Example
19728    /// ```ignore,no_run
19729    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19730    /// let x = RuntimeConfig::new().set_container_image("example");
19731    /// ```
19732    pub fn set_container_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19733        self.container_image = v.into();
19734        self
19735    }
19736
19737    /// Sets the value of [properties][crate::model::RuntimeConfig::properties].
19738    ///
19739    /// # Example
19740    /// ```ignore,no_run
19741    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19742    /// let x = RuntimeConfig::new().set_properties([
19743    ///     ("key0", "abc"),
19744    ///     ("key1", "xyz"),
19745    /// ]);
19746    /// ```
19747    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
19748    where
19749        T: std::iter::IntoIterator<Item = (K, V)>,
19750        K: std::convert::Into<std::string::String>,
19751        V: std::convert::Into<std::string::String>,
19752    {
19753        use std::iter::Iterator;
19754        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
19755        self
19756    }
19757
19758    /// Sets the value of [repository_config][crate::model::RuntimeConfig::repository_config].
19759    ///
19760    /// # Example
19761    /// ```ignore,no_run
19762    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19763    /// use google_cloud_dataproc_v1::model::RepositoryConfig;
19764    /// let x = RuntimeConfig::new().set_repository_config(RepositoryConfig::default()/* use setters */);
19765    /// ```
19766    pub fn set_repository_config<T>(mut self, v: T) -> Self
19767    where
19768        T: std::convert::Into<crate::model::RepositoryConfig>,
19769    {
19770        self.repository_config = std::option::Option::Some(v.into());
19771        self
19772    }
19773
19774    /// Sets or clears the value of [repository_config][crate::model::RuntimeConfig::repository_config].
19775    ///
19776    /// # Example
19777    /// ```ignore,no_run
19778    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19779    /// use google_cloud_dataproc_v1::model::RepositoryConfig;
19780    /// let x = RuntimeConfig::new().set_or_clear_repository_config(Some(RepositoryConfig::default()/* use setters */));
19781    /// let x = RuntimeConfig::new().set_or_clear_repository_config(None::<RepositoryConfig>);
19782    /// ```
19783    pub fn set_or_clear_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
19784    where
19785        T: std::convert::Into<crate::model::RepositoryConfig>,
19786    {
19787        self.repository_config = v.map(|x| x.into());
19788        self
19789    }
19790
19791    /// Sets the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
19792    ///
19793    /// # Example
19794    /// ```ignore,no_run
19795    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19796    /// use google_cloud_dataproc_v1::model::AutotuningConfig;
19797    /// let x = RuntimeConfig::new().set_autotuning_config(AutotuningConfig::default()/* use setters */);
19798    /// ```
19799    pub fn set_autotuning_config<T>(mut self, v: T) -> Self
19800    where
19801        T: std::convert::Into<crate::model::AutotuningConfig>,
19802    {
19803        self.autotuning_config = std::option::Option::Some(v.into());
19804        self
19805    }
19806
19807    /// Sets or clears the value of [autotuning_config][crate::model::RuntimeConfig::autotuning_config].
19808    ///
19809    /// # Example
19810    /// ```ignore,no_run
19811    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19812    /// use google_cloud_dataproc_v1::model::AutotuningConfig;
19813    /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(Some(AutotuningConfig::default()/* use setters */));
19814    /// let x = RuntimeConfig::new().set_or_clear_autotuning_config(None::<AutotuningConfig>);
19815    /// ```
19816    pub fn set_or_clear_autotuning_config<T>(mut self, v: std::option::Option<T>) -> Self
19817    where
19818        T: std::convert::Into<crate::model::AutotuningConfig>,
19819    {
19820        self.autotuning_config = v.map(|x| x.into());
19821        self
19822    }
19823
19824    /// Sets the value of [cohort][crate::model::RuntimeConfig::cohort].
19825    ///
19826    /// # Example
19827    /// ```ignore,no_run
19828    /// # use google_cloud_dataproc_v1::model::RuntimeConfig;
19829    /// let x = RuntimeConfig::new().set_cohort("example");
19830    /// ```
19831    pub fn set_cohort<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19832        self.cohort = v.into();
19833        self
19834    }
19835}
19836
19837impl wkt::message::Message for RuntimeConfig {
19838    fn typename() -> &'static str {
19839        "type.googleapis.com/google.cloud.dataproc.v1.RuntimeConfig"
19840    }
19841}
19842
19843/// Environment configuration for a workload.
19844#[derive(Clone, Default, PartialEq)]
19845#[non_exhaustive]
19846pub struct EnvironmentConfig {
19847    /// Optional. Execution configuration for a workload.
19848    pub execution_config: std::option::Option<crate::model::ExecutionConfig>,
19849
19850    /// Optional. Peripherals configuration that workload has access to.
19851    pub peripherals_config: std::option::Option<crate::model::PeripheralsConfig>,
19852
19853    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19854}
19855
19856impl EnvironmentConfig {
19857    pub fn new() -> Self {
19858        std::default::Default::default()
19859    }
19860
19861    /// Sets the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
19862    ///
19863    /// # Example
19864    /// ```ignore,no_run
19865    /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19866    /// use google_cloud_dataproc_v1::model::ExecutionConfig;
19867    /// let x = EnvironmentConfig::new().set_execution_config(ExecutionConfig::default()/* use setters */);
19868    /// ```
19869    pub fn set_execution_config<T>(mut self, v: T) -> Self
19870    where
19871        T: std::convert::Into<crate::model::ExecutionConfig>,
19872    {
19873        self.execution_config = std::option::Option::Some(v.into());
19874        self
19875    }
19876
19877    /// Sets or clears the value of [execution_config][crate::model::EnvironmentConfig::execution_config].
19878    ///
19879    /// # Example
19880    /// ```ignore,no_run
19881    /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19882    /// use google_cloud_dataproc_v1::model::ExecutionConfig;
19883    /// let x = EnvironmentConfig::new().set_or_clear_execution_config(Some(ExecutionConfig::default()/* use setters */));
19884    /// let x = EnvironmentConfig::new().set_or_clear_execution_config(None::<ExecutionConfig>);
19885    /// ```
19886    pub fn set_or_clear_execution_config<T>(mut self, v: std::option::Option<T>) -> Self
19887    where
19888        T: std::convert::Into<crate::model::ExecutionConfig>,
19889    {
19890        self.execution_config = v.map(|x| x.into());
19891        self
19892    }
19893
19894    /// Sets the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
19895    ///
19896    /// # Example
19897    /// ```ignore,no_run
19898    /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19899    /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
19900    /// let x = EnvironmentConfig::new().set_peripherals_config(PeripheralsConfig::default()/* use setters */);
19901    /// ```
19902    pub fn set_peripherals_config<T>(mut self, v: T) -> Self
19903    where
19904        T: std::convert::Into<crate::model::PeripheralsConfig>,
19905    {
19906        self.peripherals_config = std::option::Option::Some(v.into());
19907        self
19908    }
19909
19910    /// Sets or clears the value of [peripherals_config][crate::model::EnvironmentConfig::peripherals_config].
19911    ///
19912    /// # Example
19913    /// ```ignore,no_run
19914    /// # use google_cloud_dataproc_v1::model::EnvironmentConfig;
19915    /// use google_cloud_dataproc_v1::model::PeripheralsConfig;
19916    /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(Some(PeripheralsConfig::default()/* use setters */));
19917    /// let x = EnvironmentConfig::new().set_or_clear_peripherals_config(None::<PeripheralsConfig>);
19918    /// ```
19919    pub fn set_or_clear_peripherals_config<T>(mut self, v: std::option::Option<T>) -> Self
19920    where
19921        T: std::convert::Into<crate::model::PeripheralsConfig>,
19922    {
19923        self.peripherals_config = v.map(|x| x.into());
19924        self
19925    }
19926}
19927
19928impl wkt::message::Message for EnvironmentConfig {
19929    fn typename() -> &'static str {
19930        "type.googleapis.com/google.cloud.dataproc.v1.EnvironmentConfig"
19931    }
19932}
19933
19934/// Execution configuration for a workload.
19935#[derive(Clone, Default, PartialEq)]
19936#[non_exhaustive]
19937pub struct ExecutionConfig {
19938    /// Optional. Service account that used to execute workload.
19939    pub service_account: std::string::String,
19940
19941    /// Optional. Tags used for network traffic control.
19942    pub network_tags: std::vec::Vec<std::string::String>,
19943
19944    /// Optional. The Cloud KMS key to use for encryption.
19945    pub kms_key: std::string::String,
19946
19947    /// Optional. Applies to sessions only. The duration to keep the session alive
19948    /// while it's idling. Exceeding this threshold causes the session to
19949    /// terminate. This field cannot be set on a batch workload. Minimum value is
19950    /// 10 minutes; maximum value is 14 days (see JSON representation of
19951    /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
19952    /// Defaults to 1 hour if not set.
19953    /// If both `ttl` and `idle_ttl` are specified for an interactive session,
19954    /// the conditions are treated as `OR` conditions: the workload will be
19955    /// terminated when it has been idle for `idle_ttl` or when `ttl` has been
19956    /// exceeded, whichever occurs first.
19957    pub idle_ttl: std::option::Option<wkt::Duration>,
19958
19959    /// Optional. The duration after which the workload will be terminated,
19960    /// specified as the JSON representation for
19961    /// [Duration](https://protobuf.dev/programming-guides/proto3/#json).
19962    /// When the workload exceeds this duration, it will be unconditionally
19963    /// terminated without waiting for ongoing work to finish. If `ttl` is not
19964    /// specified for a batch workload, the workload will be allowed to run until
19965    /// it exits naturally (or run forever without exiting). If `ttl` is not
19966    /// specified for an interactive session, it defaults to 24 hours. If `ttl` is
19967    /// not specified for a batch that uses 2.1+ runtime version, it defaults to 4
19968    /// hours. Minimum value is 10 minutes; maximum value is 14 days. If both `ttl`
19969    /// and `idle_ttl` are specified (for an interactive session), the conditions
19970    /// are treated as `OR` conditions: the workload will be terminated when it has
19971    /// been idle for `idle_ttl` or when `ttl` has been exceeded, whichever occurs
19972    /// first.
19973    pub ttl: std::option::Option<wkt::Duration>,
19974
19975    /// Optional. A Cloud Storage bucket used to stage workload dependencies,
19976    /// config files, and store workload output and other ephemeral data, such as
19977    /// Spark history files. If you do not specify a staging bucket, Cloud Dataproc
19978    /// will determine a Cloud Storage location according to the region where your
19979    /// workload is running, and then create and manage project-level, per-location
19980    /// staging and temporary buckets.
19981    /// **This field requires a Cloud Storage bucket name, not a `gs://...` URI to
19982    /// a Cloud Storage bucket.**
19983    pub staging_bucket: std::string::String,
19984
19985    /// Optional. Authentication configuration used to set the default identity for
19986    /// the workload execution. The config specifies the type of identity
19987    /// (service account or user) that will be used by workloads to access
19988    /// resources on the project(s).
19989    pub authentication_config: std::option::Option<crate::model::AuthenticationConfig>,
19990
19991    /// Network configuration for workload execution.
19992    pub network: std::option::Option<crate::model::execution_config::Network>,
19993
19994    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19995}
19996
19997impl ExecutionConfig {
19998    pub fn new() -> Self {
19999        std::default::Default::default()
20000    }
20001
20002    /// Sets the value of [service_account][crate::model::ExecutionConfig::service_account].
20003    ///
20004    /// # Example
20005    /// ```ignore,no_run
20006    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20007    /// let x = ExecutionConfig::new().set_service_account("example");
20008    /// ```
20009    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20010        self.service_account = v.into();
20011        self
20012    }
20013
20014    /// Sets the value of [network_tags][crate::model::ExecutionConfig::network_tags].
20015    ///
20016    /// # Example
20017    /// ```ignore,no_run
20018    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20019    /// let x = ExecutionConfig::new().set_network_tags(["a", "b", "c"]);
20020    /// ```
20021    pub fn set_network_tags<T, V>(mut self, v: T) -> Self
20022    where
20023        T: std::iter::IntoIterator<Item = V>,
20024        V: std::convert::Into<std::string::String>,
20025    {
20026        use std::iter::Iterator;
20027        self.network_tags = v.into_iter().map(|i| i.into()).collect();
20028        self
20029    }
20030
20031    /// Sets the value of [kms_key][crate::model::ExecutionConfig::kms_key].
20032    ///
20033    /// # Example
20034    /// ```ignore,no_run
20035    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20036    /// let x = ExecutionConfig::new().set_kms_key("example");
20037    /// ```
20038    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20039        self.kms_key = v.into();
20040        self
20041    }
20042
20043    /// Sets the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
20044    ///
20045    /// # Example
20046    /// ```ignore,no_run
20047    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20048    /// use wkt::Duration;
20049    /// let x = ExecutionConfig::new().set_idle_ttl(Duration::default()/* use setters */);
20050    /// ```
20051    pub fn set_idle_ttl<T>(mut self, v: T) -> Self
20052    where
20053        T: std::convert::Into<wkt::Duration>,
20054    {
20055        self.idle_ttl = std::option::Option::Some(v.into());
20056        self
20057    }
20058
20059    /// Sets or clears the value of [idle_ttl][crate::model::ExecutionConfig::idle_ttl].
20060    ///
20061    /// # Example
20062    /// ```ignore,no_run
20063    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20064    /// use wkt::Duration;
20065    /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(Some(Duration::default()/* use setters */));
20066    /// let x = ExecutionConfig::new().set_or_clear_idle_ttl(None::<Duration>);
20067    /// ```
20068    pub fn set_or_clear_idle_ttl<T>(mut self, v: std::option::Option<T>) -> Self
20069    where
20070        T: std::convert::Into<wkt::Duration>,
20071    {
20072        self.idle_ttl = v.map(|x| x.into());
20073        self
20074    }
20075
20076    /// Sets the value of [ttl][crate::model::ExecutionConfig::ttl].
20077    ///
20078    /// # Example
20079    /// ```ignore,no_run
20080    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20081    /// use wkt::Duration;
20082    /// let x = ExecutionConfig::new().set_ttl(Duration::default()/* use setters */);
20083    /// ```
20084    pub fn set_ttl<T>(mut self, v: T) -> Self
20085    where
20086        T: std::convert::Into<wkt::Duration>,
20087    {
20088        self.ttl = std::option::Option::Some(v.into());
20089        self
20090    }
20091
20092    /// Sets or clears the value of [ttl][crate::model::ExecutionConfig::ttl].
20093    ///
20094    /// # Example
20095    /// ```ignore,no_run
20096    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20097    /// use wkt::Duration;
20098    /// let x = ExecutionConfig::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
20099    /// let x = ExecutionConfig::new().set_or_clear_ttl(None::<Duration>);
20100    /// ```
20101    pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
20102    where
20103        T: std::convert::Into<wkt::Duration>,
20104    {
20105        self.ttl = v.map(|x| x.into());
20106        self
20107    }
20108
20109    /// Sets the value of [staging_bucket][crate::model::ExecutionConfig::staging_bucket].
20110    ///
20111    /// # Example
20112    /// ```ignore,no_run
20113    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20114    /// let x = ExecutionConfig::new().set_staging_bucket("example");
20115    /// ```
20116    pub fn set_staging_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20117        self.staging_bucket = v.into();
20118        self
20119    }
20120
20121    /// Sets the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
20122    ///
20123    /// # Example
20124    /// ```ignore,no_run
20125    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20126    /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
20127    /// let x = ExecutionConfig::new().set_authentication_config(AuthenticationConfig::default()/* use setters */);
20128    /// ```
20129    pub fn set_authentication_config<T>(mut self, v: T) -> Self
20130    where
20131        T: std::convert::Into<crate::model::AuthenticationConfig>,
20132    {
20133        self.authentication_config = std::option::Option::Some(v.into());
20134        self
20135    }
20136
20137    /// Sets or clears the value of [authentication_config][crate::model::ExecutionConfig::authentication_config].
20138    ///
20139    /// # Example
20140    /// ```ignore,no_run
20141    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20142    /// use google_cloud_dataproc_v1::model::AuthenticationConfig;
20143    /// let x = ExecutionConfig::new().set_or_clear_authentication_config(Some(AuthenticationConfig::default()/* use setters */));
20144    /// let x = ExecutionConfig::new().set_or_clear_authentication_config(None::<AuthenticationConfig>);
20145    /// ```
20146    pub fn set_or_clear_authentication_config<T>(mut self, v: std::option::Option<T>) -> Self
20147    where
20148        T: std::convert::Into<crate::model::AuthenticationConfig>,
20149    {
20150        self.authentication_config = v.map(|x| x.into());
20151        self
20152    }
20153
20154    /// Sets the value of [network][crate::model::ExecutionConfig::network].
20155    ///
20156    /// Note that all the setters affecting `network` are mutually
20157    /// exclusive.
20158    ///
20159    /// # Example
20160    /// ```ignore,no_run
20161    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20162    /// use google_cloud_dataproc_v1::model::execution_config::Network;
20163    /// let x = ExecutionConfig::new().set_network(Some(Network::NetworkUri("example".to_string())));
20164    /// ```
20165    pub fn set_network<
20166        T: std::convert::Into<std::option::Option<crate::model::execution_config::Network>>,
20167    >(
20168        mut self,
20169        v: T,
20170    ) -> Self {
20171        self.network = v.into();
20172        self
20173    }
20174
20175    /// The value of [network][crate::model::ExecutionConfig::network]
20176    /// if it holds a `NetworkUri`, `None` if the field is not set or
20177    /// holds a different branch.
20178    pub fn network_uri(&self) -> std::option::Option<&std::string::String> {
20179        #[allow(unreachable_patterns)]
20180        self.network.as_ref().and_then(|v| match v {
20181            crate::model::execution_config::Network::NetworkUri(v) => std::option::Option::Some(v),
20182            _ => std::option::Option::None,
20183        })
20184    }
20185
20186    /// Sets the value of [network][crate::model::ExecutionConfig::network]
20187    /// to hold a `NetworkUri`.
20188    ///
20189    /// Note that all the setters affecting `network` are
20190    /// mutually exclusive.
20191    ///
20192    /// # Example
20193    /// ```ignore,no_run
20194    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20195    /// let x = ExecutionConfig::new().set_network_uri("example");
20196    /// assert!(x.network_uri().is_some());
20197    /// assert!(x.subnetwork_uri().is_none());
20198    /// ```
20199    pub fn set_network_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20200        self.network = std::option::Option::Some(
20201            crate::model::execution_config::Network::NetworkUri(v.into()),
20202        );
20203        self
20204    }
20205
20206    /// The value of [network][crate::model::ExecutionConfig::network]
20207    /// if it holds a `SubnetworkUri`, `None` if the field is not set or
20208    /// holds a different branch.
20209    pub fn subnetwork_uri(&self) -> std::option::Option<&std::string::String> {
20210        #[allow(unreachable_patterns)]
20211        self.network.as_ref().and_then(|v| match v {
20212            crate::model::execution_config::Network::SubnetworkUri(v) => {
20213                std::option::Option::Some(v)
20214            }
20215            _ => std::option::Option::None,
20216        })
20217    }
20218
20219    /// Sets the value of [network][crate::model::ExecutionConfig::network]
20220    /// to hold a `SubnetworkUri`.
20221    ///
20222    /// Note that all the setters affecting `network` are
20223    /// mutually exclusive.
20224    ///
20225    /// # Example
20226    /// ```ignore,no_run
20227    /// # use google_cloud_dataproc_v1::model::ExecutionConfig;
20228    /// let x = ExecutionConfig::new().set_subnetwork_uri("example");
20229    /// assert!(x.subnetwork_uri().is_some());
20230    /// assert!(x.network_uri().is_none());
20231    /// ```
20232    pub fn set_subnetwork_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20233        self.network = std::option::Option::Some(
20234            crate::model::execution_config::Network::SubnetworkUri(v.into()),
20235        );
20236        self
20237    }
20238}
20239
20240impl wkt::message::Message for ExecutionConfig {
20241    fn typename() -> &'static str {
20242        "type.googleapis.com/google.cloud.dataproc.v1.ExecutionConfig"
20243    }
20244}
20245
20246/// Defines additional types related to [ExecutionConfig].
20247pub mod execution_config {
20248    #[allow(unused_imports)]
20249    use super::*;
20250
20251    /// Network configuration for workload execution.
20252    #[derive(Clone, Debug, PartialEq)]
20253    #[non_exhaustive]
20254    pub enum Network {
20255        /// Optional. Network URI to connect workload to.
20256        NetworkUri(std::string::String),
20257        /// Optional. Subnetwork URI to connect workload to.
20258        SubnetworkUri(std::string::String),
20259    }
20260}
20261
20262/// Spark History Server configuration for the workload.
20263#[derive(Clone, Default, PartialEq)]
20264#[non_exhaustive]
20265pub struct SparkHistoryServerConfig {
20266    /// Optional. Resource name of an existing Dataproc Cluster to act as a Spark
20267    /// History Server for the workload.
20268    ///
20269    /// Example:
20270    ///
20271    /// * `projects/[project_id]/regions/[region]/clusters/[cluster_name]`
20272    pub dataproc_cluster: std::string::String,
20273
20274    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20275}
20276
20277impl SparkHistoryServerConfig {
20278    pub fn new() -> Self {
20279        std::default::Default::default()
20280    }
20281
20282    /// Sets the value of [dataproc_cluster][crate::model::SparkHistoryServerConfig::dataproc_cluster].
20283    ///
20284    /// # Example
20285    /// ```ignore,no_run
20286    /// # use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20287    /// let x = SparkHistoryServerConfig::new().set_dataproc_cluster("example");
20288    /// ```
20289    pub fn set_dataproc_cluster<T: std::convert::Into<std::string::String>>(
20290        mut self,
20291        v: T,
20292    ) -> Self {
20293        self.dataproc_cluster = v.into();
20294        self
20295    }
20296}
20297
20298impl wkt::message::Message for SparkHistoryServerConfig {
20299    fn typename() -> &'static str {
20300        "type.googleapis.com/google.cloud.dataproc.v1.SparkHistoryServerConfig"
20301    }
20302}
20303
20304/// Auxiliary services configuration for a workload.
20305#[derive(Clone, Default, PartialEq)]
20306#[non_exhaustive]
20307pub struct PeripheralsConfig {
20308    /// Optional. Resource name of an existing Dataproc Metastore service.
20309    ///
20310    /// Example:
20311    ///
20312    /// * `projects/[project_id]/locations/[region]/services/[service_id]`
20313    pub metastore_service: std::string::String,
20314
20315    /// Optional. The Spark History Server configuration for the workload.
20316    pub spark_history_server_config: std::option::Option<crate::model::SparkHistoryServerConfig>,
20317
20318    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20319}
20320
20321impl PeripheralsConfig {
20322    pub fn new() -> Self {
20323        std::default::Default::default()
20324    }
20325
20326    /// Sets the value of [metastore_service][crate::model::PeripheralsConfig::metastore_service].
20327    ///
20328    /// # Example
20329    /// ```ignore,no_run
20330    /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20331    /// let x = PeripheralsConfig::new().set_metastore_service("example");
20332    /// ```
20333    pub fn set_metastore_service<T: std::convert::Into<std::string::String>>(
20334        mut self,
20335        v: T,
20336    ) -> Self {
20337        self.metastore_service = v.into();
20338        self
20339    }
20340
20341    /// Sets the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20342    ///
20343    /// # Example
20344    /// ```ignore,no_run
20345    /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20346    /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20347    /// let x = PeripheralsConfig::new().set_spark_history_server_config(SparkHistoryServerConfig::default()/* use setters */);
20348    /// ```
20349    pub fn set_spark_history_server_config<T>(mut self, v: T) -> Self
20350    where
20351        T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20352    {
20353        self.spark_history_server_config = std::option::Option::Some(v.into());
20354        self
20355    }
20356
20357    /// Sets or clears the value of [spark_history_server_config][crate::model::PeripheralsConfig::spark_history_server_config].
20358    ///
20359    /// # Example
20360    /// ```ignore,no_run
20361    /// # use google_cloud_dataproc_v1::model::PeripheralsConfig;
20362    /// use google_cloud_dataproc_v1::model::SparkHistoryServerConfig;
20363    /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(Some(SparkHistoryServerConfig::default()/* use setters */));
20364    /// let x = PeripheralsConfig::new().set_or_clear_spark_history_server_config(None::<SparkHistoryServerConfig>);
20365    /// ```
20366    pub fn set_or_clear_spark_history_server_config<T>(mut self, v: std::option::Option<T>) -> Self
20367    where
20368        T: std::convert::Into<crate::model::SparkHistoryServerConfig>,
20369    {
20370        self.spark_history_server_config = v.map(|x| x.into());
20371        self
20372    }
20373}
20374
20375impl wkt::message::Message for PeripheralsConfig {
20376    fn typename() -> &'static str {
20377        "type.googleapis.com/google.cloud.dataproc.v1.PeripheralsConfig"
20378    }
20379}
20380
20381/// Runtime information about workload execution.
20382#[derive(Clone, Default, PartialEq)]
20383#[non_exhaustive]
20384pub struct RuntimeInfo {
20385    /// Output only. Map of remote access endpoints (such as web interfaces and
20386    /// APIs) to their URIs.
20387    pub endpoints: std::collections::HashMap<std::string::String, std::string::String>,
20388
20389    /// Output only. A URI pointing to the location of the stdout and stderr of the
20390    /// workload.
20391    pub output_uri: std::string::String,
20392
20393    /// Output only. A URI pointing to the location of the diagnostics tarball.
20394    pub diagnostic_output_uri: std::string::String,
20395
20396    /// Output only. Approximate workload resource usage, calculated when
20397    /// the workload completes (see [Dataproc Serverless pricing]
20398    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20399    ///
20400    /// **Note:** This metric calculation may change in the future, for
20401    /// example, to capture cumulative workload resource
20402    /// consumption during workload execution (see the
20403    /// [Dataproc Serverless release notes]
20404    /// (<https://cloud.google.com/dataproc-serverless/docs/release-notes>)
20405    /// for announcements, changes, fixes
20406    /// and other Dataproc developments).
20407    pub approximate_usage: std::option::Option<crate::model::UsageMetrics>,
20408
20409    /// Output only. Snapshot of current workload resource usage.
20410    pub current_usage: std::option::Option<crate::model::UsageSnapshot>,
20411
20412    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20413}
20414
20415impl RuntimeInfo {
20416    pub fn new() -> Self {
20417        std::default::Default::default()
20418    }
20419
20420    /// Sets the value of [endpoints][crate::model::RuntimeInfo::endpoints].
20421    ///
20422    /// # Example
20423    /// ```ignore,no_run
20424    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20425    /// let x = RuntimeInfo::new().set_endpoints([
20426    ///     ("key0", "abc"),
20427    ///     ("key1", "xyz"),
20428    /// ]);
20429    /// ```
20430    pub fn set_endpoints<T, K, V>(mut self, v: T) -> Self
20431    where
20432        T: std::iter::IntoIterator<Item = (K, V)>,
20433        K: std::convert::Into<std::string::String>,
20434        V: std::convert::Into<std::string::String>,
20435    {
20436        use std::iter::Iterator;
20437        self.endpoints = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20438        self
20439    }
20440
20441    /// Sets the value of [output_uri][crate::model::RuntimeInfo::output_uri].
20442    ///
20443    /// # Example
20444    /// ```ignore,no_run
20445    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20446    /// let x = RuntimeInfo::new().set_output_uri("example");
20447    /// ```
20448    pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20449        self.output_uri = v.into();
20450        self
20451    }
20452
20453    /// Sets the value of [diagnostic_output_uri][crate::model::RuntimeInfo::diagnostic_output_uri].
20454    ///
20455    /// # Example
20456    /// ```ignore,no_run
20457    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20458    /// let x = RuntimeInfo::new().set_diagnostic_output_uri("example");
20459    /// ```
20460    pub fn set_diagnostic_output_uri<T: std::convert::Into<std::string::String>>(
20461        mut self,
20462        v: T,
20463    ) -> Self {
20464        self.diagnostic_output_uri = v.into();
20465        self
20466    }
20467
20468    /// Sets the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20469    ///
20470    /// # Example
20471    /// ```ignore,no_run
20472    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20473    /// use google_cloud_dataproc_v1::model::UsageMetrics;
20474    /// let x = RuntimeInfo::new().set_approximate_usage(UsageMetrics::default()/* use setters */);
20475    /// ```
20476    pub fn set_approximate_usage<T>(mut self, v: T) -> Self
20477    where
20478        T: std::convert::Into<crate::model::UsageMetrics>,
20479    {
20480        self.approximate_usage = std::option::Option::Some(v.into());
20481        self
20482    }
20483
20484    /// Sets or clears the value of [approximate_usage][crate::model::RuntimeInfo::approximate_usage].
20485    ///
20486    /// # Example
20487    /// ```ignore,no_run
20488    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20489    /// use google_cloud_dataproc_v1::model::UsageMetrics;
20490    /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(Some(UsageMetrics::default()/* use setters */));
20491    /// let x = RuntimeInfo::new().set_or_clear_approximate_usage(None::<UsageMetrics>);
20492    /// ```
20493    pub fn set_or_clear_approximate_usage<T>(mut self, v: std::option::Option<T>) -> Self
20494    where
20495        T: std::convert::Into<crate::model::UsageMetrics>,
20496    {
20497        self.approximate_usage = v.map(|x| x.into());
20498        self
20499    }
20500
20501    /// Sets the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20502    ///
20503    /// # Example
20504    /// ```ignore,no_run
20505    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20506    /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20507    /// let x = RuntimeInfo::new().set_current_usage(UsageSnapshot::default()/* use setters */);
20508    /// ```
20509    pub fn set_current_usage<T>(mut self, v: T) -> Self
20510    where
20511        T: std::convert::Into<crate::model::UsageSnapshot>,
20512    {
20513        self.current_usage = std::option::Option::Some(v.into());
20514        self
20515    }
20516
20517    /// Sets or clears the value of [current_usage][crate::model::RuntimeInfo::current_usage].
20518    ///
20519    /// # Example
20520    /// ```ignore,no_run
20521    /// # use google_cloud_dataproc_v1::model::RuntimeInfo;
20522    /// use google_cloud_dataproc_v1::model::UsageSnapshot;
20523    /// let x = RuntimeInfo::new().set_or_clear_current_usage(Some(UsageSnapshot::default()/* use setters */));
20524    /// let x = RuntimeInfo::new().set_or_clear_current_usage(None::<UsageSnapshot>);
20525    /// ```
20526    pub fn set_or_clear_current_usage<T>(mut self, v: std::option::Option<T>) -> Self
20527    where
20528        T: std::convert::Into<crate::model::UsageSnapshot>,
20529    {
20530        self.current_usage = v.map(|x| x.into());
20531        self
20532    }
20533}
20534
20535impl wkt::message::Message for RuntimeInfo {
20536    fn typename() -> &'static str {
20537        "type.googleapis.com/google.cloud.dataproc.v1.RuntimeInfo"
20538    }
20539}
20540
20541/// Usage metrics represent approximate total resources consumed by a workload.
20542#[derive(Clone, Default, PartialEq)]
20543#[non_exhaustive]
20544pub struct UsageMetrics {
20545    /// Optional. DCU (Dataproc Compute Units) usage in (`milliDCU` x `seconds`)
20546    /// (see [Dataproc Serverless pricing]
20547    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20548    pub milli_dcu_seconds: i64,
20549
20550    /// Optional. Shuffle storage usage in (`GB` x `seconds`) (see
20551    /// [Dataproc Serverless pricing]
20552    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20553    pub shuffle_storage_gb_seconds: i64,
20554
20555    /// Optional. Accelerator usage in (`milliAccelerator` x `seconds`) (see
20556    /// [Dataproc Serverless pricing]
20557    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20558    pub milli_accelerator_seconds: i64,
20559
20560    /// Optional. Accelerator type being used, if any
20561    pub accelerator_type: std::string::String,
20562
20563    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20564}
20565
20566impl UsageMetrics {
20567    pub fn new() -> Self {
20568        std::default::Default::default()
20569    }
20570
20571    /// Sets the value of [milli_dcu_seconds][crate::model::UsageMetrics::milli_dcu_seconds].
20572    ///
20573    /// # Example
20574    /// ```ignore,no_run
20575    /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20576    /// let x = UsageMetrics::new().set_milli_dcu_seconds(42);
20577    /// ```
20578    pub fn set_milli_dcu_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20579        self.milli_dcu_seconds = v.into();
20580        self
20581    }
20582
20583    /// Sets the value of [shuffle_storage_gb_seconds][crate::model::UsageMetrics::shuffle_storage_gb_seconds].
20584    ///
20585    /// # Example
20586    /// ```ignore,no_run
20587    /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20588    /// let x = UsageMetrics::new().set_shuffle_storage_gb_seconds(42);
20589    /// ```
20590    pub fn set_shuffle_storage_gb_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20591        self.shuffle_storage_gb_seconds = v.into();
20592        self
20593    }
20594
20595    /// Sets the value of [milli_accelerator_seconds][crate::model::UsageMetrics::milli_accelerator_seconds].
20596    ///
20597    /// # Example
20598    /// ```ignore,no_run
20599    /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20600    /// let x = UsageMetrics::new().set_milli_accelerator_seconds(42);
20601    /// ```
20602    pub fn set_milli_accelerator_seconds<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20603        self.milli_accelerator_seconds = v.into();
20604        self
20605    }
20606
20607    /// Sets the value of [accelerator_type][crate::model::UsageMetrics::accelerator_type].
20608    ///
20609    /// # Example
20610    /// ```ignore,no_run
20611    /// # use google_cloud_dataproc_v1::model::UsageMetrics;
20612    /// let x = UsageMetrics::new().set_accelerator_type("example");
20613    /// ```
20614    pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
20615        mut self,
20616        v: T,
20617    ) -> Self {
20618        self.accelerator_type = v.into();
20619        self
20620    }
20621}
20622
20623impl wkt::message::Message for UsageMetrics {
20624    fn typename() -> &'static str {
20625        "type.googleapis.com/google.cloud.dataproc.v1.UsageMetrics"
20626    }
20627}
20628
20629/// The usage snapshot represents the resources consumed by a workload at a
20630/// specified time.
20631#[derive(Clone, Default, PartialEq)]
20632#[non_exhaustive]
20633pub struct UsageSnapshot {
20634    /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see
20635    /// [Dataproc Serverless pricing]
20636    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20637    pub milli_dcu: i64,
20638
20639    /// Optional. Shuffle Storage in gigabytes (GB). (see [Dataproc Serverless
20640    /// pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
20641    pub shuffle_storage_gb: i64,
20642
20643    /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at
20644    /// premium tier (see [Dataproc Serverless pricing]
20645    /// (<https://cloud.google.com/dataproc-serverless/pricing>)).
20646    pub milli_dcu_premium: i64,
20647
20648    /// Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see
20649    /// [Dataproc Serverless pricing]
20650    /// (<https://cloud.google.com/dataproc-serverless/pricing>))
20651    pub shuffle_storage_gb_premium: i64,
20652
20653    /// Optional. Milli (one-thousandth) accelerator. (see [Dataproc
20654    /// Serverless pricing] (<https://cloud.google.com/dataproc-serverless/pricing>))
20655    pub milli_accelerator: i64,
20656
20657    /// Optional. Accelerator type being used, if any
20658    pub accelerator_type: std::string::String,
20659
20660    /// Optional. The timestamp of the usage snapshot.
20661    pub snapshot_time: std::option::Option<wkt::Timestamp>,
20662
20663    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20664}
20665
20666impl UsageSnapshot {
20667    pub fn new() -> Self {
20668        std::default::Default::default()
20669    }
20670
20671    /// Sets the value of [milli_dcu][crate::model::UsageSnapshot::milli_dcu].
20672    ///
20673    /// # Example
20674    /// ```ignore,no_run
20675    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20676    /// let x = UsageSnapshot::new().set_milli_dcu(42);
20677    /// ```
20678    pub fn set_milli_dcu<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20679        self.milli_dcu = v.into();
20680        self
20681    }
20682
20683    /// Sets the value of [shuffle_storage_gb][crate::model::UsageSnapshot::shuffle_storage_gb].
20684    ///
20685    /// # Example
20686    /// ```ignore,no_run
20687    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20688    /// let x = UsageSnapshot::new().set_shuffle_storage_gb(42);
20689    /// ```
20690    pub fn set_shuffle_storage_gb<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20691        self.shuffle_storage_gb = v.into();
20692        self
20693    }
20694
20695    /// Sets the value of [milli_dcu_premium][crate::model::UsageSnapshot::milli_dcu_premium].
20696    ///
20697    /// # Example
20698    /// ```ignore,no_run
20699    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20700    /// let x = UsageSnapshot::new().set_milli_dcu_premium(42);
20701    /// ```
20702    pub fn set_milli_dcu_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20703        self.milli_dcu_premium = v.into();
20704        self
20705    }
20706
20707    /// Sets the value of [shuffle_storage_gb_premium][crate::model::UsageSnapshot::shuffle_storage_gb_premium].
20708    ///
20709    /// # Example
20710    /// ```ignore,no_run
20711    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20712    /// let x = UsageSnapshot::new().set_shuffle_storage_gb_premium(42);
20713    /// ```
20714    pub fn set_shuffle_storage_gb_premium<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20715        self.shuffle_storage_gb_premium = v.into();
20716        self
20717    }
20718
20719    /// Sets the value of [milli_accelerator][crate::model::UsageSnapshot::milli_accelerator].
20720    ///
20721    /// # Example
20722    /// ```ignore,no_run
20723    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20724    /// let x = UsageSnapshot::new().set_milli_accelerator(42);
20725    /// ```
20726    pub fn set_milli_accelerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
20727        self.milli_accelerator = v.into();
20728        self
20729    }
20730
20731    /// Sets the value of [accelerator_type][crate::model::UsageSnapshot::accelerator_type].
20732    ///
20733    /// # Example
20734    /// ```ignore,no_run
20735    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20736    /// let x = UsageSnapshot::new().set_accelerator_type("example");
20737    /// ```
20738    pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
20739        mut self,
20740        v: T,
20741    ) -> Self {
20742        self.accelerator_type = v.into();
20743        self
20744    }
20745
20746    /// Sets the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
20747    ///
20748    /// # Example
20749    /// ```ignore,no_run
20750    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20751    /// use wkt::Timestamp;
20752    /// let x = UsageSnapshot::new().set_snapshot_time(Timestamp::default()/* use setters */);
20753    /// ```
20754    pub fn set_snapshot_time<T>(mut self, v: T) -> Self
20755    where
20756        T: std::convert::Into<wkt::Timestamp>,
20757    {
20758        self.snapshot_time = std::option::Option::Some(v.into());
20759        self
20760    }
20761
20762    /// Sets or clears the value of [snapshot_time][crate::model::UsageSnapshot::snapshot_time].
20763    ///
20764    /// # Example
20765    /// ```ignore,no_run
20766    /// # use google_cloud_dataproc_v1::model::UsageSnapshot;
20767    /// use wkt::Timestamp;
20768    /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(Some(Timestamp::default()/* use setters */));
20769    /// let x = UsageSnapshot::new().set_or_clear_snapshot_time(None::<Timestamp>);
20770    /// ```
20771    pub fn set_or_clear_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
20772    where
20773        T: std::convert::Into<wkt::Timestamp>,
20774    {
20775        self.snapshot_time = v.map(|x| x.into());
20776        self
20777    }
20778}
20779
20780impl wkt::message::Message for UsageSnapshot {
20781    fn typename() -> &'static str {
20782        "type.googleapis.com/google.cloud.dataproc.v1.UsageSnapshot"
20783    }
20784}
20785
20786/// The cluster's GKE config.
20787#[derive(Clone, Default, PartialEq)]
20788#[non_exhaustive]
20789pub struct GkeClusterConfig {
20790    /// Optional. A target GKE cluster to deploy to. It must be in the same project
20791    /// and region as the Dataproc cluster (the GKE cluster can be zonal or
20792    /// regional). Format:
20793    /// 'projects/{project}/locations/{location}/clusters/{cluster_id}'
20794    pub gke_cluster_target: std::string::String,
20795
20796    /// Optional. GKE node pools where workloads will be scheduled. At least one
20797    /// node pool must be assigned the `DEFAULT`
20798    /// [GkeNodePoolTarget.Role][google.cloud.dataproc.v1.GkeNodePoolTarget.Role].
20799    /// If a `GkeNodePoolTarget` is not specified, Dataproc constructs a `DEFAULT`
20800    /// `GkeNodePoolTarget`. Each role can be given to only one
20801    /// `GkeNodePoolTarget`. All node pools must have the same location settings.
20802    ///
20803    /// [google.cloud.dataproc.v1.GkeNodePoolTarget.Role]: crate::model::gke_node_pool_target::Role
20804    pub node_pool_target: std::vec::Vec<crate::model::GkeNodePoolTarget>,
20805
20806    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20807}
20808
20809impl GkeClusterConfig {
20810    pub fn new() -> Self {
20811        std::default::Default::default()
20812    }
20813
20814    /// Sets the value of [gke_cluster_target][crate::model::GkeClusterConfig::gke_cluster_target].
20815    ///
20816    /// # Example
20817    /// ```ignore,no_run
20818    /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
20819    /// let x = GkeClusterConfig::new().set_gke_cluster_target("example");
20820    /// ```
20821    pub fn set_gke_cluster_target<T: std::convert::Into<std::string::String>>(
20822        mut self,
20823        v: T,
20824    ) -> Self {
20825        self.gke_cluster_target = v.into();
20826        self
20827    }
20828
20829    /// Sets the value of [node_pool_target][crate::model::GkeClusterConfig::node_pool_target].
20830    ///
20831    /// # Example
20832    /// ```ignore,no_run
20833    /// # use google_cloud_dataproc_v1::model::GkeClusterConfig;
20834    /// use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
20835    /// let x = GkeClusterConfig::new()
20836    ///     .set_node_pool_target([
20837    ///         GkeNodePoolTarget::default()/* use setters */,
20838    ///         GkeNodePoolTarget::default()/* use (different) setters */,
20839    ///     ]);
20840    /// ```
20841    pub fn set_node_pool_target<T, V>(mut self, v: T) -> Self
20842    where
20843        T: std::iter::IntoIterator<Item = V>,
20844        V: std::convert::Into<crate::model::GkeNodePoolTarget>,
20845    {
20846        use std::iter::Iterator;
20847        self.node_pool_target = v.into_iter().map(|i| i.into()).collect();
20848        self
20849    }
20850}
20851
20852impl wkt::message::Message for GkeClusterConfig {
20853    fn typename() -> &'static str {
20854        "type.googleapis.com/google.cloud.dataproc.v1.GkeClusterConfig"
20855    }
20856}
20857
20858/// The configuration for running the Dataproc cluster on Kubernetes.
20859#[derive(Clone, Default, PartialEq)]
20860#[non_exhaustive]
20861pub struct KubernetesClusterConfig {
20862    /// Optional. A namespace within the Kubernetes cluster to deploy into. If this
20863    /// namespace does not exist, it is created. If it exists, Dataproc verifies
20864    /// that another Dataproc VirtualCluster is not installed into it. If not
20865    /// specified, the name of the Dataproc Cluster is used.
20866    pub kubernetes_namespace: std::string::String,
20867
20868    /// Optional. The software configuration for this Dataproc cluster running on
20869    /// Kubernetes.
20870    pub kubernetes_software_config: std::option::Option<crate::model::KubernetesSoftwareConfig>,
20871
20872    pub config: std::option::Option<crate::model::kubernetes_cluster_config::Config>,
20873
20874    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20875}
20876
20877impl KubernetesClusterConfig {
20878    pub fn new() -> Self {
20879        std::default::Default::default()
20880    }
20881
20882    /// Sets the value of [kubernetes_namespace][crate::model::KubernetesClusterConfig::kubernetes_namespace].
20883    ///
20884    /// # Example
20885    /// ```ignore,no_run
20886    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20887    /// let x = KubernetesClusterConfig::new().set_kubernetes_namespace("example");
20888    /// ```
20889    pub fn set_kubernetes_namespace<T: std::convert::Into<std::string::String>>(
20890        mut self,
20891        v: T,
20892    ) -> Self {
20893        self.kubernetes_namespace = v.into();
20894        self
20895    }
20896
20897    /// Sets the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
20898    ///
20899    /// # Example
20900    /// ```ignore,no_run
20901    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20902    /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20903    /// let x = KubernetesClusterConfig::new().set_kubernetes_software_config(KubernetesSoftwareConfig::default()/* use setters */);
20904    /// ```
20905    pub fn set_kubernetes_software_config<T>(mut self, v: T) -> Self
20906    where
20907        T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
20908    {
20909        self.kubernetes_software_config = std::option::Option::Some(v.into());
20910        self
20911    }
20912
20913    /// Sets or clears the value of [kubernetes_software_config][crate::model::KubernetesClusterConfig::kubernetes_software_config].
20914    ///
20915    /// # Example
20916    /// ```ignore,no_run
20917    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20918    /// use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
20919    /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(Some(KubernetesSoftwareConfig::default()/* use setters */));
20920    /// let x = KubernetesClusterConfig::new().set_or_clear_kubernetes_software_config(None::<KubernetesSoftwareConfig>);
20921    /// ```
20922    pub fn set_or_clear_kubernetes_software_config<T>(mut self, v: std::option::Option<T>) -> Self
20923    where
20924        T: std::convert::Into<crate::model::KubernetesSoftwareConfig>,
20925    {
20926        self.kubernetes_software_config = v.map(|x| x.into());
20927        self
20928    }
20929
20930    /// Sets the value of [config][crate::model::KubernetesClusterConfig::config].
20931    ///
20932    /// Note that all the setters affecting `config` are mutually
20933    /// exclusive.
20934    ///
20935    /// # Example
20936    /// ```ignore,no_run
20937    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20938    /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
20939    /// let x = KubernetesClusterConfig::new().set_config(Some(
20940    ///     google_cloud_dataproc_v1::model::kubernetes_cluster_config::Config::GkeClusterConfig(GkeClusterConfig::default().into())));
20941    /// ```
20942    pub fn set_config<
20943        T: std::convert::Into<std::option::Option<crate::model::kubernetes_cluster_config::Config>>,
20944    >(
20945        mut self,
20946        v: T,
20947    ) -> Self {
20948        self.config = v.into();
20949        self
20950    }
20951
20952    /// The value of [config][crate::model::KubernetesClusterConfig::config]
20953    /// if it holds a `GkeClusterConfig`, `None` if the field is not set or
20954    /// holds a different branch.
20955    pub fn gke_cluster_config(
20956        &self,
20957    ) -> std::option::Option<&std::boxed::Box<crate::model::GkeClusterConfig>> {
20958        #[allow(unreachable_patterns)]
20959        self.config.as_ref().and_then(|v| match v {
20960            crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v) => {
20961                std::option::Option::Some(v)
20962            }
20963            _ => std::option::Option::None,
20964        })
20965    }
20966
20967    /// Sets the value of [config][crate::model::KubernetesClusterConfig::config]
20968    /// to hold a `GkeClusterConfig`.
20969    ///
20970    /// Note that all the setters affecting `config` are
20971    /// mutually exclusive.
20972    ///
20973    /// # Example
20974    /// ```ignore,no_run
20975    /// # use google_cloud_dataproc_v1::model::KubernetesClusterConfig;
20976    /// use google_cloud_dataproc_v1::model::GkeClusterConfig;
20977    /// let x = KubernetesClusterConfig::new().set_gke_cluster_config(GkeClusterConfig::default()/* use setters */);
20978    /// assert!(x.gke_cluster_config().is_some());
20979    /// ```
20980    pub fn set_gke_cluster_config<
20981        T: std::convert::Into<std::boxed::Box<crate::model::GkeClusterConfig>>,
20982    >(
20983        mut self,
20984        v: T,
20985    ) -> Self {
20986        self.config = std::option::Option::Some(
20987            crate::model::kubernetes_cluster_config::Config::GkeClusterConfig(v.into()),
20988        );
20989        self
20990    }
20991}
20992
20993impl wkt::message::Message for KubernetesClusterConfig {
20994    fn typename() -> &'static str {
20995        "type.googleapis.com/google.cloud.dataproc.v1.KubernetesClusterConfig"
20996    }
20997}
20998
20999/// Defines additional types related to [KubernetesClusterConfig].
21000pub mod kubernetes_cluster_config {
21001    #[allow(unused_imports)]
21002    use super::*;
21003
21004    #[derive(Clone, Debug, PartialEq)]
21005    #[non_exhaustive]
21006    pub enum Config {
21007        /// Required. The configuration for running the Dataproc cluster on GKE.
21008        GkeClusterConfig(std::boxed::Box<crate::model::GkeClusterConfig>),
21009    }
21010}
21011
21012/// The software configuration for this Dataproc cluster running on Kubernetes.
21013#[derive(Clone, Default, PartialEq)]
21014#[non_exhaustive]
21015pub struct KubernetesSoftwareConfig {
21016    /// The components that should be installed in this Dataproc cluster. The key
21017    /// must be a string from the KubernetesComponent enumeration. The value is
21018    /// the version of the software to be installed.
21019    /// At least one entry must be specified.
21020    pub component_version: std::collections::HashMap<std::string::String, std::string::String>,
21021
21022    /// The properties to set on daemon config files.
21023    ///
21024    /// Property keys are specified in `prefix:property` format, for example
21025    /// `spark:spark.kubernetes.container.image`. The following are supported
21026    /// prefixes and their mappings:
21027    ///
21028    /// * spark:  `spark-defaults.conf`
21029    ///
21030    /// For more information, see [Cluster
21031    /// properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
21032    pub properties: std::collections::HashMap<std::string::String, std::string::String>,
21033
21034    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21035}
21036
21037impl KubernetesSoftwareConfig {
21038    pub fn new() -> Self {
21039        std::default::Default::default()
21040    }
21041
21042    /// Sets the value of [component_version][crate::model::KubernetesSoftwareConfig::component_version].
21043    ///
21044    /// # Example
21045    /// ```ignore,no_run
21046    /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21047    /// let x = KubernetesSoftwareConfig::new().set_component_version([
21048    ///     ("key0", "abc"),
21049    ///     ("key1", "xyz"),
21050    /// ]);
21051    /// ```
21052    pub fn set_component_version<T, K, V>(mut self, v: T) -> Self
21053    where
21054        T: std::iter::IntoIterator<Item = (K, V)>,
21055        K: std::convert::Into<std::string::String>,
21056        V: std::convert::Into<std::string::String>,
21057    {
21058        use std::iter::Iterator;
21059        self.component_version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21060        self
21061    }
21062
21063    /// Sets the value of [properties][crate::model::KubernetesSoftwareConfig::properties].
21064    ///
21065    /// # Example
21066    /// ```ignore,no_run
21067    /// # use google_cloud_dataproc_v1::model::KubernetesSoftwareConfig;
21068    /// let x = KubernetesSoftwareConfig::new().set_properties([
21069    ///     ("key0", "abc"),
21070    ///     ("key1", "xyz"),
21071    /// ]);
21072    /// ```
21073    pub fn set_properties<T, K, V>(mut self, v: T) -> Self
21074    where
21075        T: std::iter::IntoIterator<Item = (K, V)>,
21076        K: std::convert::Into<std::string::String>,
21077        V: std::convert::Into<std::string::String>,
21078    {
21079        use std::iter::Iterator;
21080        self.properties = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21081        self
21082    }
21083}
21084
21085impl wkt::message::Message for KubernetesSoftwareConfig {
21086    fn typename() -> &'static str {
21087        "type.googleapis.com/google.cloud.dataproc.v1.KubernetesSoftwareConfig"
21088    }
21089}
21090
21091/// GKE node pools that Dataproc workloads run on.
21092#[derive(Clone, Default, PartialEq)]
21093#[non_exhaustive]
21094pub struct GkeNodePoolTarget {
21095    /// Required. The target GKE node pool.
21096    /// Format:
21097    /// 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}'
21098    pub node_pool: std::string::String,
21099
21100    /// Required. The roles associated with the GKE node pool.
21101    pub roles: std::vec::Vec<crate::model::gke_node_pool_target::Role>,
21102
21103    /// Input only. The configuration for the GKE node pool.
21104    ///
21105    /// If specified, Dataproc attempts to create a node pool with the
21106    /// specified shape. If one with the same name already exists, it is
21107    /// verified against all specified fields. If a field differs, the
21108    /// virtual cluster creation will fail.
21109    ///
21110    /// If omitted, any node pool with the specified name is used. If a
21111    /// node pool with the specified name does not exist, Dataproc create a
21112    /// node pool with default values.
21113    ///
21114    /// This is an input only field. It will not be returned by the API.
21115    pub node_pool_config: std::option::Option<crate::model::GkeNodePoolConfig>,
21116
21117    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21118}
21119
21120impl GkeNodePoolTarget {
21121    pub fn new() -> Self {
21122        std::default::Default::default()
21123    }
21124
21125    /// Sets the value of [node_pool][crate::model::GkeNodePoolTarget::node_pool].
21126    ///
21127    /// # Example
21128    /// ```ignore,no_run
21129    /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21130    /// let x = GkeNodePoolTarget::new().set_node_pool("example");
21131    /// ```
21132    pub fn set_node_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21133        self.node_pool = v.into();
21134        self
21135    }
21136
21137    /// Sets the value of [roles][crate::model::GkeNodePoolTarget::roles].
21138    ///
21139    /// # Example
21140    /// ```ignore,no_run
21141    /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21142    /// use google_cloud_dataproc_v1::model::gke_node_pool_target::Role;
21143    /// let x = GkeNodePoolTarget::new().set_roles([
21144    ///     Role::Default,
21145    ///     Role::Controller,
21146    ///     Role::SparkDriver,
21147    /// ]);
21148    /// ```
21149    pub fn set_roles<T, V>(mut self, v: T) -> Self
21150    where
21151        T: std::iter::IntoIterator<Item = V>,
21152        V: std::convert::Into<crate::model::gke_node_pool_target::Role>,
21153    {
21154        use std::iter::Iterator;
21155        self.roles = v.into_iter().map(|i| i.into()).collect();
21156        self
21157    }
21158
21159    /// Sets the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
21160    ///
21161    /// # Example
21162    /// ```ignore,no_run
21163    /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21164    /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21165    /// let x = GkeNodePoolTarget::new().set_node_pool_config(GkeNodePoolConfig::default()/* use setters */);
21166    /// ```
21167    pub fn set_node_pool_config<T>(mut self, v: T) -> Self
21168    where
21169        T: std::convert::Into<crate::model::GkeNodePoolConfig>,
21170    {
21171        self.node_pool_config = std::option::Option::Some(v.into());
21172        self
21173    }
21174
21175    /// Sets or clears the value of [node_pool_config][crate::model::GkeNodePoolTarget::node_pool_config].
21176    ///
21177    /// # Example
21178    /// ```ignore,no_run
21179    /// # use google_cloud_dataproc_v1::model::GkeNodePoolTarget;
21180    /// use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21181    /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(Some(GkeNodePoolConfig::default()/* use setters */));
21182    /// let x = GkeNodePoolTarget::new().set_or_clear_node_pool_config(None::<GkeNodePoolConfig>);
21183    /// ```
21184    pub fn set_or_clear_node_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
21185    where
21186        T: std::convert::Into<crate::model::GkeNodePoolConfig>,
21187    {
21188        self.node_pool_config = v.map(|x| x.into());
21189        self
21190    }
21191}
21192
21193impl wkt::message::Message for GkeNodePoolTarget {
21194    fn typename() -> &'static str {
21195        "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolTarget"
21196    }
21197}
21198
21199/// Defines additional types related to [GkeNodePoolTarget].
21200pub mod gke_node_pool_target {
21201    #[allow(unused_imports)]
21202    use super::*;
21203
21204    /// `Role` specifies the tasks that will run on the node pool. Roles can be
21205    /// specific to workloads. Exactly one
21206    /// [GkeNodePoolTarget][google.cloud.dataproc.v1.GkeNodePoolTarget] within the
21207    /// virtual cluster must have the `DEFAULT` role, which is used to run all
21208    /// workloads that are not associated with a node pool.
21209    ///
21210    /// [google.cloud.dataproc.v1.GkeNodePoolTarget]: crate::model::GkeNodePoolTarget
21211    ///
21212    /// # Working with unknown values
21213    ///
21214    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21215    /// additional enum variants at any time. Adding new variants is not considered
21216    /// a breaking change. Applications should write their code in anticipation of:
21217    ///
21218    /// - New values appearing in future releases of the client library, **and**
21219    /// - New values received dynamically, without application changes.
21220    ///
21221    /// Please consult the [Working with enums] section in the user guide for some
21222    /// guidelines.
21223    ///
21224    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21225    #[derive(Clone, Debug, PartialEq)]
21226    #[non_exhaustive]
21227    pub enum Role {
21228        /// Role is unspecified.
21229        Unspecified,
21230        /// At least one node pool must have the `DEFAULT` role.
21231        /// Work assigned to a role that is not associated with a node pool
21232        /// is assigned to the node pool with the `DEFAULT` role. For example,
21233        /// work assigned to the `CONTROLLER` role will be assigned to the node pool
21234        /// with the `DEFAULT` role if no node pool has the `CONTROLLER` role.
21235        Default,
21236        /// Run work associated with the Dataproc control plane (for example,
21237        /// controllers and webhooks). Very low resource requirements.
21238        Controller,
21239        /// Run work associated with a Spark driver of a job.
21240        SparkDriver,
21241        /// Run work associated with a Spark executor of a job.
21242        SparkExecutor,
21243        /// If set, the enum was initialized with an unknown value.
21244        ///
21245        /// Applications can examine the value using [Role::value] or
21246        /// [Role::name].
21247        UnknownValue(role::UnknownValue),
21248    }
21249
21250    #[doc(hidden)]
21251    pub mod role {
21252        #[allow(unused_imports)]
21253        use super::*;
21254        #[derive(Clone, Debug, PartialEq)]
21255        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21256    }
21257
21258    impl Role {
21259        /// Gets the enum value.
21260        ///
21261        /// Returns `None` if the enum contains an unknown value deserialized from
21262        /// the string representation of enums.
21263        pub fn value(&self) -> std::option::Option<i32> {
21264            match self {
21265                Self::Unspecified => std::option::Option::Some(0),
21266                Self::Default => std::option::Option::Some(1),
21267                Self::Controller => std::option::Option::Some(2),
21268                Self::SparkDriver => std::option::Option::Some(3),
21269                Self::SparkExecutor => std::option::Option::Some(4),
21270                Self::UnknownValue(u) => u.0.value(),
21271            }
21272        }
21273
21274        /// Gets the enum value as a string.
21275        ///
21276        /// Returns `None` if the enum contains an unknown value deserialized from
21277        /// the integer representation of enums.
21278        pub fn name(&self) -> std::option::Option<&str> {
21279            match self {
21280                Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
21281                Self::Default => std::option::Option::Some("DEFAULT"),
21282                Self::Controller => std::option::Option::Some("CONTROLLER"),
21283                Self::SparkDriver => std::option::Option::Some("SPARK_DRIVER"),
21284                Self::SparkExecutor => std::option::Option::Some("SPARK_EXECUTOR"),
21285                Self::UnknownValue(u) => u.0.name(),
21286            }
21287        }
21288    }
21289
21290    impl std::default::Default for Role {
21291        fn default() -> Self {
21292            use std::convert::From;
21293            Self::from(0)
21294        }
21295    }
21296
21297    impl std::fmt::Display for Role {
21298        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21299            wkt::internal::display_enum(f, self.name(), self.value())
21300        }
21301    }
21302
21303    impl std::convert::From<i32> for Role {
21304        fn from(value: i32) -> Self {
21305            match value {
21306                0 => Self::Unspecified,
21307                1 => Self::Default,
21308                2 => Self::Controller,
21309                3 => Self::SparkDriver,
21310                4 => Self::SparkExecutor,
21311                _ => Self::UnknownValue(role::UnknownValue(
21312                    wkt::internal::UnknownEnumValue::Integer(value),
21313                )),
21314            }
21315        }
21316    }
21317
21318    impl std::convert::From<&str> for Role {
21319        fn from(value: &str) -> Self {
21320            use std::string::ToString;
21321            match value {
21322                "ROLE_UNSPECIFIED" => Self::Unspecified,
21323                "DEFAULT" => Self::Default,
21324                "CONTROLLER" => Self::Controller,
21325                "SPARK_DRIVER" => Self::SparkDriver,
21326                "SPARK_EXECUTOR" => Self::SparkExecutor,
21327                _ => Self::UnknownValue(role::UnknownValue(
21328                    wkt::internal::UnknownEnumValue::String(value.to_string()),
21329                )),
21330            }
21331        }
21332    }
21333
21334    impl serde::ser::Serialize for Role {
21335        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21336        where
21337            S: serde::Serializer,
21338        {
21339            match self {
21340                Self::Unspecified => serializer.serialize_i32(0),
21341                Self::Default => serializer.serialize_i32(1),
21342                Self::Controller => serializer.serialize_i32(2),
21343                Self::SparkDriver => serializer.serialize_i32(3),
21344                Self::SparkExecutor => serializer.serialize_i32(4),
21345                Self::UnknownValue(u) => u.0.serialize(serializer),
21346            }
21347        }
21348    }
21349
21350    impl<'de> serde::de::Deserialize<'de> for Role {
21351        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21352        where
21353            D: serde::Deserializer<'de>,
21354        {
21355            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
21356                ".google.cloud.dataproc.v1.GkeNodePoolTarget.Role",
21357            ))
21358        }
21359    }
21360}
21361
21362/// The configuration of a GKE node pool used by a [Dataproc-on-GKE
21363/// cluster](https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster).
21364#[derive(Clone, Default, PartialEq)]
21365#[non_exhaustive]
21366pub struct GkeNodePoolConfig {
21367    /// Optional. The node pool configuration.
21368    pub config: std::option::Option<crate::model::gke_node_pool_config::GkeNodeConfig>,
21369
21370    /// Optional. The list of Compute Engine
21371    /// [zones](https://cloud.google.com/compute/docs/zones#available) where
21372    /// node pool nodes associated with a Dataproc on GKE virtual cluster
21373    /// will be located.
21374    ///
21375    /// **Note:** All node pools associated with a virtual cluster
21376    /// must be located in the same region as the virtual cluster, and they must
21377    /// be located in the same zone within that region.
21378    ///
21379    /// If a location is not specified during node pool creation, Dataproc on GKE
21380    /// will choose the zone.
21381    pub locations: std::vec::Vec<std::string::String>,
21382
21383    /// Optional. The autoscaler configuration for this node pool. The autoscaler
21384    /// is enabled only when a valid configuration is present.
21385    pub autoscaling:
21386        std::option::Option<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21387
21388    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21389}
21390
21391impl GkeNodePoolConfig {
21392    pub fn new() -> Self {
21393        std::default::Default::default()
21394    }
21395
21396    /// Sets the value of [config][crate::model::GkeNodePoolConfig::config].
21397    ///
21398    /// # Example
21399    /// ```ignore,no_run
21400    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21401    /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21402    /// let x = GkeNodePoolConfig::new().set_config(GkeNodeConfig::default()/* use setters */);
21403    /// ```
21404    pub fn set_config<T>(mut self, v: T) -> Self
21405    where
21406        T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21407    {
21408        self.config = std::option::Option::Some(v.into());
21409        self
21410    }
21411
21412    /// Sets or clears the value of [config][crate::model::GkeNodePoolConfig::config].
21413    ///
21414    /// # Example
21415    /// ```ignore,no_run
21416    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21417    /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21418    /// let x = GkeNodePoolConfig::new().set_or_clear_config(Some(GkeNodeConfig::default()/* use setters */));
21419    /// let x = GkeNodePoolConfig::new().set_or_clear_config(None::<GkeNodeConfig>);
21420    /// ```
21421    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
21422    where
21423        T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodeConfig>,
21424    {
21425        self.config = v.map(|x| x.into());
21426        self
21427    }
21428
21429    /// Sets the value of [locations][crate::model::GkeNodePoolConfig::locations].
21430    ///
21431    /// # Example
21432    /// ```ignore,no_run
21433    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21434    /// let x = GkeNodePoolConfig::new().set_locations(["a", "b", "c"]);
21435    /// ```
21436    pub fn set_locations<T, V>(mut self, v: T) -> Self
21437    where
21438        T: std::iter::IntoIterator<Item = V>,
21439        V: std::convert::Into<std::string::String>,
21440    {
21441        use std::iter::Iterator;
21442        self.locations = v.into_iter().map(|i| i.into()).collect();
21443        self
21444    }
21445
21446    /// Sets the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21447    ///
21448    /// # Example
21449    /// ```ignore,no_run
21450    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21451    /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21452    /// let x = GkeNodePoolConfig::new().set_autoscaling(GkeNodePoolAutoscalingConfig::default()/* use setters */);
21453    /// ```
21454    pub fn set_autoscaling<T>(mut self, v: T) -> Self
21455    where
21456        T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21457    {
21458        self.autoscaling = std::option::Option::Some(v.into());
21459        self
21460    }
21461
21462    /// Sets or clears the value of [autoscaling][crate::model::GkeNodePoolConfig::autoscaling].
21463    ///
21464    /// # Example
21465    /// ```ignore,no_run
21466    /// # use google_cloud_dataproc_v1::model::GkeNodePoolConfig;
21467    /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21468    /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(Some(GkeNodePoolAutoscalingConfig::default()/* use setters */));
21469    /// let x = GkeNodePoolConfig::new().set_or_clear_autoscaling(None::<GkeNodePoolAutoscalingConfig>);
21470    /// ```
21471    pub fn set_or_clear_autoscaling<T>(mut self, v: std::option::Option<T>) -> Self
21472    where
21473        T: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig>,
21474    {
21475        self.autoscaling = v.map(|x| x.into());
21476        self
21477    }
21478}
21479
21480impl wkt::message::Message for GkeNodePoolConfig {
21481    fn typename() -> &'static str {
21482        "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig"
21483    }
21484}
21485
21486/// Defines additional types related to [GkeNodePoolConfig].
21487pub mod gke_node_pool_config {
21488    #[allow(unused_imports)]
21489    use super::*;
21490
21491    /// Parameters that describe cluster nodes.
21492    #[derive(Clone, Default, PartialEq)]
21493    #[non_exhaustive]
21494    pub struct GkeNodeConfig {
21495        /// Optional. The name of a Compute Engine [machine
21496        /// type](https://cloud.google.com/compute/docs/machine-types).
21497        pub machine_type: std::string::String,
21498
21499        /// Optional. The number of local SSD disks to attach to the node, which is
21500        /// limited by the maximum number of disks allowable per zone (see [Adding
21501        /// Local SSDs](https://cloud.google.com/compute/docs/disks/local-ssd)).
21502        pub local_ssd_count: i32,
21503
21504        /// Optional. Whether the nodes are created as legacy [preemptible VM
21505        /// instances] (<https://cloud.google.com/compute/docs/instances/preemptible>).
21506        /// Also see
21507        /// [Spot][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]
21508        /// VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot
21509        /// preemptible nodes cannot be used in a node pool with the `CONTROLLER`
21510        /// [role]
21511        /// (/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21512        /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21513        /// DEFAULT node pool will assume the CONTROLLER role).
21514        ///
21515        /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.spot]: crate::model::gke_node_pool_config::GkeNodeConfig::spot
21516        pub preemptible: bool,
21517
21518        /// Optional. A list of [hardware
21519        /// accelerators](https://cloud.google.com/compute/docs/gpus) to attach to
21520        /// each node.
21521        pub accelerators:
21522            std::vec::Vec<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21523
21524        /// Optional. [Minimum CPU
21525        /// platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
21526        /// to be used by this instance. The instance may be scheduled on the
21527        /// specified or a newer CPU platform. Specify the friendly names of CPU
21528        /// platforms, such as "Intel Haswell"` or Intel Sandy Bridge".
21529        pub min_cpu_platform: std::string::String,
21530
21531        /// Optional. The [Customer Managed Encryption Key (CMEK)]
21532        /// (<https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek>)
21533        /// used to encrypt the boot disk attached to each node in the node pool.
21534        /// Specify the key using the following format:
21535        /// \<code\>projects/\<var\>KEY_PROJECT_ID\</var\>/locations/\<var\>LOCATION\</var\>/keyRings/\<var\>RING_NAME\</var\>/cryptoKeys/\<var\>KEY_NAME\</var\>\</code\>.
21536        pub boot_disk_kms_key: std::string::String,
21537
21538        /// Optional. Whether the nodes are created as [Spot VM instances]
21539        /// (<https://cloud.google.com/compute/docs/instances/spot>).
21540        /// Spot VMs are the latest update to legacy
21541        /// [preemptible
21542        /// VMs][google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible].
21543        /// Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible
21544        /// nodes cannot be used in a node pool with the `CONTROLLER`
21545        /// [role](/dataproc/docs/reference/rest/v1/projects.regions.clusters#role)
21546        /// or in the DEFAULT node pool if the CONTROLLER role is not assigned (the
21547        /// DEFAULT node pool will assume the CONTROLLER role).
21548        ///
21549        /// [google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig.preemptible]: crate::model::gke_node_pool_config::GkeNodeConfig::preemptible
21550        pub spot: bool,
21551
21552        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21553    }
21554
21555    impl GkeNodeConfig {
21556        pub fn new() -> Self {
21557            std::default::Default::default()
21558        }
21559
21560        /// Sets the value of [machine_type][crate::model::gke_node_pool_config::GkeNodeConfig::machine_type].
21561        ///
21562        /// # Example
21563        /// ```ignore,no_run
21564        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21565        /// let x = GkeNodeConfig::new().set_machine_type("example");
21566        /// ```
21567        pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
21568            mut self,
21569            v: T,
21570        ) -> Self {
21571            self.machine_type = v.into();
21572            self
21573        }
21574
21575        /// Sets the value of [local_ssd_count][crate::model::gke_node_pool_config::GkeNodeConfig::local_ssd_count].
21576        ///
21577        /// # Example
21578        /// ```ignore,no_run
21579        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21580        /// let x = GkeNodeConfig::new().set_local_ssd_count(42);
21581        /// ```
21582        pub fn set_local_ssd_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21583            self.local_ssd_count = v.into();
21584            self
21585        }
21586
21587        /// Sets the value of [preemptible][crate::model::gke_node_pool_config::GkeNodeConfig::preemptible].
21588        ///
21589        /// # Example
21590        /// ```ignore,no_run
21591        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21592        /// let x = GkeNodeConfig::new().set_preemptible(true);
21593        /// ```
21594        pub fn set_preemptible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21595            self.preemptible = v.into();
21596            self
21597        }
21598
21599        /// Sets the value of [accelerators][crate::model::gke_node_pool_config::GkeNodeConfig::accelerators].
21600        ///
21601        /// # Example
21602        /// ```ignore,no_run
21603        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21604        /// use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21605        /// let x = GkeNodeConfig::new()
21606        ///     .set_accelerators([
21607        ///         GkeNodePoolAcceleratorConfig::default()/* use setters */,
21608        ///         GkeNodePoolAcceleratorConfig::default()/* use (different) setters */,
21609        ///     ]);
21610        /// ```
21611        pub fn set_accelerators<T, V>(mut self, v: T) -> Self
21612        where
21613            T: std::iter::IntoIterator<Item = V>,
21614            V: std::convert::Into<crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig>,
21615        {
21616            use std::iter::Iterator;
21617            self.accelerators = v.into_iter().map(|i| i.into()).collect();
21618            self
21619        }
21620
21621        /// Sets the value of [min_cpu_platform][crate::model::gke_node_pool_config::GkeNodeConfig::min_cpu_platform].
21622        ///
21623        /// # Example
21624        /// ```ignore,no_run
21625        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21626        /// let x = GkeNodeConfig::new().set_min_cpu_platform("example");
21627        /// ```
21628        pub fn set_min_cpu_platform<T: std::convert::Into<std::string::String>>(
21629            mut self,
21630            v: T,
21631        ) -> Self {
21632            self.min_cpu_platform = v.into();
21633            self
21634        }
21635
21636        /// Sets the value of [boot_disk_kms_key][crate::model::gke_node_pool_config::GkeNodeConfig::boot_disk_kms_key].
21637        ///
21638        /// # Example
21639        /// ```ignore,no_run
21640        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21641        /// let x = GkeNodeConfig::new().set_boot_disk_kms_key("example");
21642        /// ```
21643        pub fn set_boot_disk_kms_key<T: std::convert::Into<std::string::String>>(
21644            mut self,
21645            v: T,
21646        ) -> Self {
21647            self.boot_disk_kms_key = v.into();
21648            self
21649        }
21650
21651        /// Sets the value of [spot][crate::model::gke_node_pool_config::GkeNodeConfig::spot].
21652        ///
21653        /// # Example
21654        /// ```ignore,no_run
21655        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodeConfig;
21656        /// let x = GkeNodeConfig::new().set_spot(true);
21657        /// ```
21658        pub fn set_spot<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21659            self.spot = v.into();
21660            self
21661        }
21662    }
21663
21664    impl wkt::message::Message for GkeNodeConfig {
21665        fn typename() -> &'static str {
21666            "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodeConfig"
21667        }
21668    }
21669
21670    /// A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request
21671    /// for a node pool.
21672    #[derive(Clone, Default, PartialEq)]
21673    #[non_exhaustive]
21674    pub struct GkeNodePoolAcceleratorConfig {
21675        /// The number of accelerator cards exposed to an instance.
21676        pub accelerator_count: i64,
21677
21678        /// The accelerator type resource namename (see GPUs on Compute Engine).
21679        pub accelerator_type: std::string::String,
21680
21681        /// Size of partitions to create on the GPU. Valid values are described in
21682        /// the NVIDIA [mig user
21683        /// guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
21684        pub gpu_partition_size: std::string::String,
21685
21686        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21687    }
21688
21689    impl GkeNodePoolAcceleratorConfig {
21690        pub fn new() -> Self {
21691            std::default::Default::default()
21692        }
21693
21694        /// Sets the value of [accelerator_count][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_count].
21695        ///
21696        /// # Example
21697        /// ```ignore,no_run
21698        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21699        /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_count(42);
21700        /// ```
21701        pub fn set_accelerator_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
21702            self.accelerator_count = v.into();
21703            self
21704        }
21705
21706        /// Sets the value of [accelerator_type][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::accelerator_type].
21707        ///
21708        /// # Example
21709        /// ```ignore,no_run
21710        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21711        /// let x = GkeNodePoolAcceleratorConfig::new().set_accelerator_type("example");
21712        /// ```
21713        pub fn set_accelerator_type<T: std::convert::Into<std::string::String>>(
21714            mut self,
21715            v: T,
21716        ) -> Self {
21717            self.accelerator_type = v.into();
21718            self
21719        }
21720
21721        /// Sets the value of [gpu_partition_size][crate::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig::gpu_partition_size].
21722        ///
21723        /// # Example
21724        /// ```ignore,no_run
21725        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAcceleratorConfig;
21726        /// let x = GkeNodePoolAcceleratorConfig::new().set_gpu_partition_size("example");
21727        /// ```
21728        pub fn set_gpu_partition_size<T: std::convert::Into<std::string::String>>(
21729            mut self,
21730            v: T,
21731        ) -> Self {
21732            self.gpu_partition_size = v.into();
21733            self
21734        }
21735    }
21736
21737    impl wkt::message::Message for GkeNodePoolAcceleratorConfig {
21738        fn typename() -> &'static str {
21739            "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAcceleratorConfig"
21740        }
21741    }
21742
21743    /// GkeNodePoolAutoscaling contains information the cluster autoscaler needs to
21744    /// adjust the size of the node pool to the current cluster usage.
21745    #[derive(Clone, Default, PartialEq)]
21746    #[non_exhaustive]
21747    pub struct GkeNodePoolAutoscalingConfig {
21748        /// The minimum number of nodes in the node pool. Must be >= 0 and <=
21749        /// max_node_count.
21750        pub min_node_count: i32,
21751
21752        /// The maximum number of nodes in the node pool. Must be >= min_node_count,
21753        /// and must be > 0.
21754        /// **Note:** Quota must be sufficient to scale up the cluster.
21755        pub max_node_count: i32,
21756
21757        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21758    }
21759
21760    impl GkeNodePoolAutoscalingConfig {
21761        pub fn new() -> Self {
21762            std::default::Default::default()
21763        }
21764
21765        /// Sets the value of [min_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::min_node_count].
21766        ///
21767        /// # Example
21768        /// ```ignore,no_run
21769        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21770        /// let x = GkeNodePoolAutoscalingConfig::new().set_min_node_count(42);
21771        /// ```
21772        pub fn set_min_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21773            self.min_node_count = v.into();
21774            self
21775        }
21776
21777        /// Sets the value of [max_node_count][crate::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig::max_node_count].
21778        ///
21779        /// # Example
21780        /// ```ignore,no_run
21781        /// # use google_cloud_dataproc_v1::model::gke_node_pool_config::GkeNodePoolAutoscalingConfig;
21782        /// let x = GkeNodePoolAutoscalingConfig::new().set_max_node_count(42);
21783        /// ```
21784        pub fn set_max_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21785            self.max_node_count = v.into();
21786            self
21787        }
21788    }
21789
21790    impl wkt::message::Message for GkeNodePoolAutoscalingConfig {
21791        fn typename() -> &'static str {
21792            "type.googleapis.com/google.cloud.dataproc.v1.GkeNodePoolConfig.GkeNodePoolAutoscalingConfig"
21793        }
21794    }
21795}
21796
21797/// Authentication configuration for a workload is used to set the default
21798/// identity for the workload execution.
21799/// The config specifies the type of identity (service account or user) that
21800/// will be used by workloads to access resources on the project(s).
21801#[derive(Clone, Default, PartialEq)]
21802#[non_exhaustive]
21803pub struct AuthenticationConfig {
21804    /// Optional. Authentication type for the user workload running in containers.
21805    pub user_workload_authentication_type: crate::model::authentication_config::AuthenticationType,
21806
21807    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21808}
21809
21810impl AuthenticationConfig {
21811    pub fn new() -> Self {
21812        std::default::Default::default()
21813    }
21814
21815    /// Sets the value of [user_workload_authentication_type][crate::model::AuthenticationConfig::user_workload_authentication_type].
21816    ///
21817    /// # Example
21818    /// ```ignore,no_run
21819    /// # use google_cloud_dataproc_v1::model::AuthenticationConfig;
21820    /// use google_cloud_dataproc_v1::model::authentication_config::AuthenticationType;
21821    /// let x0 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::ServiceAccount);
21822    /// let x1 = AuthenticationConfig::new().set_user_workload_authentication_type(AuthenticationType::EndUserCredentials);
21823    /// ```
21824    pub fn set_user_workload_authentication_type<
21825        T: std::convert::Into<crate::model::authentication_config::AuthenticationType>,
21826    >(
21827        mut self,
21828        v: T,
21829    ) -> Self {
21830        self.user_workload_authentication_type = v.into();
21831        self
21832    }
21833}
21834
21835impl wkt::message::Message for AuthenticationConfig {
21836    fn typename() -> &'static str {
21837        "type.googleapis.com/google.cloud.dataproc.v1.AuthenticationConfig"
21838    }
21839}
21840
21841/// Defines additional types related to [AuthenticationConfig].
21842pub mod authentication_config {
21843    #[allow(unused_imports)]
21844    use super::*;
21845
21846    /// Authentication types for workload execution.
21847    ///
21848    /// # Working with unknown values
21849    ///
21850    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21851    /// additional enum variants at any time. Adding new variants is not considered
21852    /// a breaking change. Applications should write their code in anticipation of:
21853    ///
21854    /// - New values appearing in future releases of the client library, **and**
21855    /// - New values received dynamically, without application changes.
21856    ///
21857    /// Please consult the [Working with enums] section in the user guide for some
21858    /// guidelines.
21859    ///
21860    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21861    #[derive(Clone, Debug, PartialEq)]
21862    #[non_exhaustive]
21863    pub enum AuthenticationType {
21864        /// If AuthenticationType is unspecified then END_USER_CREDENTIALS is used
21865        /// for 3.0 and newer runtimes, and SERVICE_ACCOUNT is used for older
21866        /// runtimes.
21867        Unspecified,
21868        /// Use service account credentials for authenticating to other services.
21869        ServiceAccount,
21870        /// Use OAuth credentials associated with the workload creator/user for
21871        /// authenticating to other services.
21872        EndUserCredentials,
21873        /// If set, the enum was initialized with an unknown value.
21874        ///
21875        /// Applications can examine the value using [AuthenticationType::value] or
21876        /// [AuthenticationType::name].
21877        UnknownValue(authentication_type::UnknownValue),
21878    }
21879
21880    #[doc(hidden)]
21881    pub mod authentication_type {
21882        #[allow(unused_imports)]
21883        use super::*;
21884        #[derive(Clone, Debug, PartialEq)]
21885        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21886    }
21887
21888    impl AuthenticationType {
21889        /// Gets the enum value.
21890        ///
21891        /// Returns `None` if the enum contains an unknown value deserialized from
21892        /// the string representation of enums.
21893        pub fn value(&self) -> std::option::Option<i32> {
21894            match self {
21895                Self::Unspecified => std::option::Option::Some(0),
21896                Self::ServiceAccount => std::option::Option::Some(1),
21897                Self::EndUserCredentials => std::option::Option::Some(2),
21898                Self::UnknownValue(u) => u.0.value(),
21899            }
21900        }
21901
21902        /// Gets the enum value as a string.
21903        ///
21904        /// Returns `None` if the enum contains an unknown value deserialized from
21905        /// the integer representation of enums.
21906        pub fn name(&self) -> std::option::Option<&str> {
21907            match self {
21908                Self::Unspecified => std::option::Option::Some("AUTHENTICATION_TYPE_UNSPECIFIED"),
21909                Self::ServiceAccount => std::option::Option::Some("SERVICE_ACCOUNT"),
21910                Self::EndUserCredentials => std::option::Option::Some("END_USER_CREDENTIALS"),
21911                Self::UnknownValue(u) => u.0.name(),
21912            }
21913        }
21914    }
21915
21916    impl std::default::Default for AuthenticationType {
21917        fn default() -> Self {
21918            use std::convert::From;
21919            Self::from(0)
21920        }
21921    }
21922
21923    impl std::fmt::Display for AuthenticationType {
21924        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21925            wkt::internal::display_enum(f, self.name(), self.value())
21926        }
21927    }
21928
21929    impl std::convert::From<i32> for AuthenticationType {
21930        fn from(value: i32) -> Self {
21931            match value {
21932                0 => Self::Unspecified,
21933                1 => Self::ServiceAccount,
21934                2 => Self::EndUserCredentials,
21935                _ => Self::UnknownValue(authentication_type::UnknownValue(
21936                    wkt::internal::UnknownEnumValue::Integer(value),
21937                )),
21938            }
21939        }
21940    }
21941
21942    impl std::convert::From<&str> for AuthenticationType {
21943        fn from(value: &str) -> Self {
21944            use std::string::ToString;
21945            match value {
21946                "AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
21947                "SERVICE_ACCOUNT" => Self::ServiceAccount,
21948                "END_USER_CREDENTIALS" => Self::EndUserCredentials,
21949                _ => Self::UnknownValue(authentication_type::UnknownValue(
21950                    wkt::internal::UnknownEnumValue::String(value.to_string()),
21951                )),
21952            }
21953        }
21954    }
21955
21956    impl serde::ser::Serialize for AuthenticationType {
21957        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21958        where
21959            S: serde::Serializer,
21960        {
21961            match self {
21962                Self::Unspecified => serializer.serialize_i32(0),
21963                Self::ServiceAccount => serializer.serialize_i32(1),
21964                Self::EndUserCredentials => serializer.serialize_i32(2),
21965                Self::UnknownValue(u) => u.0.serialize(serializer),
21966            }
21967        }
21968    }
21969
21970    impl<'de> serde::de::Deserialize<'de> for AuthenticationType {
21971        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21972        where
21973            D: serde::Deserializer<'de>,
21974        {
21975            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthenticationType>::new(
21976                ".google.cloud.dataproc.v1.AuthenticationConfig.AuthenticationType",
21977            ))
21978        }
21979    }
21980}
21981
21982/// Autotuning configuration of the workload.
21983#[derive(Clone, Default, PartialEq)]
21984#[non_exhaustive]
21985pub struct AutotuningConfig {
21986    /// Optional. Scenarios for which tunings are applied.
21987    pub scenarios: std::vec::Vec<crate::model::autotuning_config::Scenario>,
21988
21989    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21990}
21991
21992impl AutotuningConfig {
21993    pub fn new() -> Self {
21994        std::default::Default::default()
21995    }
21996
21997    /// Sets the value of [scenarios][crate::model::AutotuningConfig::scenarios].
21998    ///
21999    /// # Example
22000    /// ```ignore,no_run
22001    /// # use google_cloud_dataproc_v1::model::AutotuningConfig;
22002    /// use google_cloud_dataproc_v1::model::autotuning_config::Scenario;
22003    /// let x = AutotuningConfig::new().set_scenarios([
22004    ///     Scenario::Scaling,
22005    ///     Scenario::BroadcastHashJoin,
22006    ///     Scenario::Memory,
22007    /// ]);
22008    /// ```
22009    pub fn set_scenarios<T, V>(mut self, v: T) -> Self
22010    where
22011        T: std::iter::IntoIterator<Item = V>,
22012        V: std::convert::Into<crate::model::autotuning_config::Scenario>,
22013    {
22014        use std::iter::Iterator;
22015        self.scenarios = v.into_iter().map(|i| i.into()).collect();
22016        self
22017    }
22018}
22019
22020impl wkt::message::Message for AutotuningConfig {
22021    fn typename() -> &'static str {
22022        "type.googleapis.com/google.cloud.dataproc.v1.AutotuningConfig"
22023    }
22024}
22025
22026/// Defines additional types related to [AutotuningConfig].
22027pub mod autotuning_config {
22028    #[allow(unused_imports)]
22029    use super::*;
22030
22031    /// Scenario represents a specific goal that autotuning will attempt to achieve
22032    /// by modifying workloads.
22033    ///
22034    /// # Working with unknown values
22035    ///
22036    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22037    /// additional enum variants at any time. Adding new variants is not considered
22038    /// a breaking change. Applications should write their code in anticipation of:
22039    ///
22040    /// - New values appearing in future releases of the client library, **and**
22041    /// - New values received dynamically, without application changes.
22042    ///
22043    /// Please consult the [Working with enums] section in the user guide for some
22044    /// guidelines.
22045    ///
22046    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22047    #[derive(Clone, Debug, PartialEq)]
22048    #[non_exhaustive]
22049    pub enum Scenario {
22050        /// Default value.
22051        Unspecified,
22052        /// Scaling recommendations such as initialExecutors.
22053        Scaling,
22054        /// Adding hints for potential relation broadcasts.
22055        BroadcastHashJoin,
22056        /// Memory management for workloads.
22057        Memory,
22058        /// No autotuning.
22059        None,
22060        /// Automatic selection of scenarios.
22061        Auto,
22062        /// If set, the enum was initialized with an unknown value.
22063        ///
22064        /// Applications can examine the value using [Scenario::value] or
22065        /// [Scenario::name].
22066        UnknownValue(scenario::UnknownValue),
22067    }
22068
22069    #[doc(hidden)]
22070    pub mod scenario {
22071        #[allow(unused_imports)]
22072        use super::*;
22073        #[derive(Clone, Debug, PartialEq)]
22074        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22075    }
22076
22077    impl Scenario {
22078        /// Gets the enum value.
22079        ///
22080        /// Returns `None` if the enum contains an unknown value deserialized from
22081        /// the string representation of enums.
22082        pub fn value(&self) -> std::option::Option<i32> {
22083            match self {
22084                Self::Unspecified => std::option::Option::Some(0),
22085                Self::Scaling => std::option::Option::Some(2),
22086                Self::BroadcastHashJoin => std::option::Option::Some(3),
22087                Self::Memory => std::option::Option::Some(4),
22088                Self::None => std::option::Option::Some(5),
22089                Self::Auto => std::option::Option::Some(6),
22090                Self::UnknownValue(u) => u.0.value(),
22091            }
22092        }
22093
22094        /// Gets the enum value as a string.
22095        ///
22096        /// Returns `None` if the enum contains an unknown value deserialized from
22097        /// the integer representation of enums.
22098        pub fn name(&self) -> std::option::Option<&str> {
22099            match self {
22100                Self::Unspecified => std::option::Option::Some("SCENARIO_UNSPECIFIED"),
22101                Self::Scaling => std::option::Option::Some("SCALING"),
22102                Self::BroadcastHashJoin => std::option::Option::Some("BROADCAST_HASH_JOIN"),
22103                Self::Memory => std::option::Option::Some("MEMORY"),
22104                Self::None => std::option::Option::Some("NONE"),
22105                Self::Auto => std::option::Option::Some("AUTO"),
22106                Self::UnknownValue(u) => u.0.name(),
22107            }
22108        }
22109    }
22110
22111    impl std::default::Default for Scenario {
22112        fn default() -> Self {
22113            use std::convert::From;
22114            Self::from(0)
22115        }
22116    }
22117
22118    impl std::fmt::Display for Scenario {
22119        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22120            wkt::internal::display_enum(f, self.name(), self.value())
22121        }
22122    }
22123
22124    impl std::convert::From<i32> for Scenario {
22125        fn from(value: i32) -> Self {
22126            match value {
22127                0 => Self::Unspecified,
22128                2 => Self::Scaling,
22129                3 => Self::BroadcastHashJoin,
22130                4 => Self::Memory,
22131                5 => Self::None,
22132                6 => Self::Auto,
22133                _ => Self::UnknownValue(scenario::UnknownValue(
22134                    wkt::internal::UnknownEnumValue::Integer(value),
22135                )),
22136            }
22137        }
22138    }
22139
22140    impl std::convert::From<&str> for Scenario {
22141        fn from(value: &str) -> Self {
22142            use std::string::ToString;
22143            match value {
22144                "SCENARIO_UNSPECIFIED" => Self::Unspecified,
22145                "SCALING" => Self::Scaling,
22146                "BROADCAST_HASH_JOIN" => Self::BroadcastHashJoin,
22147                "MEMORY" => Self::Memory,
22148                "NONE" => Self::None,
22149                "AUTO" => Self::Auto,
22150                _ => Self::UnknownValue(scenario::UnknownValue(
22151                    wkt::internal::UnknownEnumValue::String(value.to_string()),
22152                )),
22153            }
22154        }
22155    }
22156
22157    impl serde::ser::Serialize for Scenario {
22158        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22159        where
22160            S: serde::Serializer,
22161        {
22162            match self {
22163                Self::Unspecified => serializer.serialize_i32(0),
22164                Self::Scaling => serializer.serialize_i32(2),
22165                Self::BroadcastHashJoin => serializer.serialize_i32(3),
22166                Self::Memory => serializer.serialize_i32(4),
22167                Self::None => serializer.serialize_i32(5),
22168                Self::Auto => serializer.serialize_i32(6),
22169                Self::UnknownValue(u) => u.0.serialize(serializer),
22170            }
22171        }
22172    }
22173
22174    impl<'de> serde::de::Deserialize<'de> for Scenario {
22175        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22176        where
22177            D: serde::Deserializer<'de>,
22178        {
22179            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scenario>::new(
22180                ".google.cloud.dataproc.v1.AutotuningConfig.Scenario",
22181            ))
22182        }
22183    }
22184}
22185
22186/// Configuration for dependency repositories
22187#[derive(Clone, Default, PartialEq)]
22188#[non_exhaustive]
22189pub struct RepositoryConfig {
22190    /// Optional. Configuration for PyPi repository.
22191    pub pypi_repository_config: std::option::Option<crate::model::PyPiRepositoryConfig>,
22192
22193    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22194}
22195
22196impl RepositoryConfig {
22197    pub fn new() -> Self {
22198        std::default::Default::default()
22199    }
22200
22201    /// Sets the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
22202    ///
22203    /// # Example
22204    /// ```ignore,no_run
22205    /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
22206    /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22207    /// let x = RepositoryConfig::new().set_pypi_repository_config(PyPiRepositoryConfig::default()/* use setters */);
22208    /// ```
22209    pub fn set_pypi_repository_config<T>(mut self, v: T) -> Self
22210    where
22211        T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
22212    {
22213        self.pypi_repository_config = std::option::Option::Some(v.into());
22214        self
22215    }
22216
22217    /// Sets or clears the value of [pypi_repository_config][crate::model::RepositoryConfig::pypi_repository_config].
22218    ///
22219    /// # Example
22220    /// ```ignore,no_run
22221    /// # use google_cloud_dataproc_v1::model::RepositoryConfig;
22222    /// use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22223    /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(Some(PyPiRepositoryConfig::default()/* use setters */));
22224    /// let x = RepositoryConfig::new().set_or_clear_pypi_repository_config(None::<PyPiRepositoryConfig>);
22225    /// ```
22226    pub fn set_or_clear_pypi_repository_config<T>(mut self, v: std::option::Option<T>) -> Self
22227    where
22228        T: std::convert::Into<crate::model::PyPiRepositoryConfig>,
22229    {
22230        self.pypi_repository_config = v.map(|x| x.into());
22231        self
22232    }
22233}
22234
22235impl wkt::message::Message for RepositoryConfig {
22236    fn typename() -> &'static str {
22237        "type.googleapis.com/google.cloud.dataproc.v1.RepositoryConfig"
22238    }
22239}
22240
22241/// Configuration for PyPi repository
22242#[derive(Clone, Default, PartialEq)]
22243#[non_exhaustive]
22244pub struct PyPiRepositoryConfig {
22245    /// Optional. PyPi repository address
22246    pub pypi_repository: std::string::String,
22247
22248    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22249}
22250
22251impl PyPiRepositoryConfig {
22252    pub fn new() -> Self {
22253        std::default::Default::default()
22254    }
22255
22256    /// Sets the value of [pypi_repository][crate::model::PyPiRepositoryConfig::pypi_repository].
22257    ///
22258    /// # Example
22259    /// ```ignore,no_run
22260    /// # use google_cloud_dataproc_v1::model::PyPiRepositoryConfig;
22261    /// let x = PyPiRepositoryConfig::new().set_pypi_repository("example");
22262    /// ```
22263    pub fn set_pypi_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22264        self.pypi_repository = v.into();
22265        self
22266    }
22267}
22268
22269impl wkt::message::Message for PyPiRepositoryConfig {
22270    fn typename() -> &'static str {
22271        "type.googleapis.com/google.cloud.dataproc.v1.PyPiRepositoryConfig"
22272    }
22273}
22274
22275/// A Dataproc workflow template resource.
22276#[derive(Clone, Default, PartialEq)]
22277#[non_exhaustive]
22278pub struct WorkflowTemplate {
22279    pub id: std::string::String,
22280
22281    /// Output only. The resource name of the workflow template, as described
22282    /// in <https://cloud.google.com/apis/design/resource_names>.
22283    ///
22284    /// * For `projects.regions.workflowTemplates`, the resource name of the
22285    ///   template has the following format:
22286    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
22287    ///
22288    /// * For `projects.locations.workflowTemplates`, the resource name of the
22289    ///   template has the following format:
22290    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
22291    ///
22292    pub name: std::string::String,
22293
22294    /// Optional. Used to perform a consistent read-modify-write.
22295    ///
22296    /// This field should be left blank for a `CreateWorkflowTemplate` request. It
22297    /// is required for an `UpdateWorkflowTemplate` request, and must match the
22298    /// current server version. A typical update template flow would fetch the
22299    /// current template with a `GetWorkflowTemplate` request, which will return
22300    /// the current template with the `version` field filled in with the
22301    /// current server version. The user updates other fields in the template,
22302    /// then returns it as part of the `UpdateWorkflowTemplate` request.
22303    pub version: i32,
22304
22305    /// Output only. The time template was created.
22306    pub create_time: std::option::Option<wkt::Timestamp>,
22307
22308    /// Output only. The time template was last updated.
22309    pub update_time: std::option::Option<wkt::Timestamp>,
22310
22311    /// Optional. The labels to associate with this template. These labels
22312    /// will be propagated to all jobs and clusters created by the workflow
22313    /// instance.
22314    ///
22315    /// Label **keys** must contain 1 to 63 characters, and must conform to
22316    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22317    ///
22318    /// Label **values** may be empty, but, if present, must contain 1 to 63
22319    /// characters, and must conform to
22320    /// [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
22321    ///
22322    /// No more than 32 labels can be associated with a template.
22323    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22324
22325    /// Required. WorkflowTemplate scheduling information.
22326    pub placement: std::option::Option<crate::model::WorkflowTemplatePlacement>,
22327
22328    /// Required. The Directed Acyclic Graph of Jobs to submit.
22329    pub jobs: std::vec::Vec<crate::model::OrderedJob>,
22330
22331    /// Optional. Template parameters whose values are substituted into the
22332    /// template. Values for parameters must be provided when the template is
22333    /// instantiated.
22334    pub parameters: std::vec::Vec<crate::model::TemplateParameter>,
22335
22336    /// Optional. Timeout duration for the DAG of jobs, expressed in seconds (see
22337    /// [JSON representation of
22338    /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
22339    /// The timeout duration must be from 10 minutes ("600s") to 24 hours
22340    /// ("86400s"). The timer begins when the first job is submitted. If the
22341    /// workflow is running at the end of the timeout period, any remaining jobs
22342    /// are cancelled, the workflow is ended, and if the workflow was running on a
22343    /// [managed
22344    /// cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster),
22345    /// the cluster is deleted.
22346    pub dag_timeout: std::option::Option<wkt::Duration>,
22347
22348    /// Optional. Encryption settings for encrypting workflow template job
22349    /// arguments.
22350    pub encryption_config: std::option::Option<crate::model::workflow_template::EncryptionConfig>,
22351
22352    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22353}
22354
22355impl WorkflowTemplate {
22356    pub fn new() -> Self {
22357        std::default::Default::default()
22358    }
22359
22360    /// Sets the value of [id][crate::model::WorkflowTemplate::id].
22361    ///
22362    /// # Example
22363    /// ```ignore,no_run
22364    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22365    /// let x = WorkflowTemplate::new().set_id("example");
22366    /// ```
22367    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22368        self.id = v.into();
22369        self
22370    }
22371
22372    /// Sets the value of [name][crate::model::WorkflowTemplate::name].
22373    ///
22374    /// # Example
22375    /// ```ignore,no_run
22376    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22377    /// let x = WorkflowTemplate::new().set_name("example");
22378    /// ```
22379    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22380        self.name = v.into();
22381        self
22382    }
22383
22384    /// Sets the value of [version][crate::model::WorkflowTemplate::version].
22385    ///
22386    /// # Example
22387    /// ```ignore,no_run
22388    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22389    /// let x = WorkflowTemplate::new().set_version(42);
22390    /// ```
22391    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22392        self.version = v.into();
22393        self
22394    }
22395
22396    /// Sets the value of [create_time][crate::model::WorkflowTemplate::create_time].
22397    ///
22398    /// # Example
22399    /// ```ignore,no_run
22400    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22401    /// use wkt::Timestamp;
22402    /// let x = WorkflowTemplate::new().set_create_time(Timestamp::default()/* use setters */);
22403    /// ```
22404    pub fn set_create_time<T>(mut self, v: T) -> Self
22405    where
22406        T: std::convert::Into<wkt::Timestamp>,
22407    {
22408        self.create_time = std::option::Option::Some(v.into());
22409        self
22410    }
22411
22412    /// Sets or clears the value of [create_time][crate::model::WorkflowTemplate::create_time].
22413    ///
22414    /// # Example
22415    /// ```ignore,no_run
22416    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22417    /// use wkt::Timestamp;
22418    /// let x = WorkflowTemplate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
22419    /// let x = WorkflowTemplate::new().set_or_clear_create_time(None::<Timestamp>);
22420    /// ```
22421    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
22422    where
22423        T: std::convert::Into<wkt::Timestamp>,
22424    {
22425        self.create_time = v.map(|x| x.into());
22426        self
22427    }
22428
22429    /// Sets the value of [update_time][crate::model::WorkflowTemplate::update_time].
22430    ///
22431    /// # Example
22432    /// ```ignore,no_run
22433    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22434    /// use wkt::Timestamp;
22435    /// let x = WorkflowTemplate::new().set_update_time(Timestamp::default()/* use setters */);
22436    /// ```
22437    pub fn set_update_time<T>(mut self, v: T) -> Self
22438    where
22439        T: std::convert::Into<wkt::Timestamp>,
22440    {
22441        self.update_time = std::option::Option::Some(v.into());
22442        self
22443    }
22444
22445    /// Sets or clears the value of [update_time][crate::model::WorkflowTemplate::update_time].
22446    ///
22447    /// # Example
22448    /// ```ignore,no_run
22449    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22450    /// use wkt::Timestamp;
22451    /// let x = WorkflowTemplate::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
22452    /// let x = WorkflowTemplate::new().set_or_clear_update_time(None::<Timestamp>);
22453    /// ```
22454    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
22455    where
22456        T: std::convert::Into<wkt::Timestamp>,
22457    {
22458        self.update_time = v.map(|x| x.into());
22459        self
22460    }
22461
22462    /// Sets the value of [labels][crate::model::WorkflowTemplate::labels].
22463    ///
22464    /// # Example
22465    /// ```ignore,no_run
22466    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22467    /// let x = WorkflowTemplate::new().set_labels([
22468    ///     ("key0", "abc"),
22469    ///     ("key1", "xyz"),
22470    /// ]);
22471    /// ```
22472    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22473    where
22474        T: std::iter::IntoIterator<Item = (K, V)>,
22475        K: std::convert::Into<std::string::String>,
22476        V: std::convert::Into<std::string::String>,
22477    {
22478        use std::iter::Iterator;
22479        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22480        self
22481    }
22482
22483    /// Sets the value of [placement][crate::model::WorkflowTemplate::placement].
22484    ///
22485    /// # Example
22486    /// ```ignore,no_run
22487    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22488    /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22489    /// let x = WorkflowTemplate::new().set_placement(WorkflowTemplatePlacement::default()/* use setters */);
22490    /// ```
22491    pub fn set_placement<T>(mut self, v: T) -> Self
22492    where
22493        T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22494    {
22495        self.placement = std::option::Option::Some(v.into());
22496        self
22497    }
22498
22499    /// Sets or clears the value of [placement][crate::model::WorkflowTemplate::placement].
22500    ///
22501    /// # Example
22502    /// ```ignore,no_run
22503    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22504    /// use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22505    /// let x = WorkflowTemplate::new().set_or_clear_placement(Some(WorkflowTemplatePlacement::default()/* use setters */));
22506    /// let x = WorkflowTemplate::new().set_or_clear_placement(None::<WorkflowTemplatePlacement>);
22507    /// ```
22508    pub fn set_or_clear_placement<T>(mut self, v: std::option::Option<T>) -> Self
22509    where
22510        T: std::convert::Into<crate::model::WorkflowTemplatePlacement>,
22511    {
22512        self.placement = v.map(|x| x.into());
22513        self
22514    }
22515
22516    /// Sets the value of [jobs][crate::model::WorkflowTemplate::jobs].
22517    ///
22518    /// # Example
22519    /// ```ignore,no_run
22520    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22521    /// use google_cloud_dataproc_v1::model::OrderedJob;
22522    /// let x = WorkflowTemplate::new()
22523    ///     .set_jobs([
22524    ///         OrderedJob::default()/* use setters */,
22525    ///         OrderedJob::default()/* use (different) setters */,
22526    ///     ]);
22527    /// ```
22528    pub fn set_jobs<T, V>(mut self, v: T) -> Self
22529    where
22530        T: std::iter::IntoIterator<Item = V>,
22531        V: std::convert::Into<crate::model::OrderedJob>,
22532    {
22533        use std::iter::Iterator;
22534        self.jobs = v.into_iter().map(|i| i.into()).collect();
22535        self
22536    }
22537
22538    /// Sets the value of [parameters][crate::model::WorkflowTemplate::parameters].
22539    ///
22540    /// # Example
22541    /// ```ignore,no_run
22542    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22543    /// use google_cloud_dataproc_v1::model::TemplateParameter;
22544    /// let x = WorkflowTemplate::new()
22545    ///     .set_parameters([
22546    ///         TemplateParameter::default()/* use setters */,
22547    ///         TemplateParameter::default()/* use (different) setters */,
22548    ///     ]);
22549    /// ```
22550    pub fn set_parameters<T, V>(mut self, v: T) -> Self
22551    where
22552        T: std::iter::IntoIterator<Item = V>,
22553        V: std::convert::Into<crate::model::TemplateParameter>,
22554    {
22555        use std::iter::Iterator;
22556        self.parameters = v.into_iter().map(|i| i.into()).collect();
22557        self
22558    }
22559
22560    /// Sets the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
22561    ///
22562    /// # Example
22563    /// ```ignore,no_run
22564    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22565    /// use wkt::Duration;
22566    /// let x = WorkflowTemplate::new().set_dag_timeout(Duration::default()/* use setters */);
22567    /// ```
22568    pub fn set_dag_timeout<T>(mut self, v: T) -> Self
22569    where
22570        T: std::convert::Into<wkt::Duration>,
22571    {
22572        self.dag_timeout = std::option::Option::Some(v.into());
22573        self
22574    }
22575
22576    /// Sets or clears the value of [dag_timeout][crate::model::WorkflowTemplate::dag_timeout].
22577    ///
22578    /// # Example
22579    /// ```ignore,no_run
22580    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22581    /// use wkt::Duration;
22582    /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
22583    /// let x = WorkflowTemplate::new().set_or_clear_dag_timeout(None::<Duration>);
22584    /// ```
22585    pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
22586    where
22587        T: std::convert::Into<wkt::Duration>,
22588    {
22589        self.dag_timeout = v.map(|x| x.into());
22590        self
22591    }
22592
22593    /// Sets the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
22594    ///
22595    /// # Example
22596    /// ```ignore,no_run
22597    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22598    /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22599    /// let x = WorkflowTemplate::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
22600    /// ```
22601    pub fn set_encryption_config<T>(mut self, v: T) -> Self
22602    where
22603        T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
22604    {
22605        self.encryption_config = std::option::Option::Some(v.into());
22606        self
22607    }
22608
22609    /// Sets or clears the value of [encryption_config][crate::model::WorkflowTemplate::encryption_config].
22610    ///
22611    /// # Example
22612    /// ```ignore,no_run
22613    /// # use google_cloud_dataproc_v1::model::WorkflowTemplate;
22614    /// use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22615    /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
22616    /// let x = WorkflowTemplate::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
22617    /// ```
22618    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
22619    where
22620        T: std::convert::Into<crate::model::workflow_template::EncryptionConfig>,
22621    {
22622        self.encryption_config = v.map(|x| x.into());
22623        self
22624    }
22625}
22626
22627impl wkt::message::Message for WorkflowTemplate {
22628    fn typename() -> &'static str {
22629        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate"
22630    }
22631}
22632
22633/// Defines additional types related to [WorkflowTemplate].
22634pub mod workflow_template {
22635    #[allow(unused_imports)]
22636    use super::*;
22637
22638    /// Encryption settings for encrypting workflow template job arguments.
22639    #[derive(Clone, Default, PartialEq)]
22640    #[non_exhaustive]
22641    pub struct EncryptionConfig {
22642        /// Optional. The Cloud KMS key name to use for encrypting
22643        /// workflow template job arguments.
22644        ///
22645        /// When this this key is provided, the following workflow template
22646        /// [job arguments]
22647        /// (<https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows#adding_jobs_to_a_template>),
22648        /// if present, are
22649        /// [CMEK
22650        /// encrypted](https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_workflow_template_data):
22651        ///
22652        /// * [FlinkJob
22653        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob)
22654        /// * [HadoopJob
22655        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob)
22656        /// * [SparkJob
22657        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob)
22658        /// * [SparkRJob
22659        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob)
22660        /// * [PySparkJob
22661        ///   args](https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob)
22662        /// * [SparkSqlJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob)
22663        ///   scriptVariables and queryList.queries
22664        /// * [HiveJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob)
22665        ///   scriptVariables and queryList.queries
22666        /// * [PigJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob)
22667        ///   scriptVariables and queryList.queries
22668        /// * [PrestoJob](https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob)
22669        ///   scriptVariables and queryList.queries
22670        pub kms_key: std::string::String,
22671
22672        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22673    }
22674
22675    impl EncryptionConfig {
22676        pub fn new() -> Self {
22677            std::default::Default::default()
22678        }
22679
22680        /// Sets the value of [kms_key][crate::model::workflow_template::EncryptionConfig::kms_key].
22681        ///
22682        /// # Example
22683        /// ```ignore,no_run
22684        /// # use google_cloud_dataproc_v1::model::workflow_template::EncryptionConfig;
22685        /// let x = EncryptionConfig::new().set_kms_key("example");
22686        /// ```
22687        pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22688            self.kms_key = v.into();
22689            self
22690        }
22691    }
22692
22693    impl wkt::message::Message for EncryptionConfig {
22694        fn typename() -> &'static str {
22695            "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplate.EncryptionConfig"
22696        }
22697    }
22698}
22699
22700/// Specifies workflow execution target.
22701///
22702/// Either `managed_cluster` or `cluster_selector` is required.
22703#[derive(Clone, Default, PartialEq)]
22704#[non_exhaustive]
22705pub struct WorkflowTemplatePlacement {
22706    /// Required. Specifies where workflow executes; either on a managed
22707    /// cluster or an existing cluster chosen by labels.
22708    pub placement: std::option::Option<crate::model::workflow_template_placement::Placement>,
22709
22710    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22711}
22712
22713impl WorkflowTemplatePlacement {
22714    pub fn new() -> Self {
22715        std::default::Default::default()
22716    }
22717
22718    /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement].
22719    ///
22720    /// Note that all the setters affecting `placement` are mutually
22721    /// exclusive.
22722    ///
22723    /// # Example
22724    /// ```ignore,no_run
22725    /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22726    /// use google_cloud_dataproc_v1::model::ManagedCluster;
22727    /// let x = WorkflowTemplatePlacement::new().set_placement(Some(
22728    ///     google_cloud_dataproc_v1::model::workflow_template_placement::Placement::ManagedCluster(ManagedCluster::default().into())));
22729    /// ```
22730    pub fn set_placement<
22731        T: std::convert::Into<
22732                std::option::Option<crate::model::workflow_template_placement::Placement>,
22733            >,
22734    >(
22735        mut self,
22736        v: T,
22737    ) -> Self {
22738        self.placement = v.into();
22739        self
22740    }
22741
22742    /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22743    /// if it holds a `ManagedCluster`, `None` if the field is not set or
22744    /// holds a different branch.
22745    pub fn managed_cluster(
22746        &self,
22747    ) -> std::option::Option<&std::boxed::Box<crate::model::ManagedCluster>> {
22748        #[allow(unreachable_patterns)]
22749        self.placement.as_ref().and_then(|v| match v {
22750            crate::model::workflow_template_placement::Placement::ManagedCluster(v) => {
22751                std::option::Option::Some(v)
22752            }
22753            _ => std::option::Option::None,
22754        })
22755    }
22756
22757    /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22758    /// to hold a `ManagedCluster`.
22759    ///
22760    /// Note that all the setters affecting `placement` are
22761    /// mutually exclusive.
22762    ///
22763    /// # Example
22764    /// ```ignore,no_run
22765    /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22766    /// use google_cloud_dataproc_v1::model::ManagedCluster;
22767    /// let x = WorkflowTemplatePlacement::new().set_managed_cluster(ManagedCluster::default()/* use setters */);
22768    /// assert!(x.managed_cluster().is_some());
22769    /// assert!(x.cluster_selector().is_none());
22770    /// ```
22771    pub fn set_managed_cluster<
22772        T: std::convert::Into<std::boxed::Box<crate::model::ManagedCluster>>,
22773    >(
22774        mut self,
22775        v: T,
22776    ) -> Self {
22777        self.placement = std::option::Option::Some(
22778            crate::model::workflow_template_placement::Placement::ManagedCluster(v.into()),
22779        );
22780        self
22781    }
22782
22783    /// The value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22784    /// if it holds a `ClusterSelector`, `None` if the field is not set or
22785    /// holds a different branch.
22786    pub fn cluster_selector(
22787        &self,
22788    ) -> std::option::Option<&std::boxed::Box<crate::model::ClusterSelector>> {
22789        #[allow(unreachable_patterns)]
22790        self.placement.as_ref().and_then(|v| match v {
22791            crate::model::workflow_template_placement::Placement::ClusterSelector(v) => {
22792                std::option::Option::Some(v)
22793            }
22794            _ => std::option::Option::None,
22795        })
22796    }
22797
22798    /// Sets the value of [placement][crate::model::WorkflowTemplatePlacement::placement]
22799    /// to hold a `ClusterSelector`.
22800    ///
22801    /// Note that all the setters affecting `placement` are
22802    /// mutually exclusive.
22803    ///
22804    /// # Example
22805    /// ```ignore,no_run
22806    /// # use google_cloud_dataproc_v1::model::WorkflowTemplatePlacement;
22807    /// use google_cloud_dataproc_v1::model::ClusterSelector;
22808    /// let x = WorkflowTemplatePlacement::new().set_cluster_selector(ClusterSelector::default()/* use setters */);
22809    /// assert!(x.cluster_selector().is_some());
22810    /// assert!(x.managed_cluster().is_none());
22811    /// ```
22812    pub fn set_cluster_selector<
22813        T: std::convert::Into<std::boxed::Box<crate::model::ClusterSelector>>,
22814    >(
22815        mut self,
22816        v: T,
22817    ) -> Self {
22818        self.placement = std::option::Option::Some(
22819            crate::model::workflow_template_placement::Placement::ClusterSelector(v.into()),
22820        );
22821        self
22822    }
22823}
22824
22825impl wkt::message::Message for WorkflowTemplatePlacement {
22826    fn typename() -> &'static str {
22827        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowTemplatePlacement"
22828    }
22829}
22830
22831/// Defines additional types related to [WorkflowTemplatePlacement].
22832pub mod workflow_template_placement {
22833    #[allow(unused_imports)]
22834    use super::*;
22835
22836    /// Required. Specifies where workflow executes; either on a managed
22837    /// cluster or an existing cluster chosen by labels.
22838    #[derive(Clone, Debug, PartialEq)]
22839    #[non_exhaustive]
22840    pub enum Placement {
22841        /// A cluster that is managed by the workflow.
22842        ManagedCluster(std::boxed::Box<crate::model::ManagedCluster>),
22843        /// Optional. A selector that chooses target cluster for jobs based
22844        /// on metadata.
22845        ///
22846        /// The selector is evaluated at the time each job is submitted.
22847        ClusterSelector(std::boxed::Box<crate::model::ClusterSelector>),
22848    }
22849}
22850
22851/// Cluster that is managed by the workflow.
22852#[derive(Clone, Default, PartialEq)]
22853#[non_exhaustive]
22854pub struct ManagedCluster {
22855    /// Required. The cluster name prefix. A unique cluster name will be formed by
22856    /// appending a random suffix.
22857    ///
22858    /// The name must contain only lower-case letters (a-z), numbers (0-9),
22859    /// and hyphens (-). Must begin with a letter. Cannot begin or end with
22860    /// hyphen. Must consist of between 2 and 35 characters.
22861    pub cluster_name: std::string::String,
22862
22863    /// Required. The cluster configuration.
22864    pub config: std::option::Option<crate::model::ClusterConfig>,
22865
22866    /// Optional. The labels to associate with this cluster.
22867    ///
22868    /// Label keys must be between 1 and 63 characters long, and must conform to
22869    /// the following PCRE regular expression:
22870    /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
22871    ///
22872    /// Label values must be between 1 and 63 characters long, and must conform to
22873    /// the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
22874    ///
22875    /// No more than 32 labels can be associated with a given cluster.
22876    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
22877
22878    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22879}
22880
22881impl ManagedCluster {
22882    pub fn new() -> Self {
22883        std::default::Default::default()
22884    }
22885
22886    /// Sets the value of [cluster_name][crate::model::ManagedCluster::cluster_name].
22887    ///
22888    /// # Example
22889    /// ```ignore,no_run
22890    /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22891    /// let x = ManagedCluster::new().set_cluster_name("example");
22892    /// ```
22893    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22894        self.cluster_name = v.into();
22895        self
22896    }
22897
22898    /// Sets the value of [config][crate::model::ManagedCluster::config].
22899    ///
22900    /// # Example
22901    /// ```ignore,no_run
22902    /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22903    /// use google_cloud_dataproc_v1::model::ClusterConfig;
22904    /// let x = ManagedCluster::new().set_config(ClusterConfig::default()/* use setters */);
22905    /// ```
22906    pub fn set_config<T>(mut self, v: T) -> Self
22907    where
22908        T: std::convert::Into<crate::model::ClusterConfig>,
22909    {
22910        self.config = std::option::Option::Some(v.into());
22911        self
22912    }
22913
22914    /// Sets or clears the value of [config][crate::model::ManagedCluster::config].
22915    ///
22916    /// # Example
22917    /// ```ignore,no_run
22918    /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22919    /// use google_cloud_dataproc_v1::model::ClusterConfig;
22920    /// let x = ManagedCluster::new().set_or_clear_config(Some(ClusterConfig::default()/* use setters */));
22921    /// let x = ManagedCluster::new().set_or_clear_config(None::<ClusterConfig>);
22922    /// ```
22923    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
22924    where
22925        T: std::convert::Into<crate::model::ClusterConfig>,
22926    {
22927        self.config = v.map(|x| x.into());
22928        self
22929    }
22930
22931    /// Sets the value of [labels][crate::model::ManagedCluster::labels].
22932    ///
22933    /// # Example
22934    /// ```ignore,no_run
22935    /// # use google_cloud_dataproc_v1::model::ManagedCluster;
22936    /// let x = ManagedCluster::new().set_labels([
22937    ///     ("key0", "abc"),
22938    ///     ("key1", "xyz"),
22939    /// ]);
22940    /// ```
22941    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
22942    where
22943        T: std::iter::IntoIterator<Item = (K, V)>,
22944        K: std::convert::Into<std::string::String>,
22945        V: std::convert::Into<std::string::String>,
22946    {
22947        use std::iter::Iterator;
22948        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
22949        self
22950    }
22951}
22952
22953impl wkt::message::Message for ManagedCluster {
22954    fn typename() -> &'static str {
22955        "type.googleapis.com/google.cloud.dataproc.v1.ManagedCluster"
22956    }
22957}
22958
22959/// A selector that chooses target cluster for jobs based on metadata.
22960#[derive(Clone, Default, PartialEq)]
22961#[non_exhaustive]
22962pub struct ClusterSelector {
22963    /// Optional. The zone where workflow process executes. This parameter does not
22964    /// affect the selection of the cluster.
22965    ///
22966    /// If unspecified, the zone of the first cluster matching the selector
22967    /// is used.
22968    pub zone: std::string::String,
22969
22970    /// Required. The cluster labels. Cluster must have all labels
22971    /// to match.
22972    pub cluster_labels: std::collections::HashMap<std::string::String, std::string::String>,
22973
22974    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22975}
22976
22977impl ClusterSelector {
22978    pub fn new() -> Self {
22979        std::default::Default::default()
22980    }
22981
22982    /// Sets the value of [zone][crate::model::ClusterSelector::zone].
22983    ///
22984    /// # Example
22985    /// ```ignore,no_run
22986    /// # use google_cloud_dataproc_v1::model::ClusterSelector;
22987    /// let x = ClusterSelector::new().set_zone("example");
22988    /// ```
22989    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22990        self.zone = v.into();
22991        self
22992    }
22993
22994    /// Sets the value of [cluster_labels][crate::model::ClusterSelector::cluster_labels].
22995    ///
22996    /// # Example
22997    /// ```ignore,no_run
22998    /// # use google_cloud_dataproc_v1::model::ClusterSelector;
22999    /// let x = ClusterSelector::new().set_cluster_labels([
23000    ///     ("key0", "abc"),
23001    ///     ("key1", "xyz"),
23002    /// ]);
23003    /// ```
23004    pub fn set_cluster_labels<T, K, V>(mut self, v: T) -> Self
23005    where
23006        T: std::iter::IntoIterator<Item = (K, V)>,
23007        K: std::convert::Into<std::string::String>,
23008        V: std::convert::Into<std::string::String>,
23009    {
23010        use std::iter::Iterator;
23011        self.cluster_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23012        self
23013    }
23014}
23015
23016impl wkt::message::Message for ClusterSelector {
23017    fn typename() -> &'static str {
23018        "type.googleapis.com/google.cloud.dataproc.v1.ClusterSelector"
23019    }
23020}
23021
23022/// A job executed by the workflow.
23023#[derive(Clone, Default, PartialEq)]
23024#[non_exhaustive]
23025pub struct OrderedJob {
23026    /// Required. The step id. The id must be unique among all jobs
23027    /// within the template.
23028    ///
23029    /// The step id is used as prefix for job id, as job
23030    /// `goog-dataproc-workflow-step-id` label, and in
23031    /// [prerequisiteStepIds][google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]
23032    /// field from other steps.
23033    ///
23034    /// The id must contain only letters (a-z, A-Z), numbers (0-9),
23035    /// underscores (_), and hyphens (-). Cannot begin or end with underscore
23036    /// or hyphen. Must consist of between 3 and 50 characters.
23037    ///
23038    /// [google.cloud.dataproc.v1.OrderedJob.prerequisite_step_ids]: crate::model::OrderedJob::prerequisite_step_ids
23039    pub step_id: std::string::String,
23040
23041    /// Optional. The labels to associate with this job.
23042    ///
23043    /// Label keys must be between 1 and 63 characters long, and must conform to
23044    /// the following regular expression:
23045    /// [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
23046    ///
23047    /// Label values must be between 1 and 63 characters long, and must conform to
23048    /// the following regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
23049    ///
23050    /// No more than 32 labels can be associated with a given job.
23051    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23052
23053    /// Optional. Job scheduling configuration.
23054    pub scheduling: std::option::Option<crate::model::JobScheduling>,
23055
23056    /// Optional. The optional list of prerequisite job step_ids.
23057    /// If not specified, the job will start at the beginning of workflow.
23058    pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
23059
23060    /// Required. The job definition.
23061    pub job_type: std::option::Option<crate::model::ordered_job::JobType>,
23062
23063    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23064}
23065
23066impl OrderedJob {
23067    pub fn new() -> Self {
23068        std::default::Default::default()
23069    }
23070
23071    /// Sets the value of [step_id][crate::model::OrderedJob::step_id].
23072    ///
23073    /// # Example
23074    /// ```ignore,no_run
23075    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23076    /// let x = OrderedJob::new().set_step_id("example");
23077    /// ```
23078    pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23079        self.step_id = v.into();
23080        self
23081    }
23082
23083    /// Sets the value of [labels][crate::model::OrderedJob::labels].
23084    ///
23085    /// # Example
23086    /// ```ignore,no_run
23087    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23088    /// let x = OrderedJob::new().set_labels([
23089    ///     ("key0", "abc"),
23090    ///     ("key1", "xyz"),
23091    /// ]);
23092    /// ```
23093    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23094    where
23095        T: std::iter::IntoIterator<Item = (K, V)>,
23096        K: std::convert::Into<std::string::String>,
23097        V: std::convert::Into<std::string::String>,
23098    {
23099        use std::iter::Iterator;
23100        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23101        self
23102    }
23103
23104    /// Sets the value of [scheduling][crate::model::OrderedJob::scheduling].
23105    ///
23106    /// # Example
23107    /// ```ignore,no_run
23108    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23109    /// use google_cloud_dataproc_v1::model::JobScheduling;
23110    /// let x = OrderedJob::new().set_scheduling(JobScheduling::default()/* use setters */);
23111    /// ```
23112    pub fn set_scheduling<T>(mut self, v: T) -> Self
23113    where
23114        T: std::convert::Into<crate::model::JobScheduling>,
23115    {
23116        self.scheduling = std::option::Option::Some(v.into());
23117        self
23118    }
23119
23120    /// Sets or clears the value of [scheduling][crate::model::OrderedJob::scheduling].
23121    ///
23122    /// # Example
23123    /// ```ignore,no_run
23124    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23125    /// use google_cloud_dataproc_v1::model::JobScheduling;
23126    /// let x = OrderedJob::new().set_or_clear_scheduling(Some(JobScheduling::default()/* use setters */));
23127    /// let x = OrderedJob::new().set_or_clear_scheduling(None::<JobScheduling>);
23128    /// ```
23129    pub fn set_or_clear_scheduling<T>(mut self, v: std::option::Option<T>) -> Self
23130    where
23131        T: std::convert::Into<crate::model::JobScheduling>,
23132    {
23133        self.scheduling = v.map(|x| x.into());
23134        self
23135    }
23136
23137    /// Sets the value of [prerequisite_step_ids][crate::model::OrderedJob::prerequisite_step_ids].
23138    ///
23139    /// # Example
23140    /// ```ignore,no_run
23141    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23142    /// let x = OrderedJob::new().set_prerequisite_step_ids(["a", "b", "c"]);
23143    /// ```
23144    pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
23145    where
23146        T: std::iter::IntoIterator<Item = V>,
23147        V: std::convert::Into<std::string::String>,
23148    {
23149        use std::iter::Iterator;
23150        self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
23151        self
23152    }
23153
23154    /// Sets the value of [job_type][crate::model::OrderedJob::job_type].
23155    ///
23156    /// Note that all the setters affecting `job_type` are mutually
23157    /// exclusive.
23158    ///
23159    /// # Example
23160    /// ```ignore,no_run
23161    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23162    /// use google_cloud_dataproc_v1::model::HadoopJob;
23163    /// let x = OrderedJob::new().set_job_type(Some(
23164    ///     google_cloud_dataproc_v1::model::ordered_job::JobType::HadoopJob(HadoopJob::default().into())));
23165    /// ```
23166    pub fn set_job_type<
23167        T: std::convert::Into<std::option::Option<crate::model::ordered_job::JobType>>,
23168    >(
23169        mut self,
23170        v: T,
23171    ) -> Self {
23172        self.job_type = v.into();
23173        self
23174    }
23175
23176    /// The value of [job_type][crate::model::OrderedJob::job_type]
23177    /// if it holds a `HadoopJob`, `None` if the field is not set or
23178    /// holds a different branch.
23179    pub fn hadoop_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HadoopJob>> {
23180        #[allow(unreachable_patterns)]
23181        self.job_type.as_ref().and_then(|v| match v {
23182            crate::model::ordered_job::JobType::HadoopJob(v) => std::option::Option::Some(v),
23183            _ => std::option::Option::None,
23184        })
23185    }
23186
23187    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23188    /// to hold a `HadoopJob`.
23189    ///
23190    /// Note that all the setters affecting `job_type` are
23191    /// mutually exclusive.
23192    ///
23193    /// # Example
23194    /// ```ignore,no_run
23195    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23196    /// use google_cloud_dataproc_v1::model::HadoopJob;
23197    /// let x = OrderedJob::new().set_hadoop_job(HadoopJob::default()/* use setters */);
23198    /// assert!(x.hadoop_job().is_some());
23199    /// assert!(x.spark_job().is_none());
23200    /// assert!(x.pyspark_job().is_none());
23201    /// assert!(x.hive_job().is_none());
23202    /// assert!(x.pig_job().is_none());
23203    /// assert!(x.spark_r_job().is_none());
23204    /// assert!(x.spark_sql_job().is_none());
23205    /// assert!(x.presto_job().is_none());
23206    /// assert!(x.trino_job().is_none());
23207    /// assert!(x.flink_job().is_none());
23208    /// ```
23209    pub fn set_hadoop_job<T: std::convert::Into<std::boxed::Box<crate::model::HadoopJob>>>(
23210        mut self,
23211        v: T,
23212    ) -> Self {
23213        self.job_type =
23214            std::option::Option::Some(crate::model::ordered_job::JobType::HadoopJob(v.into()));
23215        self
23216    }
23217
23218    /// The value of [job_type][crate::model::OrderedJob::job_type]
23219    /// if it holds a `SparkJob`, `None` if the field is not set or
23220    /// holds a different branch.
23221    pub fn spark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkJob>> {
23222        #[allow(unreachable_patterns)]
23223        self.job_type.as_ref().and_then(|v| match v {
23224            crate::model::ordered_job::JobType::SparkJob(v) => std::option::Option::Some(v),
23225            _ => std::option::Option::None,
23226        })
23227    }
23228
23229    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23230    /// to hold a `SparkJob`.
23231    ///
23232    /// Note that all the setters affecting `job_type` are
23233    /// mutually exclusive.
23234    ///
23235    /// # Example
23236    /// ```ignore,no_run
23237    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23238    /// use google_cloud_dataproc_v1::model::SparkJob;
23239    /// let x = OrderedJob::new().set_spark_job(SparkJob::default()/* use setters */);
23240    /// assert!(x.spark_job().is_some());
23241    /// assert!(x.hadoop_job().is_none());
23242    /// assert!(x.pyspark_job().is_none());
23243    /// assert!(x.hive_job().is_none());
23244    /// assert!(x.pig_job().is_none());
23245    /// assert!(x.spark_r_job().is_none());
23246    /// assert!(x.spark_sql_job().is_none());
23247    /// assert!(x.presto_job().is_none());
23248    /// assert!(x.trino_job().is_none());
23249    /// assert!(x.flink_job().is_none());
23250    /// ```
23251    pub fn set_spark_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkJob>>>(
23252        mut self,
23253        v: T,
23254    ) -> Self {
23255        self.job_type =
23256            std::option::Option::Some(crate::model::ordered_job::JobType::SparkJob(v.into()));
23257        self
23258    }
23259
23260    /// The value of [job_type][crate::model::OrderedJob::job_type]
23261    /// if it holds a `PysparkJob`, `None` if the field is not set or
23262    /// holds a different branch.
23263    pub fn pyspark_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PySparkJob>> {
23264        #[allow(unreachable_patterns)]
23265        self.job_type.as_ref().and_then(|v| match v {
23266            crate::model::ordered_job::JobType::PysparkJob(v) => std::option::Option::Some(v),
23267            _ => std::option::Option::None,
23268        })
23269    }
23270
23271    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23272    /// to hold a `PysparkJob`.
23273    ///
23274    /// Note that all the setters affecting `job_type` are
23275    /// mutually exclusive.
23276    ///
23277    /// # Example
23278    /// ```ignore,no_run
23279    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23280    /// use google_cloud_dataproc_v1::model::PySparkJob;
23281    /// let x = OrderedJob::new().set_pyspark_job(PySparkJob::default()/* use setters */);
23282    /// assert!(x.pyspark_job().is_some());
23283    /// assert!(x.hadoop_job().is_none());
23284    /// assert!(x.spark_job().is_none());
23285    /// assert!(x.hive_job().is_none());
23286    /// assert!(x.pig_job().is_none());
23287    /// assert!(x.spark_r_job().is_none());
23288    /// assert!(x.spark_sql_job().is_none());
23289    /// assert!(x.presto_job().is_none());
23290    /// assert!(x.trino_job().is_none());
23291    /// assert!(x.flink_job().is_none());
23292    /// ```
23293    pub fn set_pyspark_job<T: std::convert::Into<std::boxed::Box<crate::model::PySparkJob>>>(
23294        mut self,
23295        v: T,
23296    ) -> Self {
23297        self.job_type =
23298            std::option::Option::Some(crate::model::ordered_job::JobType::PysparkJob(v.into()));
23299        self
23300    }
23301
23302    /// The value of [job_type][crate::model::OrderedJob::job_type]
23303    /// if it holds a `HiveJob`, `None` if the field is not set or
23304    /// holds a different branch.
23305    pub fn hive_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::HiveJob>> {
23306        #[allow(unreachable_patterns)]
23307        self.job_type.as_ref().and_then(|v| match v {
23308            crate::model::ordered_job::JobType::HiveJob(v) => std::option::Option::Some(v),
23309            _ => std::option::Option::None,
23310        })
23311    }
23312
23313    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23314    /// to hold a `HiveJob`.
23315    ///
23316    /// Note that all the setters affecting `job_type` are
23317    /// mutually exclusive.
23318    ///
23319    /// # Example
23320    /// ```ignore,no_run
23321    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23322    /// use google_cloud_dataproc_v1::model::HiveJob;
23323    /// let x = OrderedJob::new().set_hive_job(HiveJob::default()/* use setters */);
23324    /// assert!(x.hive_job().is_some());
23325    /// assert!(x.hadoop_job().is_none());
23326    /// assert!(x.spark_job().is_none());
23327    /// assert!(x.pyspark_job().is_none());
23328    /// assert!(x.pig_job().is_none());
23329    /// assert!(x.spark_r_job().is_none());
23330    /// assert!(x.spark_sql_job().is_none());
23331    /// assert!(x.presto_job().is_none());
23332    /// assert!(x.trino_job().is_none());
23333    /// assert!(x.flink_job().is_none());
23334    /// ```
23335    pub fn set_hive_job<T: std::convert::Into<std::boxed::Box<crate::model::HiveJob>>>(
23336        mut self,
23337        v: T,
23338    ) -> Self {
23339        self.job_type =
23340            std::option::Option::Some(crate::model::ordered_job::JobType::HiveJob(v.into()));
23341        self
23342    }
23343
23344    /// The value of [job_type][crate::model::OrderedJob::job_type]
23345    /// if it holds a `PigJob`, `None` if the field is not set or
23346    /// holds a different branch.
23347    pub fn pig_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PigJob>> {
23348        #[allow(unreachable_patterns)]
23349        self.job_type.as_ref().and_then(|v| match v {
23350            crate::model::ordered_job::JobType::PigJob(v) => std::option::Option::Some(v),
23351            _ => std::option::Option::None,
23352        })
23353    }
23354
23355    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23356    /// to hold a `PigJob`.
23357    ///
23358    /// Note that all the setters affecting `job_type` are
23359    /// mutually exclusive.
23360    ///
23361    /// # Example
23362    /// ```ignore,no_run
23363    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23364    /// use google_cloud_dataproc_v1::model::PigJob;
23365    /// let x = OrderedJob::new().set_pig_job(PigJob::default()/* use setters */);
23366    /// assert!(x.pig_job().is_some());
23367    /// assert!(x.hadoop_job().is_none());
23368    /// assert!(x.spark_job().is_none());
23369    /// assert!(x.pyspark_job().is_none());
23370    /// assert!(x.hive_job().is_none());
23371    /// assert!(x.spark_r_job().is_none());
23372    /// assert!(x.spark_sql_job().is_none());
23373    /// assert!(x.presto_job().is_none());
23374    /// assert!(x.trino_job().is_none());
23375    /// assert!(x.flink_job().is_none());
23376    /// ```
23377    pub fn set_pig_job<T: std::convert::Into<std::boxed::Box<crate::model::PigJob>>>(
23378        mut self,
23379        v: T,
23380    ) -> Self {
23381        self.job_type =
23382            std::option::Option::Some(crate::model::ordered_job::JobType::PigJob(v.into()));
23383        self
23384    }
23385
23386    /// The value of [job_type][crate::model::OrderedJob::job_type]
23387    /// if it holds a `SparkRJob`, `None` if the field is not set or
23388    /// holds a different branch.
23389    pub fn spark_r_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparkRJob>> {
23390        #[allow(unreachable_patterns)]
23391        self.job_type.as_ref().and_then(|v| match v {
23392            crate::model::ordered_job::JobType::SparkRJob(v) => std::option::Option::Some(v),
23393            _ => std::option::Option::None,
23394        })
23395    }
23396
23397    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23398    /// to hold a `SparkRJob`.
23399    ///
23400    /// Note that all the setters affecting `job_type` are
23401    /// mutually exclusive.
23402    ///
23403    /// # Example
23404    /// ```ignore,no_run
23405    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23406    /// use google_cloud_dataproc_v1::model::SparkRJob;
23407    /// let x = OrderedJob::new().set_spark_r_job(SparkRJob::default()/* use setters */);
23408    /// assert!(x.spark_r_job().is_some());
23409    /// assert!(x.hadoop_job().is_none());
23410    /// assert!(x.spark_job().is_none());
23411    /// assert!(x.pyspark_job().is_none());
23412    /// assert!(x.hive_job().is_none());
23413    /// assert!(x.pig_job().is_none());
23414    /// assert!(x.spark_sql_job().is_none());
23415    /// assert!(x.presto_job().is_none());
23416    /// assert!(x.trino_job().is_none());
23417    /// assert!(x.flink_job().is_none());
23418    /// ```
23419    pub fn set_spark_r_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkRJob>>>(
23420        mut self,
23421        v: T,
23422    ) -> Self {
23423        self.job_type =
23424            std::option::Option::Some(crate::model::ordered_job::JobType::SparkRJob(v.into()));
23425        self
23426    }
23427
23428    /// The value of [job_type][crate::model::OrderedJob::job_type]
23429    /// if it holds a `SparkSqlJob`, `None` if the field is not set or
23430    /// holds a different branch.
23431    pub fn spark_sql_job(
23432        &self,
23433    ) -> std::option::Option<&std::boxed::Box<crate::model::SparkSqlJob>> {
23434        #[allow(unreachable_patterns)]
23435        self.job_type.as_ref().and_then(|v| match v {
23436            crate::model::ordered_job::JobType::SparkSqlJob(v) => std::option::Option::Some(v),
23437            _ => std::option::Option::None,
23438        })
23439    }
23440
23441    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23442    /// to hold a `SparkSqlJob`.
23443    ///
23444    /// Note that all the setters affecting `job_type` are
23445    /// mutually exclusive.
23446    ///
23447    /// # Example
23448    /// ```ignore,no_run
23449    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23450    /// use google_cloud_dataproc_v1::model::SparkSqlJob;
23451    /// let x = OrderedJob::new().set_spark_sql_job(SparkSqlJob::default()/* use setters */);
23452    /// assert!(x.spark_sql_job().is_some());
23453    /// assert!(x.hadoop_job().is_none());
23454    /// assert!(x.spark_job().is_none());
23455    /// assert!(x.pyspark_job().is_none());
23456    /// assert!(x.hive_job().is_none());
23457    /// assert!(x.pig_job().is_none());
23458    /// assert!(x.spark_r_job().is_none());
23459    /// assert!(x.presto_job().is_none());
23460    /// assert!(x.trino_job().is_none());
23461    /// assert!(x.flink_job().is_none());
23462    /// ```
23463    pub fn set_spark_sql_job<T: std::convert::Into<std::boxed::Box<crate::model::SparkSqlJob>>>(
23464        mut self,
23465        v: T,
23466    ) -> Self {
23467        self.job_type =
23468            std::option::Option::Some(crate::model::ordered_job::JobType::SparkSqlJob(v.into()));
23469        self
23470    }
23471
23472    /// The value of [job_type][crate::model::OrderedJob::job_type]
23473    /// if it holds a `PrestoJob`, `None` if the field is not set or
23474    /// holds a different branch.
23475    pub fn presto_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::PrestoJob>> {
23476        #[allow(unreachable_patterns)]
23477        self.job_type.as_ref().and_then(|v| match v {
23478            crate::model::ordered_job::JobType::PrestoJob(v) => std::option::Option::Some(v),
23479            _ => std::option::Option::None,
23480        })
23481    }
23482
23483    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23484    /// to hold a `PrestoJob`.
23485    ///
23486    /// Note that all the setters affecting `job_type` are
23487    /// mutually exclusive.
23488    ///
23489    /// # Example
23490    /// ```ignore,no_run
23491    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23492    /// use google_cloud_dataproc_v1::model::PrestoJob;
23493    /// let x = OrderedJob::new().set_presto_job(PrestoJob::default()/* use setters */);
23494    /// assert!(x.presto_job().is_some());
23495    /// assert!(x.hadoop_job().is_none());
23496    /// assert!(x.spark_job().is_none());
23497    /// assert!(x.pyspark_job().is_none());
23498    /// assert!(x.hive_job().is_none());
23499    /// assert!(x.pig_job().is_none());
23500    /// assert!(x.spark_r_job().is_none());
23501    /// assert!(x.spark_sql_job().is_none());
23502    /// assert!(x.trino_job().is_none());
23503    /// assert!(x.flink_job().is_none());
23504    /// ```
23505    pub fn set_presto_job<T: std::convert::Into<std::boxed::Box<crate::model::PrestoJob>>>(
23506        mut self,
23507        v: T,
23508    ) -> Self {
23509        self.job_type =
23510            std::option::Option::Some(crate::model::ordered_job::JobType::PrestoJob(v.into()));
23511        self
23512    }
23513
23514    /// The value of [job_type][crate::model::OrderedJob::job_type]
23515    /// if it holds a `TrinoJob`, `None` if the field is not set or
23516    /// holds a different branch.
23517    pub fn trino_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::TrinoJob>> {
23518        #[allow(unreachable_patterns)]
23519        self.job_type.as_ref().and_then(|v| match v {
23520            crate::model::ordered_job::JobType::TrinoJob(v) => std::option::Option::Some(v),
23521            _ => std::option::Option::None,
23522        })
23523    }
23524
23525    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23526    /// to hold a `TrinoJob`.
23527    ///
23528    /// Note that all the setters affecting `job_type` are
23529    /// mutually exclusive.
23530    ///
23531    /// # Example
23532    /// ```ignore,no_run
23533    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23534    /// use google_cloud_dataproc_v1::model::TrinoJob;
23535    /// let x = OrderedJob::new().set_trino_job(TrinoJob::default()/* use setters */);
23536    /// assert!(x.trino_job().is_some());
23537    /// assert!(x.hadoop_job().is_none());
23538    /// assert!(x.spark_job().is_none());
23539    /// assert!(x.pyspark_job().is_none());
23540    /// assert!(x.hive_job().is_none());
23541    /// assert!(x.pig_job().is_none());
23542    /// assert!(x.spark_r_job().is_none());
23543    /// assert!(x.spark_sql_job().is_none());
23544    /// assert!(x.presto_job().is_none());
23545    /// assert!(x.flink_job().is_none());
23546    /// ```
23547    pub fn set_trino_job<T: std::convert::Into<std::boxed::Box<crate::model::TrinoJob>>>(
23548        mut self,
23549        v: T,
23550    ) -> Self {
23551        self.job_type =
23552            std::option::Option::Some(crate::model::ordered_job::JobType::TrinoJob(v.into()));
23553        self
23554    }
23555
23556    /// The value of [job_type][crate::model::OrderedJob::job_type]
23557    /// if it holds a `FlinkJob`, `None` if the field is not set or
23558    /// holds a different branch.
23559    pub fn flink_job(&self) -> std::option::Option<&std::boxed::Box<crate::model::FlinkJob>> {
23560        #[allow(unreachable_patterns)]
23561        self.job_type.as_ref().and_then(|v| match v {
23562            crate::model::ordered_job::JobType::FlinkJob(v) => std::option::Option::Some(v),
23563            _ => std::option::Option::None,
23564        })
23565    }
23566
23567    /// Sets the value of [job_type][crate::model::OrderedJob::job_type]
23568    /// to hold a `FlinkJob`.
23569    ///
23570    /// Note that all the setters affecting `job_type` are
23571    /// mutually exclusive.
23572    ///
23573    /// # Example
23574    /// ```ignore,no_run
23575    /// # use google_cloud_dataproc_v1::model::OrderedJob;
23576    /// use google_cloud_dataproc_v1::model::FlinkJob;
23577    /// let x = OrderedJob::new().set_flink_job(FlinkJob::default()/* use setters */);
23578    /// assert!(x.flink_job().is_some());
23579    /// assert!(x.hadoop_job().is_none());
23580    /// assert!(x.spark_job().is_none());
23581    /// assert!(x.pyspark_job().is_none());
23582    /// assert!(x.hive_job().is_none());
23583    /// assert!(x.pig_job().is_none());
23584    /// assert!(x.spark_r_job().is_none());
23585    /// assert!(x.spark_sql_job().is_none());
23586    /// assert!(x.presto_job().is_none());
23587    /// assert!(x.trino_job().is_none());
23588    /// ```
23589    pub fn set_flink_job<T: std::convert::Into<std::boxed::Box<crate::model::FlinkJob>>>(
23590        mut self,
23591        v: T,
23592    ) -> Self {
23593        self.job_type =
23594            std::option::Option::Some(crate::model::ordered_job::JobType::FlinkJob(v.into()));
23595        self
23596    }
23597}
23598
23599impl wkt::message::Message for OrderedJob {
23600    fn typename() -> &'static str {
23601        "type.googleapis.com/google.cloud.dataproc.v1.OrderedJob"
23602    }
23603}
23604
23605/// Defines additional types related to [OrderedJob].
23606pub mod ordered_job {
23607    #[allow(unused_imports)]
23608    use super::*;
23609
23610    /// Required. The job definition.
23611    #[derive(Clone, Debug, PartialEq)]
23612    #[non_exhaustive]
23613    pub enum JobType {
23614        /// Optional. Job is a Hadoop job.
23615        HadoopJob(std::boxed::Box<crate::model::HadoopJob>),
23616        /// Optional. Job is a Spark job.
23617        SparkJob(std::boxed::Box<crate::model::SparkJob>),
23618        /// Optional. Job is a PySpark job.
23619        PysparkJob(std::boxed::Box<crate::model::PySparkJob>),
23620        /// Optional. Job is a Hive job.
23621        HiveJob(std::boxed::Box<crate::model::HiveJob>),
23622        /// Optional. Job is a Pig job.
23623        PigJob(std::boxed::Box<crate::model::PigJob>),
23624        /// Optional. Job is a SparkR job.
23625        SparkRJob(std::boxed::Box<crate::model::SparkRJob>),
23626        /// Optional. Job is a SparkSql job.
23627        SparkSqlJob(std::boxed::Box<crate::model::SparkSqlJob>),
23628        /// Optional. Job is a Presto job.
23629        PrestoJob(std::boxed::Box<crate::model::PrestoJob>),
23630        /// Optional. Job is a Trino job.
23631        TrinoJob(std::boxed::Box<crate::model::TrinoJob>),
23632        /// Optional. Job is a Flink job.
23633        FlinkJob(std::boxed::Box<crate::model::FlinkJob>),
23634    }
23635}
23636
23637/// A configurable parameter that replaces one or more fields in the template.
23638/// Parameterizable fields:
23639///
23640/// - Labels
23641/// - File uris
23642/// - Job properties
23643/// - Job arguments
23644/// - Script variables
23645/// - Main class (in HadoopJob and SparkJob)
23646/// - Zone (in ClusterSelector)
23647#[derive(Clone, Default, PartialEq)]
23648#[non_exhaustive]
23649pub struct TemplateParameter {
23650    /// Required. Parameter name.
23651    /// The parameter name is used as the key, and paired with the
23652    /// parameter value, which are passed to the template when the template
23653    /// is instantiated.
23654    /// The name must contain only capital letters (A-Z), numbers (0-9), and
23655    /// underscores (_), and must not start with a number. The maximum length is
23656    /// 40 characters.
23657    pub name: std::string::String,
23658
23659    /// Required. Paths to all fields that the parameter replaces.
23660    /// A field is allowed to appear in at most one parameter's list of field
23661    /// paths.
23662    ///
23663    /// A field path is similar in syntax to a
23664    /// [google.protobuf.FieldMask][google.protobuf.FieldMask]. For example, a
23665    /// field path that references the zone field of a workflow template's cluster
23666    /// selector would be specified as `placement.clusterSelector.zone`.
23667    ///
23668    /// Also, field paths can reference fields using the following syntax:
23669    ///
23670    /// * Values in maps can be referenced by key:
23671    ///
23672    ///   * labels['key']
23673    ///   * placement.clusterSelector.clusterLabels['key']
23674    ///   * placement.managedCluster.labels['key']
23675    ///   * placement.clusterSelector.clusterLabels['key']
23676    ///   * jobs['step-id'].labels['key']
23677    /// * Jobs in the jobs list can be referenced by step-id:
23678    ///
23679    ///   * jobs['step-id'].hadoopJob.mainJarFileUri
23680    ///   * jobs['step-id'].hiveJob.queryFileUri
23681    ///   * jobs['step-id'].pySparkJob.mainPythonFileUri
23682    ///   * jobs['step-id'].hadoopJob.jarFileUris[0]
23683    ///   * jobs['step-id'].hadoopJob.archiveUris[0]
23684    ///   * jobs['step-id'].hadoopJob.fileUris[0]
23685    ///   * jobs['step-id'].pySparkJob.pythonFileUris[0]
23686    /// * Items in repeated fields can be referenced by a zero-based index:
23687    ///
23688    ///   * jobs['step-id'].sparkJob.args[0]
23689    /// * Other examples:
23690    ///
23691    ///   * jobs['step-id'].hadoopJob.properties['key']
23692    ///   * jobs['step-id'].hadoopJob.args[0]
23693    ///   * jobs['step-id'].hiveJob.scriptVariables['key']
23694    ///   * jobs['step-id'].hadoopJob.mainJarFileUri
23695    ///   * placement.clusterSelector.zone
23696    ///
23697    /// It may not be possible to parameterize maps and repeated fields in their
23698    /// entirety since only individual map values and individual items in repeated
23699    /// fields can be referenced. For example, the following field paths are
23700    /// invalid:
23701    ///
23702    /// - placement.clusterSelector.clusterLabels
23703    /// - jobs['step-id'].sparkJob.args
23704    ///
23705    /// [google.protobuf.FieldMask]: wkt::FieldMask
23706    pub fields: std::vec::Vec<std::string::String>,
23707
23708    /// Optional. Brief description of the parameter.
23709    /// Must not exceed 1024 characters.
23710    pub description: std::string::String,
23711
23712    /// Optional. Validation rules to be applied to this parameter's value.
23713    pub validation: std::option::Option<crate::model::ParameterValidation>,
23714
23715    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23716}
23717
23718impl TemplateParameter {
23719    pub fn new() -> Self {
23720        std::default::Default::default()
23721    }
23722
23723    /// Sets the value of [name][crate::model::TemplateParameter::name].
23724    ///
23725    /// # Example
23726    /// ```ignore,no_run
23727    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23728    /// let x = TemplateParameter::new().set_name("example");
23729    /// ```
23730    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23731        self.name = v.into();
23732        self
23733    }
23734
23735    /// Sets the value of [fields][crate::model::TemplateParameter::fields].
23736    ///
23737    /// # Example
23738    /// ```ignore,no_run
23739    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23740    /// let x = TemplateParameter::new().set_fields(["a", "b", "c"]);
23741    /// ```
23742    pub fn set_fields<T, V>(mut self, v: T) -> Self
23743    where
23744        T: std::iter::IntoIterator<Item = V>,
23745        V: std::convert::Into<std::string::String>,
23746    {
23747        use std::iter::Iterator;
23748        self.fields = v.into_iter().map(|i| i.into()).collect();
23749        self
23750    }
23751
23752    /// Sets the value of [description][crate::model::TemplateParameter::description].
23753    ///
23754    /// # Example
23755    /// ```ignore,no_run
23756    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23757    /// let x = TemplateParameter::new().set_description("example");
23758    /// ```
23759    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23760        self.description = v.into();
23761        self
23762    }
23763
23764    /// Sets the value of [validation][crate::model::TemplateParameter::validation].
23765    ///
23766    /// # Example
23767    /// ```ignore,no_run
23768    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23769    /// use google_cloud_dataproc_v1::model::ParameterValidation;
23770    /// let x = TemplateParameter::new().set_validation(ParameterValidation::default()/* use setters */);
23771    /// ```
23772    pub fn set_validation<T>(mut self, v: T) -> Self
23773    where
23774        T: std::convert::Into<crate::model::ParameterValidation>,
23775    {
23776        self.validation = std::option::Option::Some(v.into());
23777        self
23778    }
23779
23780    /// Sets or clears the value of [validation][crate::model::TemplateParameter::validation].
23781    ///
23782    /// # Example
23783    /// ```ignore,no_run
23784    /// # use google_cloud_dataproc_v1::model::TemplateParameter;
23785    /// use google_cloud_dataproc_v1::model::ParameterValidation;
23786    /// let x = TemplateParameter::new().set_or_clear_validation(Some(ParameterValidation::default()/* use setters */));
23787    /// let x = TemplateParameter::new().set_or_clear_validation(None::<ParameterValidation>);
23788    /// ```
23789    pub fn set_or_clear_validation<T>(mut self, v: std::option::Option<T>) -> Self
23790    where
23791        T: std::convert::Into<crate::model::ParameterValidation>,
23792    {
23793        self.validation = v.map(|x| x.into());
23794        self
23795    }
23796}
23797
23798impl wkt::message::Message for TemplateParameter {
23799    fn typename() -> &'static str {
23800        "type.googleapis.com/google.cloud.dataproc.v1.TemplateParameter"
23801    }
23802}
23803
23804/// Configuration for parameter validation.
23805#[derive(Clone, Default, PartialEq)]
23806#[non_exhaustive]
23807pub struct ParameterValidation {
23808    /// Required. The type of validation to be performed.
23809    pub validation_type: std::option::Option<crate::model::parameter_validation::ValidationType>,
23810
23811    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23812}
23813
23814impl ParameterValidation {
23815    pub fn new() -> Self {
23816        std::default::Default::default()
23817    }
23818
23819    /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type].
23820    ///
23821    /// Note that all the setters affecting `validation_type` are mutually
23822    /// exclusive.
23823    ///
23824    /// # Example
23825    /// ```ignore,no_run
23826    /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23827    /// use google_cloud_dataproc_v1::model::RegexValidation;
23828    /// let x = ParameterValidation::new().set_validation_type(Some(
23829    ///     google_cloud_dataproc_v1::model::parameter_validation::ValidationType::Regex(RegexValidation::default().into())));
23830    /// ```
23831    pub fn set_validation_type<
23832        T: std::convert::Into<std::option::Option<crate::model::parameter_validation::ValidationType>>,
23833    >(
23834        mut self,
23835        v: T,
23836    ) -> Self {
23837        self.validation_type = v.into();
23838        self
23839    }
23840
23841    /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
23842    /// if it holds a `Regex`, `None` if the field is not set or
23843    /// holds a different branch.
23844    pub fn regex(&self) -> std::option::Option<&std::boxed::Box<crate::model::RegexValidation>> {
23845        #[allow(unreachable_patterns)]
23846        self.validation_type.as_ref().and_then(|v| match v {
23847            crate::model::parameter_validation::ValidationType::Regex(v) => {
23848                std::option::Option::Some(v)
23849            }
23850            _ => std::option::Option::None,
23851        })
23852    }
23853
23854    /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
23855    /// to hold a `Regex`.
23856    ///
23857    /// Note that all the setters affecting `validation_type` are
23858    /// mutually exclusive.
23859    ///
23860    /// # Example
23861    /// ```ignore,no_run
23862    /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23863    /// use google_cloud_dataproc_v1::model::RegexValidation;
23864    /// let x = ParameterValidation::new().set_regex(RegexValidation::default()/* use setters */);
23865    /// assert!(x.regex().is_some());
23866    /// assert!(x.values().is_none());
23867    /// ```
23868    pub fn set_regex<T: std::convert::Into<std::boxed::Box<crate::model::RegexValidation>>>(
23869        mut self,
23870        v: T,
23871    ) -> Self {
23872        self.validation_type = std::option::Option::Some(
23873            crate::model::parameter_validation::ValidationType::Regex(v.into()),
23874        );
23875        self
23876    }
23877
23878    /// The value of [validation_type][crate::model::ParameterValidation::validation_type]
23879    /// if it holds a `Values`, `None` if the field is not set or
23880    /// holds a different branch.
23881    pub fn values(&self) -> std::option::Option<&std::boxed::Box<crate::model::ValueValidation>> {
23882        #[allow(unreachable_patterns)]
23883        self.validation_type.as_ref().and_then(|v| match v {
23884            crate::model::parameter_validation::ValidationType::Values(v) => {
23885                std::option::Option::Some(v)
23886            }
23887            _ => std::option::Option::None,
23888        })
23889    }
23890
23891    /// Sets the value of [validation_type][crate::model::ParameterValidation::validation_type]
23892    /// to hold a `Values`.
23893    ///
23894    /// Note that all the setters affecting `validation_type` are
23895    /// mutually exclusive.
23896    ///
23897    /// # Example
23898    /// ```ignore,no_run
23899    /// # use google_cloud_dataproc_v1::model::ParameterValidation;
23900    /// use google_cloud_dataproc_v1::model::ValueValidation;
23901    /// let x = ParameterValidation::new().set_values(ValueValidation::default()/* use setters */);
23902    /// assert!(x.values().is_some());
23903    /// assert!(x.regex().is_none());
23904    /// ```
23905    pub fn set_values<T: std::convert::Into<std::boxed::Box<crate::model::ValueValidation>>>(
23906        mut self,
23907        v: T,
23908    ) -> Self {
23909        self.validation_type = std::option::Option::Some(
23910            crate::model::parameter_validation::ValidationType::Values(v.into()),
23911        );
23912        self
23913    }
23914}
23915
23916impl wkt::message::Message for ParameterValidation {
23917    fn typename() -> &'static str {
23918        "type.googleapis.com/google.cloud.dataproc.v1.ParameterValidation"
23919    }
23920}
23921
23922/// Defines additional types related to [ParameterValidation].
23923pub mod parameter_validation {
23924    #[allow(unused_imports)]
23925    use super::*;
23926
23927    /// Required. The type of validation to be performed.
23928    #[derive(Clone, Debug, PartialEq)]
23929    #[non_exhaustive]
23930    pub enum ValidationType {
23931        /// Validation based on regular expressions.
23932        Regex(std::boxed::Box<crate::model::RegexValidation>),
23933        /// Validation based on a list of allowed values.
23934        Values(std::boxed::Box<crate::model::ValueValidation>),
23935    }
23936}
23937
23938/// Validation based on regular expressions.
23939#[derive(Clone, Default, PartialEq)]
23940#[non_exhaustive]
23941pub struct RegexValidation {
23942    /// Required. RE2 regular expressions used to validate the parameter's value.
23943    /// The value must match the regex in its entirety (substring
23944    /// matches are not sufficient).
23945    pub regexes: std::vec::Vec<std::string::String>,
23946
23947    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23948}
23949
23950impl RegexValidation {
23951    pub fn new() -> Self {
23952        std::default::Default::default()
23953    }
23954
23955    /// Sets the value of [regexes][crate::model::RegexValidation::regexes].
23956    ///
23957    /// # Example
23958    /// ```ignore,no_run
23959    /// # use google_cloud_dataproc_v1::model::RegexValidation;
23960    /// let x = RegexValidation::new().set_regexes(["a", "b", "c"]);
23961    /// ```
23962    pub fn set_regexes<T, V>(mut self, v: T) -> Self
23963    where
23964        T: std::iter::IntoIterator<Item = V>,
23965        V: std::convert::Into<std::string::String>,
23966    {
23967        use std::iter::Iterator;
23968        self.regexes = v.into_iter().map(|i| i.into()).collect();
23969        self
23970    }
23971}
23972
23973impl wkt::message::Message for RegexValidation {
23974    fn typename() -> &'static str {
23975        "type.googleapis.com/google.cloud.dataproc.v1.RegexValidation"
23976    }
23977}
23978
23979/// Validation based on a list of allowed values.
23980#[derive(Clone, Default, PartialEq)]
23981#[non_exhaustive]
23982pub struct ValueValidation {
23983    /// Required. List of allowed values for the parameter.
23984    pub values: std::vec::Vec<std::string::String>,
23985
23986    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23987}
23988
23989impl ValueValidation {
23990    pub fn new() -> Self {
23991        std::default::Default::default()
23992    }
23993
23994    /// Sets the value of [values][crate::model::ValueValidation::values].
23995    ///
23996    /// # Example
23997    /// ```ignore,no_run
23998    /// # use google_cloud_dataproc_v1::model::ValueValidation;
23999    /// let x = ValueValidation::new().set_values(["a", "b", "c"]);
24000    /// ```
24001    pub fn set_values<T, V>(mut self, v: T) -> Self
24002    where
24003        T: std::iter::IntoIterator<Item = V>,
24004        V: std::convert::Into<std::string::String>,
24005    {
24006        use std::iter::Iterator;
24007        self.values = v.into_iter().map(|i| i.into()).collect();
24008        self
24009    }
24010}
24011
24012impl wkt::message::Message for ValueValidation {
24013    fn typename() -> &'static str {
24014        "type.googleapis.com/google.cloud.dataproc.v1.ValueValidation"
24015    }
24016}
24017
24018/// A Dataproc workflow template resource.
24019#[derive(Clone, Default, PartialEq)]
24020#[non_exhaustive]
24021pub struct WorkflowMetadata {
24022    /// Output only. The resource name of the workflow template as described
24023    /// in <https://cloud.google.com/apis/design/resource_names>.
24024    ///
24025    /// * For `projects.regions.workflowTemplates`, the resource name of the
24026    ///   template has the following format:
24027    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
24028    ///
24029    /// * For `projects.locations.workflowTemplates`, the resource name of the
24030    ///   template has the following format:
24031    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
24032    ///
24033    pub template: std::string::String,
24034
24035    /// Output only. The version of template at the time of
24036    /// workflow instantiation.
24037    pub version: i32,
24038
24039    /// Output only. The create cluster operation metadata.
24040    pub create_cluster: std::option::Option<crate::model::ClusterOperation>,
24041
24042    /// Output only. The workflow graph.
24043    pub graph: std::option::Option<crate::model::WorkflowGraph>,
24044
24045    /// Output only. The delete cluster operation metadata.
24046    pub delete_cluster: std::option::Option<crate::model::ClusterOperation>,
24047
24048    /// Output only. The workflow state.
24049    pub state: crate::model::workflow_metadata::State,
24050
24051    /// Output only. The name of the target cluster.
24052    pub cluster_name: std::string::String,
24053
24054    /// Map from parameter names to values that were used for those parameters.
24055    pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
24056
24057    /// Output only. Workflow start time.
24058    pub start_time: std::option::Option<wkt::Timestamp>,
24059
24060    /// Output only. Workflow end time.
24061    pub end_time: std::option::Option<wkt::Timestamp>,
24062
24063    /// Output only. The UUID of target cluster.
24064    pub cluster_uuid: std::string::String,
24065
24066    /// Output only. The timeout duration for the DAG of jobs, expressed in seconds
24067    /// (see [JSON representation of
24068    /// duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
24069    pub dag_timeout: std::option::Option<wkt::Duration>,
24070
24071    /// Output only. DAG start time, only set for workflows with
24072    /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
24073    /// DAG begins.
24074    ///
24075    /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
24076    pub dag_start_time: std::option::Option<wkt::Timestamp>,
24077
24078    /// Output only. DAG end time, only set for workflows with
24079    /// [dag_timeout][google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout] when
24080    /// DAG ends.
24081    ///
24082    /// [google.cloud.dataproc.v1.WorkflowMetadata.dag_timeout]: crate::model::WorkflowMetadata::dag_timeout
24083    pub dag_end_time: std::option::Option<wkt::Timestamp>,
24084
24085    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24086}
24087
24088impl WorkflowMetadata {
24089    pub fn new() -> Self {
24090        std::default::Default::default()
24091    }
24092
24093    /// Sets the value of [template][crate::model::WorkflowMetadata::template].
24094    ///
24095    /// # Example
24096    /// ```ignore,no_run
24097    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24098    /// let x = WorkflowMetadata::new().set_template("example");
24099    /// ```
24100    pub fn set_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24101        self.template = v.into();
24102        self
24103    }
24104
24105    /// Sets the value of [version][crate::model::WorkflowMetadata::version].
24106    ///
24107    /// # Example
24108    /// ```ignore,no_run
24109    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24110    /// let x = WorkflowMetadata::new().set_version(42);
24111    /// ```
24112    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24113        self.version = v.into();
24114        self
24115    }
24116
24117    /// Sets the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
24118    ///
24119    /// # Example
24120    /// ```ignore,no_run
24121    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24122    /// use google_cloud_dataproc_v1::model::ClusterOperation;
24123    /// let x = WorkflowMetadata::new().set_create_cluster(ClusterOperation::default()/* use setters */);
24124    /// ```
24125    pub fn set_create_cluster<T>(mut self, v: T) -> Self
24126    where
24127        T: std::convert::Into<crate::model::ClusterOperation>,
24128    {
24129        self.create_cluster = std::option::Option::Some(v.into());
24130        self
24131    }
24132
24133    /// Sets or clears the value of [create_cluster][crate::model::WorkflowMetadata::create_cluster].
24134    ///
24135    /// # Example
24136    /// ```ignore,no_run
24137    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24138    /// use google_cloud_dataproc_v1::model::ClusterOperation;
24139    /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(Some(ClusterOperation::default()/* use setters */));
24140    /// let x = WorkflowMetadata::new().set_or_clear_create_cluster(None::<ClusterOperation>);
24141    /// ```
24142    pub fn set_or_clear_create_cluster<T>(mut self, v: std::option::Option<T>) -> Self
24143    where
24144        T: std::convert::Into<crate::model::ClusterOperation>,
24145    {
24146        self.create_cluster = v.map(|x| x.into());
24147        self
24148    }
24149
24150    /// Sets the value of [graph][crate::model::WorkflowMetadata::graph].
24151    ///
24152    /// # Example
24153    /// ```ignore,no_run
24154    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24155    /// use google_cloud_dataproc_v1::model::WorkflowGraph;
24156    /// let x = WorkflowMetadata::new().set_graph(WorkflowGraph::default()/* use setters */);
24157    /// ```
24158    pub fn set_graph<T>(mut self, v: T) -> Self
24159    where
24160        T: std::convert::Into<crate::model::WorkflowGraph>,
24161    {
24162        self.graph = std::option::Option::Some(v.into());
24163        self
24164    }
24165
24166    /// Sets or clears the value of [graph][crate::model::WorkflowMetadata::graph].
24167    ///
24168    /// # Example
24169    /// ```ignore,no_run
24170    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24171    /// use google_cloud_dataproc_v1::model::WorkflowGraph;
24172    /// let x = WorkflowMetadata::new().set_or_clear_graph(Some(WorkflowGraph::default()/* use setters */));
24173    /// let x = WorkflowMetadata::new().set_or_clear_graph(None::<WorkflowGraph>);
24174    /// ```
24175    pub fn set_or_clear_graph<T>(mut self, v: std::option::Option<T>) -> Self
24176    where
24177        T: std::convert::Into<crate::model::WorkflowGraph>,
24178    {
24179        self.graph = v.map(|x| x.into());
24180        self
24181    }
24182
24183    /// Sets the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
24184    ///
24185    /// # Example
24186    /// ```ignore,no_run
24187    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24188    /// use google_cloud_dataproc_v1::model::ClusterOperation;
24189    /// let x = WorkflowMetadata::new().set_delete_cluster(ClusterOperation::default()/* use setters */);
24190    /// ```
24191    pub fn set_delete_cluster<T>(mut self, v: T) -> Self
24192    where
24193        T: std::convert::Into<crate::model::ClusterOperation>,
24194    {
24195        self.delete_cluster = std::option::Option::Some(v.into());
24196        self
24197    }
24198
24199    /// Sets or clears the value of [delete_cluster][crate::model::WorkflowMetadata::delete_cluster].
24200    ///
24201    /// # Example
24202    /// ```ignore,no_run
24203    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24204    /// use google_cloud_dataproc_v1::model::ClusterOperation;
24205    /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(Some(ClusterOperation::default()/* use setters */));
24206    /// let x = WorkflowMetadata::new().set_or_clear_delete_cluster(None::<ClusterOperation>);
24207    /// ```
24208    pub fn set_or_clear_delete_cluster<T>(mut self, v: std::option::Option<T>) -> Self
24209    where
24210        T: std::convert::Into<crate::model::ClusterOperation>,
24211    {
24212        self.delete_cluster = v.map(|x| x.into());
24213        self
24214    }
24215
24216    /// Sets the value of [state][crate::model::WorkflowMetadata::state].
24217    ///
24218    /// # Example
24219    /// ```ignore,no_run
24220    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24221    /// use google_cloud_dataproc_v1::model::workflow_metadata::State;
24222    /// let x0 = WorkflowMetadata::new().set_state(State::Pending);
24223    /// let x1 = WorkflowMetadata::new().set_state(State::Running);
24224    /// let x2 = WorkflowMetadata::new().set_state(State::Done);
24225    /// ```
24226    pub fn set_state<T: std::convert::Into<crate::model::workflow_metadata::State>>(
24227        mut self,
24228        v: T,
24229    ) -> Self {
24230        self.state = v.into();
24231        self
24232    }
24233
24234    /// Sets the value of [cluster_name][crate::model::WorkflowMetadata::cluster_name].
24235    ///
24236    /// # Example
24237    /// ```ignore,no_run
24238    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24239    /// let x = WorkflowMetadata::new().set_cluster_name("example");
24240    /// ```
24241    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24242        self.cluster_name = v.into();
24243        self
24244    }
24245
24246    /// Sets the value of [parameters][crate::model::WorkflowMetadata::parameters].
24247    ///
24248    /// # Example
24249    /// ```ignore,no_run
24250    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24251    /// let x = WorkflowMetadata::new().set_parameters([
24252    ///     ("key0", "abc"),
24253    ///     ("key1", "xyz"),
24254    /// ]);
24255    /// ```
24256    pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
24257    where
24258        T: std::iter::IntoIterator<Item = (K, V)>,
24259        K: std::convert::Into<std::string::String>,
24260        V: std::convert::Into<std::string::String>,
24261    {
24262        use std::iter::Iterator;
24263        self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24264        self
24265    }
24266
24267    /// Sets the value of [start_time][crate::model::WorkflowMetadata::start_time].
24268    ///
24269    /// # Example
24270    /// ```ignore,no_run
24271    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24272    /// use wkt::Timestamp;
24273    /// let x = WorkflowMetadata::new().set_start_time(Timestamp::default()/* use setters */);
24274    /// ```
24275    pub fn set_start_time<T>(mut self, v: T) -> Self
24276    where
24277        T: std::convert::Into<wkt::Timestamp>,
24278    {
24279        self.start_time = std::option::Option::Some(v.into());
24280        self
24281    }
24282
24283    /// Sets or clears the value of [start_time][crate::model::WorkflowMetadata::start_time].
24284    ///
24285    /// # Example
24286    /// ```ignore,no_run
24287    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24288    /// use wkt::Timestamp;
24289    /// let x = WorkflowMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
24290    /// let x = WorkflowMetadata::new().set_or_clear_start_time(None::<Timestamp>);
24291    /// ```
24292    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
24293    where
24294        T: std::convert::Into<wkt::Timestamp>,
24295    {
24296        self.start_time = v.map(|x| x.into());
24297        self
24298    }
24299
24300    /// Sets the value of [end_time][crate::model::WorkflowMetadata::end_time].
24301    ///
24302    /// # Example
24303    /// ```ignore,no_run
24304    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24305    /// use wkt::Timestamp;
24306    /// let x = WorkflowMetadata::new().set_end_time(Timestamp::default()/* use setters */);
24307    /// ```
24308    pub fn set_end_time<T>(mut self, v: T) -> Self
24309    where
24310        T: std::convert::Into<wkt::Timestamp>,
24311    {
24312        self.end_time = std::option::Option::Some(v.into());
24313        self
24314    }
24315
24316    /// Sets or clears the value of [end_time][crate::model::WorkflowMetadata::end_time].
24317    ///
24318    /// # Example
24319    /// ```ignore,no_run
24320    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24321    /// use wkt::Timestamp;
24322    /// let x = WorkflowMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
24323    /// let x = WorkflowMetadata::new().set_or_clear_end_time(None::<Timestamp>);
24324    /// ```
24325    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24326    where
24327        T: std::convert::Into<wkt::Timestamp>,
24328    {
24329        self.end_time = v.map(|x| x.into());
24330        self
24331    }
24332
24333    /// Sets the value of [cluster_uuid][crate::model::WorkflowMetadata::cluster_uuid].
24334    ///
24335    /// # Example
24336    /// ```ignore,no_run
24337    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24338    /// let x = WorkflowMetadata::new().set_cluster_uuid("example");
24339    /// ```
24340    pub fn set_cluster_uuid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24341        self.cluster_uuid = v.into();
24342        self
24343    }
24344
24345    /// Sets the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24346    ///
24347    /// # Example
24348    /// ```ignore,no_run
24349    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24350    /// use wkt::Duration;
24351    /// let x = WorkflowMetadata::new().set_dag_timeout(Duration::default()/* use setters */);
24352    /// ```
24353    pub fn set_dag_timeout<T>(mut self, v: T) -> Self
24354    where
24355        T: std::convert::Into<wkt::Duration>,
24356    {
24357        self.dag_timeout = std::option::Option::Some(v.into());
24358        self
24359    }
24360
24361    /// Sets or clears the value of [dag_timeout][crate::model::WorkflowMetadata::dag_timeout].
24362    ///
24363    /// # Example
24364    /// ```ignore,no_run
24365    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24366    /// use wkt::Duration;
24367    /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(Some(Duration::default()/* use setters */));
24368    /// let x = WorkflowMetadata::new().set_or_clear_dag_timeout(None::<Duration>);
24369    /// ```
24370    pub fn set_or_clear_dag_timeout<T>(mut self, v: std::option::Option<T>) -> Self
24371    where
24372        T: std::convert::Into<wkt::Duration>,
24373    {
24374        self.dag_timeout = v.map(|x| x.into());
24375        self
24376    }
24377
24378    /// Sets the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24379    ///
24380    /// # Example
24381    /// ```ignore,no_run
24382    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24383    /// use wkt::Timestamp;
24384    /// let x = WorkflowMetadata::new().set_dag_start_time(Timestamp::default()/* use setters */);
24385    /// ```
24386    pub fn set_dag_start_time<T>(mut self, v: T) -> Self
24387    where
24388        T: std::convert::Into<wkt::Timestamp>,
24389    {
24390        self.dag_start_time = std::option::Option::Some(v.into());
24391        self
24392    }
24393
24394    /// Sets or clears the value of [dag_start_time][crate::model::WorkflowMetadata::dag_start_time].
24395    ///
24396    /// # Example
24397    /// ```ignore,no_run
24398    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24399    /// use wkt::Timestamp;
24400    /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(Some(Timestamp::default()/* use setters */));
24401    /// let x = WorkflowMetadata::new().set_or_clear_dag_start_time(None::<Timestamp>);
24402    /// ```
24403    pub fn set_or_clear_dag_start_time<T>(mut self, v: std::option::Option<T>) -> Self
24404    where
24405        T: std::convert::Into<wkt::Timestamp>,
24406    {
24407        self.dag_start_time = v.map(|x| x.into());
24408        self
24409    }
24410
24411    /// Sets the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24412    ///
24413    /// # Example
24414    /// ```ignore,no_run
24415    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24416    /// use wkt::Timestamp;
24417    /// let x = WorkflowMetadata::new().set_dag_end_time(Timestamp::default()/* use setters */);
24418    /// ```
24419    pub fn set_dag_end_time<T>(mut self, v: T) -> Self
24420    where
24421        T: std::convert::Into<wkt::Timestamp>,
24422    {
24423        self.dag_end_time = std::option::Option::Some(v.into());
24424        self
24425    }
24426
24427    /// Sets or clears the value of [dag_end_time][crate::model::WorkflowMetadata::dag_end_time].
24428    ///
24429    /// # Example
24430    /// ```ignore,no_run
24431    /// # use google_cloud_dataproc_v1::model::WorkflowMetadata;
24432    /// use wkt::Timestamp;
24433    /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(Some(Timestamp::default()/* use setters */));
24434    /// let x = WorkflowMetadata::new().set_or_clear_dag_end_time(None::<Timestamp>);
24435    /// ```
24436    pub fn set_or_clear_dag_end_time<T>(mut self, v: std::option::Option<T>) -> Self
24437    where
24438        T: std::convert::Into<wkt::Timestamp>,
24439    {
24440        self.dag_end_time = v.map(|x| x.into());
24441        self
24442    }
24443}
24444
24445impl wkt::message::Message for WorkflowMetadata {
24446    fn typename() -> &'static str {
24447        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowMetadata"
24448    }
24449}
24450
24451/// Defines additional types related to [WorkflowMetadata].
24452pub mod workflow_metadata {
24453    #[allow(unused_imports)]
24454    use super::*;
24455
24456    /// The operation state.
24457    ///
24458    /// # Working with unknown values
24459    ///
24460    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24461    /// additional enum variants at any time. Adding new variants is not considered
24462    /// a breaking change. Applications should write their code in anticipation of:
24463    ///
24464    /// - New values appearing in future releases of the client library, **and**
24465    /// - New values received dynamically, without application changes.
24466    ///
24467    /// Please consult the [Working with enums] section in the user guide for some
24468    /// guidelines.
24469    ///
24470    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24471    #[derive(Clone, Debug, PartialEq)]
24472    #[non_exhaustive]
24473    pub enum State {
24474        /// Unused.
24475        Unknown,
24476        /// The operation has been created.
24477        Pending,
24478        /// The operation is running.
24479        Running,
24480        /// The operation is done; either cancelled or completed.
24481        Done,
24482        /// If set, the enum was initialized with an unknown value.
24483        ///
24484        /// Applications can examine the value using [State::value] or
24485        /// [State::name].
24486        UnknownValue(state::UnknownValue),
24487    }
24488
24489    #[doc(hidden)]
24490    pub mod state {
24491        #[allow(unused_imports)]
24492        use super::*;
24493        #[derive(Clone, Debug, PartialEq)]
24494        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24495    }
24496
24497    impl State {
24498        /// Gets the enum value.
24499        ///
24500        /// Returns `None` if the enum contains an unknown value deserialized from
24501        /// the string representation of enums.
24502        pub fn value(&self) -> std::option::Option<i32> {
24503            match self {
24504                Self::Unknown => std::option::Option::Some(0),
24505                Self::Pending => std::option::Option::Some(1),
24506                Self::Running => std::option::Option::Some(2),
24507                Self::Done => std::option::Option::Some(3),
24508                Self::UnknownValue(u) => u.0.value(),
24509            }
24510        }
24511
24512        /// Gets the enum value as a string.
24513        ///
24514        /// Returns `None` if the enum contains an unknown value deserialized from
24515        /// the integer representation of enums.
24516        pub fn name(&self) -> std::option::Option<&str> {
24517            match self {
24518                Self::Unknown => std::option::Option::Some("UNKNOWN"),
24519                Self::Pending => std::option::Option::Some("PENDING"),
24520                Self::Running => std::option::Option::Some("RUNNING"),
24521                Self::Done => std::option::Option::Some("DONE"),
24522                Self::UnknownValue(u) => u.0.name(),
24523            }
24524        }
24525    }
24526
24527    impl std::default::Default for State {
24528        fn default() -> Self {
24529            use std::convert::From;
24530            Self::from(0)
24531        }
24532    }
24533
24534    impl std::fmt::Display for State {
24535        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24536            wkt::internal::display_enum(f, self.name(), self.value())
24537        }
24538    }
24539
24540    impl std::convert::From<i32> for State {
24541        fn from(value: i32) -> Self {
24542            match value {
24543                0 => Self::Unknown,
24544                1 => Self::Pending,
24545                2 => Self::Running,
24546                3 => Self::Done,
24547                _ => Self::UnknownValue(state::UnknownValue(
24548                    wkt::internal::UnknownEnumValue::Integer(value),
24549                )),
24550            }
24551        }
24552    }
24553
24554    impl std::convert::From<&str> for State {
24555        fn from(value: &str) -> Self {
24556            use std::string::ToString;
24557            match value {
24558                "UNKNOWN" => Self::Unknown,
24559                "PENDING" => Self::Pending,
24560                "RUNNING" => Self::Running,
24561                "DONE" => Self::Done,
24562                _ => Self::UnknownValue(state::UnknownValue(
24563                    wkt::internal::UnknownEnumValue::String(value.to_string()),
24564                )),
24565            }
24566        }
24567    }
24568
24569    impl serde::ser::Serialize for State {
24570        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24571        where
24572            S: serde::Serializer,
24573        {
24574            match self {
24575                Self::Unknown => serializer.serialize_i32(0),
24576                Self::Pending => serializer.serialize_i32(1),
24577                Self::Running => serializer.serialize_i32(2),
24578                Self::Done => serializer.serialize_i32(3),
24579                Self::UnknownValue(u) => u.0.serialize(serializer),
24580            }
24581        }
24582    }
24583
24584    impl<'de> serde::de::Deserialize<'de> for State {
24585        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24586        where
24587            D: serde::Deserializer<'de>,
24588        {
24589            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
24590                ".google.cloud.dataproc.v1.WorkflowMetadata.State",
24591            ))
24592        }
24593    }
24594}
24595
24596/// The cluster operation triggered by a workflow.
24597#[derive(Clone, Default, PartialEq)]
24598#[non_exhaustive]
24599pub struct ClusterOperation {
24600    /// Output only. The id of the cluster operation.
24601    pub operation_id: std::string::String,
24602
24603    /// Output only. Error, if operation failed.
24604    pub error: std::string::String,
24605
24606    /// Output only. Indicates the operation is done.
24607    pub done: bool,
24608
24609    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24610}
24611
24612impl ClusterOperation {
24613    pub fn new() -> Self {
24614        std::default::Default::default()
24615    }
24616
24617    /// Sets the value of [operation_id][crate::model::ClusterOperation::operation_id].
24618    ///
24619    /// # Example
24620    /// ```ignore,no_run
24621    /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24622    /// let x = ClusterOperation::new().set_operation_id("example");
24623    /// ```
24624    pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24625        self.operation_id = v.into();
24626        self
24627    }
24628
24629    /// Sets the value of [error][crate::model::ClusterOperation::error].
24630    ///
24631    /// # Example
24632    /// ```ignore,no_run
24633    /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24634    /// let x = ClusterOperation::new().set_error("example");
24635    /// ```
24636    pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24637        self.error = v.into();
24638        self
24639    }
24640
24641    /// Sets the value of [done][crate::model::ClusterOperation::done].
24642    ///
24643    /// # Example
24644    /// ```ignore,no_run
24645    /// # use google_cloud_dataproc_v1::model::ClusterOperation;
24646    /// let x = ClusterOperation::new().set_done(true);
24647    /// ```
24648    pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24649        self.done = v.into();
24650        self
24651    }
24652}
24653
24654impl wkt::message::Message for ClusterOperation {
24655    fn typename() -> &'static str {
24656        "type.googleapis.com/google.cloud.dataproc.v1.ClusterOperation"
24657    }
24658}
24659
24660/// The workflow graph.
24661#[derive(Clone, Default, PartialEq)]
24662#[non_exhaustive]
24663pub struct WorkflowGraph {
24664    /// Output only. The workflow nodes.
24665    pub nodes: std::vec::Vec<crate::model::WorkflowNode>,
24666
24667    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24668}
24669
24670impl WorkflowGraph {
24671    pub fn new() -> Self {
24672        std::default::Default::default()
24673    }
24674
24675    /// Sets the value of [nodes][crate::model::WorkflowGraph::nodes].
24676    ///
24677    /// # Example
24678    /// ```ignore,no_run
24679    /// # use google_cloud_dataproc_v1::model::WorkflowGraph;
24680    /// use google_cloud_dataproc_v1::model::WorkflowNode;
24681    /// let x = WorkflowGraph::new()
24682    ///     .set_nodes([
24683    ///         WorkflowNode::default()/* use setters */,
24684    ///         WorkflowNode::default()/* use (different) setters */,
24685    ///     ]);
24686    /// ```
24687    pub fn set_nodes<T, V>(mut self, v: T) -> Self
24688    where
24689        T: std::iter::IntoIterator<Item = V>,
24690        V: std::convert::Into<crate::model::WorkflowNode>,
24691    {
24692        use std::iter::Iterator;
24693        self.nodes = v.into_iter().map(|i| i.into()).collect();
24694        self
24695    }
24696}
24697
24698impl wkt::message::Message for WorkflowGraph {
24699    fn typename() -> &'static str {
24700        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowGraph"
24701    }
24702}
24703
24704/// The workflow node.
24705#[derive(Clone, Default, PartialEq)]
24706#[non_exhaustive]
24707pub struct WorkflowNode {
24708    /// Output only. The name of the node.
24709    pub step_id: std::string::String,
24710
24711    /// Output only. Node's prerequisite nodes.
24712    pub prerequisite_step_ids: std::vec::Vec<std::string::String>,
24713
24714    /// Output only. The job id; populated after the node enters RUNNING state.
24715    pub job_id: std::string::String,
24716
24717    /// Output only. The node state.
24718    pub state: crate::model::workflow_node::NodeState,
24719
24720    /// Output only. The error detail.
24721    pub error: std::string::String,
24722
24723    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24724}
24725
24726impl WorkflowNode {
24727    pub fn new() -> Self {
24728        std::default::Default::default()
24729    }
24730
24731    /// Sets the value of [step_id][crate::model::WorkflowNode::step_id].
24732    ///
24733    /// # Example
24734    /// ```ignore,no_run
24735    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24736    /// let x = WorkflowNode::new().set_step_id("example");
24737    /// ```
24738    pub fn set_step_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24739        self.step_id = v.into();
24740        self
24741    }
24742
24743    /// Sets the value of [prerequisite_step_ids][crate::model::WorkflowNode::prerequisite_step_ids].
24744    ///
24745    /// # Example
24746    /// ```ignore,no_run
24747    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24748    /// let x = WorkflowNode::new().set_prerequisite_step_ids(["a", "b", "c"]);
24749    /// ```
24750    pub fn set_prerequisite_step_ids<T, V>(mut self, v: T) -> Self
24751    where
24752        T: std::iter::IntoIterator<Item = V>,
24753        V: std::convert::Into<std::string::String>,
24754    {
24755        use std::iter::Iterator;
24756        self.prerequisite_step_ids = v.into_iter().map(|i| i.into()).collect();
24757        self
24758    }
24759
24760    /// Sets the value of [job_id][crate::model::WorkflowNode::job_id].
24761    ///
24762    /// # Example
24763    /// ```ignore,no_run
24764    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24765    /// let x = WorkflowNode::new().set_job_id("example");
24766    /// ```
24767    pub fn set_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24768        self.job_id = v.into();
24769        self
24770    }
24771
24772    /// Sets the value of [state][crate::model::WorkflowNode::state].
24773    ///
24774    /// # Example
24775    /// ```ignore,no_run
24776    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24777    /// use google_cloud_dataproc_v1::model::workflow_node::NodeState;
24778    /// let x0 = WorkflowNode::new().set_state(NodeState::Blocked);
24779    /// let x1 = WorkflowNode::new().set_state(NodeState::Runnable);
24780    /// let x2 = WorkflowNode::new().set_state(NodeState::Running);
24781    /// ```
24782    pub fn set_state<T: std::convert::Into<crate::model::workflow_node::NodeState>>(
24783        mut self,
24784        v: T,
24785    ) -> Self {
24786        self.state = v.into();
24787        self
24788    }
24789
24790    /// Sets the value of [error][crate::model::WorkflowNode::error].
24791    ///
24792    /// # Example
24793    /// ```ignore,no_run
24794    /// # use google_cloud_dataproc_v1::model::WorkflowNode;
24795    /// let x = WorkflowNode::new().set_error("example");
24796    /// ```
24797    pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24798        self.error = v.into();
24799        self
24800    }
24801}
24802
24803impl wkt::message::Message for WorkflowNode {
24804    fn typename() -> &'static str {
24805        "type.googleapis.com/google.cloud.dataproc.v1.WorkflowNode"
24806    }
24807}
24808
24809/// Defines additional types related to [WorkflowNode].
24810pub mod workflow_node {
24811    #[allow(unused_imports)]
24812    use super::*;
24813
24814    /// The workflow node state.
24815    ///
24816    /// # Working with unknown values
24817    ///
24818    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24819    /// additional enum variants at any time. Adding new variants is not considered
24820    /// a breaking change. Applications should write their code in anticipation of:
24821    ///
24822    /// - New values appearing in future releases of the client library, **and**
24823    /// - New values received dynamically, without application changes.
24824    ///
24825    /// Please consult the [Working with enums] section in the user guide for some
24826    /// guidelines.
24827    ///
24828    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24829    #[derive(Clone, Debug, PartialEq)]
24830    #[non_exhaustive]
24831    pub enum NodeState {
24832        /// State is unspecified.
24833        Unspecified,
24834        /// The node is awaiting prerequisite node to finish.
24835        Blocked,
24836        /// The node is runnable but not running.
24837        Runnable,
24838        /// The node is running.
24839        Running,
24840        /// The node completed successfully.
24841        Completed,
24842        /// The node failed. A node can be marked FAILED because
24843        /// its ancestor or peer failed.
24844        Failed,
24845        /// If set, the enum was initialized with an unknown value.
24846        ///
24847        /// Applications can examine the value using [NodeState::value] or
24848        /// [NodeState::name].
24849        UnknownValue(node_state::UnknownValue),
24850    }
24851
24852    #[doc(hidden)]
24853    pub mod node_state {
24854        #[allow(unused_imports)]
24855        use super::*;
24856        #[derive(Clone, Debug, PartialEq)]
24857        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24858    }
24859
24860    impl NodeState {
24861        /// Gets the enum value.
24862        ///
24863        /// Returns `None` if the enum contains an unknown value deserialized from
24864        /// the string representation of enums.
24865        pub fn value(&self) -> std::option::Option<i32> {
24866            match self {
24867                Self::Unspecified => std::option::Option::Some(0),
24868                Self::Blocked => std::option::Option::Some(1),
24869                Self::Runnable => std::option::Option::Some(2),
24870                Self::Running => std::option::Option::Some(3),
24871                Self::Completed => std::option::Option::Some(4),
24872                Self::Failed => std::option::Option::Some(5),
24873                Self::UnknownValue(u) => u.0.value(),
24874            }
24875        }
24876
24877        /// Gets the enum value as a string.
24878        ///
24879        /// Returns `None` if the enum contains an unknown value deserialized from
24880        /// the integer representation of enums.
24881        pub fn name(&self) -> std::option::Option<&str> {
24882            match self {
24883                Self::Unspecified => std::option::Option::Some("NODE_STATE_UNSPECIFIED"),
24884                Self::Blocked => std::option::Option::Some("BLOCKED"),
24885                Self::Runnable => std::option::Option::Some("RUNNABLE"),
24886                Self::Running => std::option::Option::Some("RUNNING"),
24887                Self::Completed => std::option::Option::Some("COMPLETED"),
24888                Self::Failed => std::option::Option::Some("FAILED"),
24889                Self::UnknownValue(u) => u.0.name(),
24890            }
24891        }
24892    }
24893
24894    impl std::default::Default for NodeState {
24895        fn default() -> Self {
24896            use std::convert::From;
24897            Self::from(0)
24898        }
24899    }
24900
24901    impl std::fmt::Display for NodeState {
24902        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24903            wkt::internal::display_enum(f, self.name(), self.value())
24904        }
24905    }
24906
24907    impl std::convert::From<i32> for NodeState {
24908        fn from(value: i32) -> Self {
24909            match value {
24910                0 => Self::Unspecified,
24911                1 => Self::Blocked,
24912                2 => Self::Runnable,
24913                3 => Self::Running,
24914                4 => Self::Completed,
24915                5 => Self::Failed,
24916                _ => Self::UnknownValue(node_state::UnknownValue(
24917                    wkt::internal::UnknownEnumValue::Integer(value),
24918                )),
24919            }
24920        }
24921    }
24922
24923    impl std::convert::From<&str> for NodeState {
24924        fn from(value: &str) -> Self {
24925            use std::string::ToString;
24926            match value {
24927                "NODE_STATE_UNSPECIFIED" => Self::Unspecified,
24928                "BLOCKED" => Self::Blocked,
24929                "RUNNABLE" => Self::Runnable,
24930                "RUNNING" => Self::Running,
24931                "COMPLETED" => Self::Completed,
24932                "FAILED" => Self::Failed,
24933                _ => Self::UnknownValue(node_state::UnknownValue(
24934                    wkt::internal::UnknownEnumValue::String(value.to_string()),
24935                )),
24936            }
24937        }
24938    }
24939
24940    impl serde::ser::Serialize for NodeState {
24941        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24942        where
24943            S: serde::Serializer,
24944        {
24945            match self {
24946                Self::Unspecified => serializer.serialize_i32(0),
24947                Self::Blocked => serializer.serialize_i32(1),
24948                Self::Runnable => serializer.serialize_i32(2),
24949                Self::Running => serializer.serialize_i32(3),
24950                Self::Completed => serializer.serialize_i32(4),
24951                Self::Failed => serializer.serialize_i32(5),
24952                Self::UnknownValue(u) => u.0.serialize(serializer),
24953            }
24954        }
24955    }
24956
24957    impl<'de> serde::de::Deserialize<'de> for NodeState {
24958        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24959        where
24960            D: serde::Deserializer<'de>,
24961        {
24962            deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeState>::new(
24963                ".google.cloud.dataproc.v1.WorkflowNode.NodeState",
24964            ))
24965        }
24966    }
24967}
24968
24969/// A request to create a workflow template.
24970#[derive(Clone, Default, PartialEq)]
24971#[non_exhaustive]
24972pub struct CreateWorkflowTemplateRequest {
24973    /// Required. The resource name of the region or location, as described
24974    /// in <https://cloud.google.com/apis/design/resource_names>.
24975    ///
24976    /// * For `projects.regions.workflowTemplates.create`, the resource name of the
24977    ///   region has the following format:
24978    ///   `projects/{project_id}/regions/{region}`
24979    ///
24980    /// * For `projects.locations.workflowTemplates.create`, the resource name of
24981    ///   the location has the following format:
24982    ///   `projects/{project_id}/locations/{location}`
24983    ///
24984    pub parent: std::string::String,
24985
24986    /// Required. The Dataproc workflow template to create.
24987    pub template: std::option::Option<crate::model::WorkflowTemplate>,
24988
24989    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24990}
24991
24992impl CreateWorkflowTemplateRequest {
24993    pub fn new() -> Self {
24994        std::default::Default::default()
24995    }
24996
24997    /// Sets the value of [parent][crate::model::CreateWorkflowTemplateRequest::parent].
24998    ///
24999    /// # Example
25000    /// ```ignore,no_run
25001    /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25002    /// let x = CreateWorkflowTemplateRequest::new().set_parent("example");
25003    /// ```
25004    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25005        self.parent = v.into();
25006        self
25007    }
25008
25009    /// Sets the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
25010    ///
25011    /// # Example
25012    /// ```ignore,no_run
25013    /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25014    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25015    /// let x = CreateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25016    /// ```
25017    pub fn set_template<T>(mut self, v: T) -> Self
25018    where
25019        T: std::convert::Into<crate::model::WorkflowTemplate>,
25020    {
25021        self.template = std::option::Option::Some(v.into());
25022        self
25023    }
25024
25025    /// Sets or clears the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
25026    ///
25027    /// # Example
25028    /// ```ignore,no_run
25029    /// # use google_cloud_dataproc_v1::model::CreateWorkflowTemplateRequest;
25030    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25031    /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25032    /// let x = CreateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25033    /// ```
25034    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25035    where
25036        T: std::convert::Into<crate::model::WorkflowTemplate>,
25037    {
25038        self.template = v.map(|x| x.into());
25039        self
25040    }
25041}
25042
25043impl wkt::message::Message for CreateWorkflowTemplateRequest {
25044    fn typename() -> &'static str {
25045        "type.googleapis.com/google.cloud.dataproc.v1.CreateWorkflowTemplateRequest"
25046    }
25047}
25048
25049/// A request to fetch a workflow template.
25050#[derive(Clone, Default, PartialEq)]
25051#[non_exhaustive]
25052pub struct GetWorkflowTemplateRequest {
25053    /// Required. The resource name of the workflow template, as described
25054    /// in <https://cloud.google.com/apis/design/resource_names>.
25055    ///
25056    /// * For `projects.regions.workflowTemplates.get`, the resource name of the
25057    ///   template has the following format:
25058    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25059    ///
25060    /// * For `projects.locations.workflowTemplates.get`, the resource name of the
25061    ///   template has the following format:
25062    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25063    ///
25064    pub name: std::string::String,
25065
25066    /// Optional. The version of workflow template to retrieve. Only previously
25067    /// instantiated versions can be retrieved.
25068    ///
25069    /// If unspecified, retrieves the current version.
25070    pub version: i32,
25071
25072    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25073}
25074
25075impl GetWorkflowTemplateRequest {
25076    pub fn new() -> Self {
25077        std::default::Default::default()
25078    }
25079
25080    /// Sets the value of [name][crate::model::GetWorkflowTemplateRequest::name].
25081    ///
25082    /// # Example
25083    /// ```ignore,no_run
25084    /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
25085    /// let x = GetWorkflowTemplateRequest::new().set_name("example");
25086    /// ```
25087    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25088        self.name = v.into();
25089        self
25090    }
25091
25092    /// Sets the value of [version][crate::model::GetWorkflowTemplateRequest::version].
25093    ///
25094    /// # Example
25095    /// ```ignore,no_run
25096    /// # use google_cloud_dataproc_v1::model::GetWorkflowTemplateRequest;
25097    /// let x = GetWorkflowTemplateRequest::new().set_version(42);
25098    /// ```
25099    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25100        self.version = v.into();
25101        self
25102    }
25103}
25104
25105impl wkt::message::Message for GetWorkflowTemplateRequest {
25106    fn typename() -> &'static str {
25107        "type.googleapis.com/google.cloud.dataproc.v1.GetWorkflowTemplateRequest"
25108    }
25109}
25110
25111/// A request to instantiate a workflow template.
25112#[derive(Clone, Default, PartialEq)]
25113#[non_exhaustive]
25114pub struct InstantiateWorkflowTemplateRequest {
25115    /// Required. The resource name of the workflow template, as described
25116    /// in <https://cloud.google.com/apis/design/resource_names>.
25117    ///
25118    /// * For `projects.regions.workflowTemplates.instantiate`, the resource name
25119    ///   of the template has the following format:
25120    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25121    ///
25122    /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
25123    ///   of the template has the following format:
25124    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25125    ///
25126    pub name: std::string::String,
25127
25128    /// Optional. The version of workflow template to instantiate. If specified,
25129    /// the workflow will be instantiated only if the current version of
25130    /// the workflow template has the supplied version.
25131    ///
25132    /// This option cannot be used to instantiate a previous version of
25133    /// workflow template.
25134    pub version: i32,
25135
25136    /// Optional. A tag that prevents multiple concurrent workflow
25137    /// instances with the same tag from running. This mitigates risk of
25138    /// concurrent instances started due to retries.
25139    ///
25140    /// It is recommended to always set this value to a
25141    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
25142    ///
25143    /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
25144    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
25145    pub request_id: std::string::String,
25146
25147    /// Optional. Map from parameter names to values that should be used for those
25148    /// parameters. Values may not exceed 1000 characters.
25149    pub parameters: std::collections::HashMap<std::string::String, std::string::String>,
25150
25151    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25152}
25153
25154impl InstantiateWorkflowTemplateRequest {
25155    pub fn new() -> Self {
25156        std::default::Default::default()
25157    }
25158
25159    /// Sets the value of [name][crate::model::InstantiateWorkflowTemplateRequest::name].
25160    ///
25161    /// # Example
25162    /// ```ignore,no_run
25163    /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25164    /// let x = InstantiateWorkflowTemplateRequest::new().set_name("example");
25165    /// ```
25166    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25167        self.name = v.into();
25168        self
25169    }
25170
25171    /// Sets the value of [version][crate::model::InstantiateWorkflowTemplateRequest::version].
25172    ///
25173    /// # Example
25174    /// ```ignore,no_run
25175    /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25176    /// let x = InstantiateWorkflowTemplateRequest::new().set_version(42);
25177    /// ```
25178    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25179        self.version = v.into();
25180        self
25181    }
25182
25183    /// Sets the value of [request_id][crate::model::InstantiateWorkflowTemplateRequest::request_id].
25184    ///
25185    /// # Example
25186    /// ```ignore,no_run
25187    /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25188    /// let x = InstantiateWorkflowTemplateRequest::new().set_request_id("example");
25189    /// ```
25190    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25191        self.request_id = v.into();
25192        self
25193    }
25194
25195    /// Sets the value of [parameters][crate::model::InstantiateWorkflowTemplateRequest::parameters].
25196    ///
25197    /// # Example
25198    /// ```ignore,no_run
25199    /// # use google_cloud_dataproc_v1::model::InstantiateWorkflowTemplateRequest;
25200    /// let x = InstantiateWorkflowTemplateRequest::new().set_parameters([
25201    ///     ("key0", "abc"),
25202    ///     ("key1", "xyz"),
25203    /// ]);
25204    /// ```
25205    pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
25206    where
25207        T: std::iter::IntoIterator<Item = (K, V)>,
25208        K: std::convert::Into<std::string::String>,
25209        V: std::convert::Into<std::string::String>,
25210    {
25211        use std::iter::Iterator;
25212        self.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
25213        self
25214    }
25215}
25216
25217impl wkt::message::Message for InstantiateWorkflowTemplateRequest {
25218    fn typename() -> &'static str {
25219        "type.googleapis.com/google.cloud.dataproc.v1.InstantiateWorkflowTemplateRequest"
25220    }
25221}
25222
25223/// A request to instantiate an inline workflow template.
25224#[derive(Clone, Default, PartialEq)]
25225#[non_exhaustive]
25226pub struct InstantiateInlineWorkflowTemplateRequest {
25227    /// Required. The resource name of the region or location, as described
25228    /// in <https://cloud.google.com/apis/design/resource_names>.
25229    ///
25230    /// * For `projects.regions.workflowTemplates,instantiateinline`, the resource
25231    ///   name of the region has the following format:
25232    ///   `projects/{project_id}/regions/{region}`
25233    ///
25234    /// * For `projects.locations.workflowTemplates.instantiateinline`, the
25235    ///   resource name of the location has the following format:
25236    ///   `projects/{project_id}/locations/{location}`
25237    ///
25238    pub parent: std::string::String,
25239
25240    /// Required. The workflow template to instantiate.
25241    pub template: std::option::Option<crate::model::WorkflowTemplate>,
25242
25243    /// Optional. A tag that prevents multiple concurrent workflow
25244    /// instances with the same tag from running. This mitigates risk of
25245    /// concurrent instances started due to retries.
25246    ///
25247    /// It is recommended to always set this value to a
25248    /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
25249    ///
25250    /// The tag must contain only letters (a-z, A-Z), numbers (0-9),
25251    /// underscores (_), and hyphens (-). The maximum length is 40 characters.
25252    pub request_id: std::string::String,
25253
25254    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25255}
25256
25257impl InstantiateInlineWorkflowTemplateRequest {
25258    pub fn new() -> Self {
25259        std::default::Default::default()
25260    }
25261
25262    /// Sets the value of [parent][crate::model::InstantiateInlineWorkflowTemplateRequest::parent].
25263    ///
25264    /// # Example
25265    /// ```ignore,no_run
25266    /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25267    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_parent("example");
25268    /// ```
25269    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25270        self.parent = v.into();
25271        self
25272    }
25273
25274    /// Sets the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
25275    ///
25276    /// # Example
25277    /// ```ignore,no_run
25278    /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25279    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25280    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25281    /// ```
25282    pub fn set_template<T>(mut self, v: T) -> Self
25283    where
25284        T: std::convert::Into<crate::model::WorkflowTemplate>,
25285    {
25286        self.template = std::option::Option::Some(v.into());
25287        self
25288    }
25289
25290    /// Sets or clears the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
25291    ///
25292    /// # Example
25293    /// ```ignore,no_run
25294    /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25295    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25296    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25297    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25298    /// ```
25299    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25300    where
25301        T: std::convert::Into<crate::model::WorkflowTemplate>,
25302    {
25303        self.template = v.map(|x| x.into());
25304        self
25305    }
25306
25307    /// Sets the value of [request_id][crate::model::InstantiateInlineWorkflowTemplateRequest::request_id].
25308    ///
25309    /// # Example
25310    /// ```ignore,no_run
25311    /// # use google_cloud_dataproc_v1::model::InstantiateInlineWorkflowTemplateRequest;
25312    /// let x = InstantiateInlineWorkflowTemplateRequest::new().set_request_id("example");
25313    /// ```
25314    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25315        self.request_id = v.into();
25316        self
25317    }
25318}
25319
25320impl wkt::message::Message for InstantiateInlineWorkflowTemplateRequest {
25321    fn typename() -> &'static str {
25322        "type.googleapis.com/google.cloud.dataproc.v1.InstantiateInlineWorkflowTemplateRequest"
25323    }
25324}
25325
25326/// A request to update a workflow template.
25327#[derive(Clone, Default, PartialEq)]
25328#[non_exhaustive]
25329pub struct UpdateWorkflowTemplateRequest {
25330    /// Required. The updated workflow template.
25331    ///
25332    /// The `template.version` field must match the current version.
25333    pub template: std::option::Option<crate::model::WorkflowTemplate>,
25334
25335    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25336}
25337
25338impl UpdateWorkflowTemplateRequest {
25339    pub fn new() -> Self {
25340        std::default::Default::default()
25341    }
25342
25343    /// Sets the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25344    ///
25345    /// # Example
25346    /// ```ignore,no_run
25347    /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25348    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25349    /// let x = UpdateWorkflowTemplateRequest::new().set_template(WorkflowTemplate::default()/* use setters */);
25350    /// ```
25351    pub fn set_template<T>(mut self, v: T) -> Self
25352    where
25353        T: std::convert::Into<crate::model::WorkflowTemplate>,
25354    {
25355        self.template = std::option::Option::Some(v.into());
25356        self
25357    }
25358
25359    /// Sets or clears the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
25360    ///
25361    /// # Example
25362    /// ```ignore,no_run
25363    /// # use google_cloud_dataproc_v1::model::UpdateWorkflowTemplateRequest;
25364    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25365    /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(Some(WorkflowTemplate::default()/* use setters */));
25366    /// let x = UpdateWorkflowTemplateRequest::new().set_or_clear_template(None::<WorkflowTemplate>);
25367    /// ```
25368    pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
25369    where
25370        T: std::convert::Into<crate::model::WorkflowTemplate>,
25371    {
25372        self.template = v.map(|x| x.into());
25373        self
25374    }
25375}
25376
25377impl wkt::message::Message for UpdateWorkflowTemplateRequest {
25378    fn typename() -> &'static str {
25379        "type.googleapis.com/google.cloud.dataproc.v1.UpdateWorkflowTemplateRequest"
25380    }
25381}
25382
25383/// A request to list workflow templates in a project.
25384#[derive(Clone, Default, PartialEq)]
25385#[non_exhaustive]
25386pub struct ListWorkflowTemplatesRequest {
25387    /// Required. The resource name of the region or location, as described
25388    /// in <https://cloud.google.com/apis/design/resource_names>.
25389    ///
25390    /// * For `projects.regions.workflowTemplates,list`, the resource
25391    ///   name of the region has the following format:
25392    ///   `projects/{project_id}/regions/{region}`
25393    ///
25394    /// * For `projects.locations.workflowTemplates.list`, the
25395    ///   resource name of the location has the following format:
25396    ///   `projects/{project_id}/locations/{location}`
25397    ///
25398    pub parent: std::string::String,
25399
25400    /// Optional. The maximum number of results to return in each response.
25401    pub page_size: i32,
25402
25403    /// Optional. The page token, returned by a previous call, to request the
25404    /// next page of results.
25405    pub page_token: std::string::String,
25406
25407    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25408}
25409
25410impl ListWorkflowTemplatesRequest {
25411    pub fn new() -> Self {
25412        std::default::Default::default()
25413    }
25414
25415    /// Sets the value of [parent][crate::model::ListWorkflowTemplatesRequest::parent].
25416    ///
25417    /// # Example
25418    /// ```ignore,no_run
25419    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25420    /// let x = ListWorkflowTemplatesRequest::new().set_parent("example");
25421    /// ```
25422    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25423        self.parent = v.into();
25424        self
25425    }
25426
25427    /// Sets the value of [page_size][crate::model::ListWorkflowTemplatesRequest::page_size].
25428    ///
25429    /// # Example
25430    /// ```ignore,no_run
25431    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25432    /// let x = ListWorkflowTemplatesRequest::new().set_page_size(42);
25433    /// ```
25434    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25435        self.page_size = v.into();
25436        self
25437    }
25438
25439    /// Sets the value of [page_token][crate::model::ListWorkflowTemplatesRequest::page_token].
25440    ///
25441    /// # Example
25442    /// ```ignore,no_run
25443    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesRequest;
25444    /// let x = ListWorkflowTemplatesRequest::new().set_page_token("example");
25445    /// ```
25446    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25447        self.page_token = v.into();
25448        self
25449    }
25450}
25451
25452impl wkt::message::Message for ListWorkflowTemplatesRequest {
25453    fn typename() -> &'static str {
25454        "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesRequest"
25455    }
25456}
25457
25458/// A response to a request to list workflow templates in a project.
25459#[derive(Clone, Default, PartialEq)]
25460#[non_exhaustive]
25461pub struct ListWorkflowTemplatesResponse {
25462    /// Output only. WorkflowTemplates list.
25463    pub templates: std::vec::Vec<crate::model::WorkflowTemplate>,
25464
25465    /// Output only. This token is included in the response if there are more
25466    /// results to fetch. To fetch additional results, provide this value as the
25467    /// page_token in a subsequent \<code\>ListWorkflowTemplatesRequest\</code\>.
25468    pub next_page_token: std::string::String,
25469
25470    /// Output only. List of workflow templates that could not be included in the
25471    /// response. Attempting to get one of these resources may indicate why it was
25472    /// not included in the list response.
25473    pub unreachable: std::vec::Vec<std::string::String>,
25474
25475    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25476}
25477
25478impl ListWorkflowTemplatesResponse {
25479    pub fn new() -> Self {
25480        std::default::Default::default()
25481    }
25482
25483    /// Sets the value of [templates][crate::model::ListWorkflowTemplatesResponse::templates].
25484    ///
25485    /// # Example
25486    /// ```ignore,no_run
25487    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25488    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
25489    /// let x = ListWorkflowTemplatesResponse::new()
25490    ///     .set_templates([
25491    ///         WorkflowTemplate::default()/* use setters */,
25492    ///         WorkflowTemplate::default()/* use (different) setters */,
25493    ///     ]);
25494    /// ```
25495    pub fn set_templates<T, V>(mut self, v: T) -> Self
25496    where
25497        T: std::iter::IntoIterator<Item = V>,
25498        V: std::convert::Into<crate::model::WorkflowTemplate>,
25499    {
25500        use std::iter::Iterator;
25501        self.templates = v.into_iter().map(|i| i.into()).collect();
25502        self
25503    }
25504
25505    /// Sets the value of [next_page_token][crate::model::ListWorkflowTemplatesResponse::next_page_token].
25506    ///
25507    /// # Example
25508    /// ```ignore,no_run
25509    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25510    /// let x = ListWorkflowTemplatesResponse::new().set_next_page_token("example");
25511    /// ```
25512    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25513        self.next_page_token = v.into();
25514        self
25515    }
25516
25517    /// Sets the value of [unreachable][crate::model::ListWorkflowTemplatesResponse::unreachable].
25518    ///
25519    /// # Example
25520    /// ```ignore,no_run
25521    /// # use google_cloud_dataproc_v1::model::ListWorkflowTemplatesResponse;
25522    /// let x = ListWorkflowTemplatesResponse::new().set_unreachable(["a", "b", "c"]);
25523    /// ```
25524    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
25525    where
25526        T: std::iter::IntoIterator<Item = V>,
25527        V: std::convert::Into<std::string::String>,
25528    {
25529        use std::iter::Iterator;
25530        self.unreachable = v.into_iter().map(|i| i.into()).collect();
25531        self
25532    }
25533}
25534
25535impl wkt::message::Message for ListWorkflowTemplatesResponse {
25536    fn typename() -> &'static str {
25537        "type.googleapis.com/google.cloud.dataproc.v1.ListWorkflowTemplatesResponse"
25538    }
25539}
25540
25541#[doc(hidden)]
25542impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkflowTemplatesResponse {
25543    type PageItem = crate::model::WorkflowTemplate;
25544
25545    fn items(self) -> std::vec::Vec<Self::PageItem> {
25546        self.templates
25547    }
25548
25549    fn next_page_token(&self) -> std::string::String {
25550        use std::clone::Clone;
25551        self.next_page_token.clone()
25552    }
25553}
25554
25555/// A request to delete a workflow template.
25556///
25557/// Currently started workflows will remain running.
25558#[derive(Clone, Default, PartialEq)]
25559#[non_exhaustive]
25560pub struct DeleteWorkflowTemplateRequest {
25561    /// Required. The resource name of the workflow template, as described
25562    /// in <https://cloud.google.com/apis/design/resource_names>.
25563    ///
25564    /// * For `projects.regions.workflowTemplates.delete`, the resource name
25565    ///   of the template has the following format:
25566    ///   `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
25567    ///
25568    /// * For `projects.locations.workflowTemplates.instantiate`, the resource name
25569    ///   of the template has the following format:
25570    ///   `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}`
25571    ///
25572    pub name: std::string::String,
25573
25574    /// Optional. The version of workflow template to delete. If specified,
25575    /// will only delete the template if the current server version matches
25576    /// specified version.
25577    pub version: i32,
25578
25579    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25580}
25581
25582impl DeleteWorkflowTemplateRequest {
25583    pub fn new() -> Self {
25584        std::default::Default::default()
25585    }
25586
25587    /// Sets the value of [name][crate::model::DeleteWorkflowTemplateRequest::name].
25588    ///
25589    /// # Example
25590    /// ```ignore,no_run
25591    /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
25592    /// let x = DeleteWorkflowTemplateRequest::new().set_name("example");
25593    /// ```
25594    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25595        self.name = v.into();
25596        self
25597    }
25598
25599    /// Sets the value of [version][crate::model::DeleteWorkflowTemplateRequest::version].
25600    ///
25601    /// # Example
25602    /// ```ignore,no_run
25603    /// # use google_cloud_dataproc_v1::model::DeleteWorkflowTemplateRequest;
25604    /// let x = DeleteWorkflowTemplateRequest::new().set_version(42);
25605    /// ```
25606    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25607        self.version = v.into();
25608        self
25609    }
25610}
25611
25612impl wkt::message::Message for DeleteWorkflowTemplateRequest {
25613    fn typename() -> &'static str {
25614        "type.googleapis.com/google.cloud.dataproc.v1.DeleteWorkflowTemplateRequest"
25615    }
25616}
25617
25618/// Cluster components that can be activated.
25619///
25620/// # Working with unknown values
25621///
25622/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25623/// additional enum variants at any time. Adding new variants is not considered
25624/// a breaking change. Applications should write their code in anticipation of:
25625///
25626/// - New values appearing in future releases of the client library, **and**
25627/// - New values received dynamically, without application changes.
25628///
25629/// Please consult the [Working with enums] section in the user guide for some
25630/// guidelines.
25631///
25632/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25633#[derive(Clone, Debug, PartialEq)]
25634#[non_exhaustive]
25635pub enum Component {
25636    /// Unspecified component. Specifying this will cause Cluster creation to fail.
25637    Unspecified,
25638    /// The Anaconda component is no longer supported or applicable to
25639    /// [supported Dataproc on Compute Engine image versions]
25640    /// (<https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-version-clusters#supported-dataproc-image-versions>).
25641    /// It cannot be activated on clusters created with supported Dataproc on
25642    /// Compute Engine image versions.
25643    Anaconda,
25644    /// Delta Lake.
25645    Delta,
25646    /// Docker
25647    Docker,
25648    /// The Druid query engine. (alpha)
25649    Druid,
25650    /// Flink
25651    Flink,
25652    /// HBase. (beta)
25653    Hbase,
25654    /// The Hive Web HCatalog (the REST service for accessing HCatalog).
25655    HiveWebhcat,
25656    /// Hudi.
25657    Hudi,
25658    /// Iceberg.
25659    Iceberg,
25660    /// The Jupyter Notebook.
25661    Jupyter,
25662    /// The Jupyter Kernel Gateway.
25663    JupyterKernelGateway,
25664    /// The Pig component.
25665    Pig,
25666    /// The Presto query engine.
25667    Presto,
25668    /// The Trino query engine.
25669    Trino,
25670    /// The Ranger service.
25671    Ranger,
25672    /// The Solr service.
25673    Solr,
25674    /// The Zeppelin notebook.
25675    Zeppelin,
25676    /// The Zookeeper service.
25677    Zookeeper,
25678    /// If set, the enum was initialized with an unknown value.
25679    ///
25680    /// Applications can examine the value using [Component::value] or
25681    /// [Component::name].
25682    UnknownValue(component::UnknownValue),
25683}
25684
25685#[doc(hidden)]
25686pub mod component {
25687    #[allow(unused_imports)]
25688    use super::*;
25689    #[derive(Clone, Debug, PartialEq)]
25690    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25691}
25692
25693impl Component {
25694    /// Gets the enum value.
25695    ///
25696    /// Returns `None` if the enum contains an unknown value deserialized from
25697    /// the string representation of enums.
25698    pub fn value(&self) -> std::option::Option<i32> {
25699        match self {
25700            Self::Unspecified => std::option::Option::Some(0),
25701            Self::Anaconda => std::option::Option::Some(5),
25702            Self::Delta => std::option::Option::Some(20),
25703            Self::Docker => std::option::Option::Some(13),
25704            Self::Druid => std::option::Option::Some(9),
25705            Self::Flink => std::option::Option::Some(14),
25706            Self::Hbase => std::option::Option::Some(11),
25707            Self::HiveWebhcat => std::option::Option::Some(3),
25708            Self::Hudi => std::option::Option::Some(18),
25709            Self::Iceberg => std::option::Option::Some(19),
25710            Self::Jupyter => std::option::Option::Some(1),
25711            Self::JupyterKernelGateway => std::option::Option::Some(22),
25712            Self::Pig => std::option::Option::Some(21),
25713            Self::Presto => std::option::Option::Some(6),
25714            Self::Trino => std::option::Option::Some(17),
25715            Self::Ranger => std::option::Option::Some(12),
25716            Self::Solr => std::option::Option::Some(10),
25717            Self::Zeppelin => std::option::Option::Some(4),
25718            Self::Zookeeper => std::option::Option::Some(8),
25719            Self::UnknownValue(u) => u.0.value(),
25720        }
25721    }
25722
25723    /// Gets the enum value as a string.
25724    ///
25725    /// Returns `None` if the enum contains an unknown value deserialized from
25726    /// the integer representation of enums.
25727    pub fn name(&self) -> std::option::Option<&str> {
25728        match self {
25729            Self::Unspecified => std::option::Option::Some("COMPONENT_UNSPECIFIED"),
25730            Self::Anaconda => std::option::Option::Some("ANACONDA"),
25731            Self::Delta => std::option::Option::Some("DELTA"),
25732            Self::Docker => std::option::Option::Some("DOCKER"),
25733            Self::Druid => std::option::Option::Some("DRUID"),
25734            Self::Flink => std::option::Option::Some("FLINK"),
25735            Self::Hbase => std::option::Option::Some("HBASE"),
25736            Self::HiveWebhcat => std::option::Option::Some("HIVE_WEBHCAT"),
25737            Self::Hudi => std::option::Option::Some("HUDI"),
25738            Self::Iceberg => std::option::Option::Some("ICEBERG"),
25739            Self::Jupyter => std::option::Option::Some("JUPYTER"),
25740            Self::JupyterKernelGateway => std::option::Option::Some("JUPYTER_KERNEL_GATEWAY"),
25741            Self::Pig => std::option::Option::Some("PIG"),
25742            Self::Presto => std::option::Option::Some("PRESTO"),
25743            Self::Trino => std::option::Option::Some("TRINO"),
25744            Self::Ranger => std::option::Option::Some("RANGER"),
25745            Self::Solr => std::option::Option::Some("SOLR"),
25746            Self::Zeppelin => std::option::Option::Some("ZEPPELIN"),
25747            Self::Zookeeper => std::option::Option::Some("ZOOKEEPER"),
25748            Self::UnknownValue(u) => u.0.name(),
25749        }
25750    }
25751}
25752
25753impl std::default::Default for Component {
25754    fn default() -> Self {
25755        use std::convert::From;
25756        Self::from(0)
25757    }
25758}
25759
25760impl std::fmt::Display for Component {
25761    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25762        wkt::internal::display_enum(f, self.name(), self.value())
25763    }
25764}
25765
25766impl std::convert::From<i32> for Component {
25767    fn from(value: i32) -> Self {
25768        match value {
25769            0 => Self::Unspecified,
25770            1 => Self::Jupyter,
25771            3 => Self::HiveWebhcat,
25772            4 => Self::Zeppelin,
25773            5 => Self::Anaconda,
25774            6 => Self::Presto,
25775            8 => Self::Zookeeper,
25776            9 => Self::Druid,
25777            10 => Self::Solr,
25778            11 => Self::Hbase,
25779            12 => Self::Ranger,
25780            13 => Self::Docker,
25781            14 => Self::Flink,
25782            17 => Self::Trino,
25783            18 => Self::Hudi,
25784            19 => Self::Iceberg,
25785            20 => Self::Delta,
25786            21 => Self::Pig,
25787            22 => Self::JupyterKernelGateway,
25788            _ => Self::UnknownValue(component::UnknownValue(
25789                wkt::internal::UnknownEnumValue::Integer(value),
25790            )),
25791        }
25792    }
25793}
25794
25795impl std::convert::From<&str> for Component {
25796    fn from(value: &str) -> Self {
25797        use std::string::ToString;
25798        match value {
25799            "COMPONENT_UNSPECIFIED" => Self::Unspecified,
25800            "ANACONDA" => Self::Anaconda,
25801            "DELTA" => Self::Delta,
25802            "DOCKER" => Self::Docker,
25803            "DRUID" => Self::Druid,
25804            "FLINK" => Self::Flink,
25805            "HBASE" => Self::Hbase,
25806            "HIVE_WEBHCAT" => Self::HiveWebhcat,
25807            "HUDI" => Self::Hudi,
25808            "ICEBERG" => Self::Iceberg,
25809            "JUPYTER" => Self::Jupyter,
25810            "JUPYTER_KERNEL_GATEWAY" => Self::JupyterKernelGateway,
25811            "PIG" => Self::Pig,
25812            "PRESTO" => Self::Presto,
25813            "TRINO" => Self::Trino,
25814            "RANGER" => Self::Ranger,
25815            "SOLR" => Self::Solr,
25816            "ZEPPELIN" => Self::Zeppelin,
25817            "ZOOKEEPER" => Self::Zookeeper,
25818            _ => Self::UnknownValue(component::UnknownValue(
25819                wkt::internal::UnknownEnumValue::String(value.to_string()),
25820            )),
25821        }
25822    }
25823}
25824
25825impl serde::ser::Serialize for Component {
25826    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25827    where
25828        S: serde::Serializer,
25829    {
25830        match self {
25831            Self::Unspecified => serializer.serialize_i32(0),
25832            Self::Anaconda => serializer.serialize_i32(5),
25833            Self::Delta => serializer.serialize_i32(20),
25834            Self::Docker => serializer.serialize_i32(13),
25835            Self::Druid => serializer.serialize_i32(9),
25836            Self::Flink => serializer.serialize_i32(14),
25837            Self::Hbase => serializer.serialize_i32(11),
25838            Self::HiveWebhcat => serializer.serialize_i32(3),
25839            Self::Hudi => serializer.serialize_i32(18),
25840            Self::Iceberg => serializer.serialize_i32(19),
25841            Self::Jupyter => serializer.serialize_i32(1),
25842            Self::JupyterKernelGateway => serializer.serialize_i32(22),
25843            Self::Pig => serializer.serialize_i32(21),
25844            Self::Presto => serializer.serialize_i32(6),
25845            Self::Trino => serializer.serialize_i32(17),
25846            Self::Ranger => serializer.serialize_i32(12),
25847            Self::Solr => serializer.serialize_i32(10),
25848            Self::Zeppelin => serializer.serialize_i32(4),
25849            Self::Zookeeper => serializer.serialize_i32(8),
25850            Self::UnknownValue(u) => u.0.serialize(serializer),
25851        }
25852    }
25853}
25854
25855impl<'de> serde::de::Deserialize<'de> for Component {
25856    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25857    where
25858        D: serde::Deserializer<'de>,
25859    {
25860        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Component>::new(
25861            ".google.cloud.dataproc.v1.Component",
25862        ))
25863    }
25864}
25865
25866/// Actions in response to failure of a resource associated with a cluster.
25867///
25868/// # Working with unknown values
25869///
25870/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25871/// additional enum variants at any time. Adding new variants is not considered
25872/// a breaking change. Applications should write their code in anticipation of:
25873///
25874/// - New values appearing in future releases of the client library, **and**
25875/// - New values received dynamically, without application changes.
25876///
25877/// Please consult the [Working with enums] section in the user guide for some
25878/// guidelines.
25879///
25880/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25881#[derive(Clone, Debug, PartialEq)]
25882#[non_exhaustive]
25883pub enum FailureAction {
25884    /// When FailureAction is unspecified, failure action defaults to NO_ACTION.
25885    Unspecified,
25886    /// Take no action on failure to create a cluster resource. NO_ACTION is the
25887    /// default.
25888    NoAction,
25889    /// Delete the failed cluster resource.
25890    Delete,
25891    /// If set, the enum was initialized with an unknown value.
25892    ///
25893    /// Applications can examine the value using [FailureAction::value] or
25894    /// [FailureAction::name].
25895    UnknownValue(failure_action::UnknownValue),
25896}
25897
25898#[doc(hidden)]
25899pub mod failure_action {
25900    #[allow(unused_imports)]
25901    use super::*;
25902    #[derive(Clone, Debug, PartialEq)]
25903    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25904}
25905
25906impl FailureAction {
25907    /// Gets the enum value.
25908    ///
25909    /// Returns `None` if the enum contains an unknown value deserialized from
25910    /// the string representation of enums.
25911    pub fn value(&self) -> std::option::Option<i32> {
25912        match self {
25913            Self::Unspecified => std::option::Option::Some(0),
25914            Self::NoAction => std::option::Option::Some(1),
25915            Self::Delete => std::option::Option::Some(2),
25916            Self::UnknownValue(u) => u.0.value(),
25917        }
25918    }
25919
25920    /// Gets the enum value as a string.
25921    ///
25922    /// Returns `None` if the enum contains an unknown value deserialized from
25923    /// the integer representation of enums.
25924    pub fn name(&self) -> std::option::Option<&str> {
25925        match self {
25926            Self::Unspecified => std::option::Option::Some("FAILURE_ACTION_UNSPECIFIED"),
25927            Self::NoAction => std::option::Option::Some("NO_ACTION"),
25928            Self::Delete => std::option::Option::Some("DELETE"),
25929            Self::UnknownValue(u) => u.0.name(),
25930        }
25931    }
25932}
25933
25934impl std::default::Default for FailureAction {
25935    fn default() -> Self {
25936        use std::convert::From;
25937        Self::from(0)
25938    }
25939}
25940
25941impl std::fmt::Display for FailureAction {
25942    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25943        wkt::internal::display_enum(f, self.name(), self.value())
25944    }
25945}
25946
25947impl std::convert::From<i32> for FailureAction {
25948    fn from(value: i32) -> Self {
25949        match value {
25950            0 => Self::Unspecified,
25951            1 => Self::NoAction,
25952            2 => Self::Delete,
25953            _ => Self::UnknownValue(failure_action::UnknownValue(
25954                wkt::internal::UnknownEnumValue::Integer(value),
25955            )),
25956        }
25957    }
25958}
25959
25960impl std::convert::From<&str> for FailureAction {
25961    fn from(value: &str) -> Self {
25962        use std::string::ToString;
25963        match value {
25964            "FAILURE_ACTION_UNSPECIFIED" => Self::Unspecified,
25965            "NO_ACTION" => Self::NoAction,
25966            "DELETE" => Self::Delete,
25967            _ => Self::UnknownValue(failure_action::UnknownValue(
25968                wkt::internal::UnknownEnumValue::String(value.to_string()),
25969            )),
25970        }
25971    }
25972}
25973
25974impl serde::ser::Serialize for FailureAction {
25975    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25976    where
25977        S: serde::Serializer,
25978    {
25979        match self {
25980            Self::Unspecified => serializer.serialize_i32(0),
25981            Self::NoAction => serializer.serialize_i32(1),
25982            Self::Delete => serializer.serialize_i32(2),
25983            Self::UnknownValue(u) => u.0.serialize(serializer),
25984        }
25985    }
25986}
25987
25988impl<'de> serde::de::Deserialize<'de> for FailureAction {
25989    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25990    where
25991        D: serde::Deserializer<'de>,
25992    {
25993        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FailureAction>::new(
25994            ".google.cloud.dataproc.v1.FailureAction",
25995        ))
25996    }
25997}